Where to find the downloaded source code?

The question might sound silly, but... how can I take a look into the actual source code of a port? While doing make install or make fetch it downloads a tarball and extracts it... where?
I couldn't find any hint neither in the handbook, nor by googling. So before I go to compare ZFS snapshots, maybe it's better just to ask :)
Thanks
 
how can I take a look into the actual source code of a port? While doing make install or make fetch it downloads a tarball and extracts it... where?
Depends on the port, check the ports(7) manualpage for an overview of all the available build targets, The targets extract and patch could be useful here. One merely extracts the port, the other does the above and applies the patches which the port maintainer made.

But be warned though: just because it's a port doesn't imply that it also provides and/or uses any actual source code. Some port maintainers rely on pre-build packages and there are also closed-source ports available. So this also heavily depends on the port you're using.
 
The sources are extracted under the working directory which you can get with make -V WRKDIR in the port's directory. make -V WRKSRC will also point you to the unpacked sources directly.

As Minbari said the working directory is under work/ in the port's directory by default, but it doesn't really have to be depending on your settings and environment.
 
Extract is exactly what I was missing! After "make extract" the "work" directory appeared in the port.
Thanks a lot
 
Where to find the downloaded source code?
/usr/src :)

The question might sound silly, but... how can I take a look into the actual source code of a port? While doing make install or make fetch it downloads a tarball and extracts it... where?
/usr/ports/your/port/work

before you need to execute:
% cd /usr/ports/your/port/
% su
# make fetch extract
 
before you need to execute:
% cd /usr/ports/your/port/
% sudo make fetch extract
  • fetch is already implied by extract so it's not necessary to specify it.
  • Please don't fetch/extract/build things as root. :-( The only stage that needs to be run as root is install. Everything else can be run as a regular user if permissions on the ports tree, /var/db/ports, WRKDIRPREFIX, and DISTDIR are set correctly.
 
Please don't fetch/extract/build things as root
Why? Is it dangerous to use it in ports tree? :)
Anyway you build and extract everything as root,
while donig # make install Or no?

fetch is already implied by extract so it's not necessary to specify it.
I always use every argument with # make (or I use portmaster instead),
so when I want to patch, I use # make fetch extract patch
And when I want to "configure"… :D History search in your shell helps a lot in such cases.
 
Why? Is it dangerous to use it in ports tree? :)
Of course it is. You're fetching third-party sources, which often contains shell scripts with thousands of lines of code which do who knows what.
Anyway you build and extract everything as root,
while donig # make install Or no?
No, if you run make install as a regular user the ports framework will build everything as that user and only when everything is built, will escalate to root via su(1) to actually install files into the system.
 
No, if you run make install as a regular user the ports framework will build everything as that user and when everything is built, will escalate to root via su(1) to actually install files into the system.
Never used that thing :D
I always installed ports as root. And while I'm still alive for today, and I don't think it is a big problem (in my opinion :D).
 
No, if you run make install as a regular user the ports framework will build everything as that user and only when everything is built, will escalate to root via su(1) to actually install files into the system.

The rights by default are set to drwxr-xr-x root wheel. I'll probably have to add +w to the wheel group :) Otherwise make install indeed asks for root password couple of times (for every dependency I assume) but them randomly fails.
 
BTW, it will be a great feature IMO, if ports will be built in ~/.work/ by default.
 
Set WRKDIRPREFIX to it. It can be set in /etc/make.conf or your own environment.
Yes, it really works, there is no need to use sudo or su,
to fetch and extract, but, unfortunately, it starts asking password for every dependency,
when you try to build a port and it is annoying IMHO a little bit.
GdavPus.png

Also working directory paths are a little bit too long,
it is like /home/iluxa/.work/usr/ports/x11/xscreensaver/work/xscreensaver-5.38.

Anyway, it should be safe to build, fetch, extract and install ports in their directories and as root,
because it checks "SHA256 Checksum" every time it fetches port sources.
 
Also working directory paths are a little bit too long,
it is like /home/iluxa/.work/usr/ports/x11/xscreensaver/work/xscreensaver-5.38.
Just use cd `make -V WRKSRC` if you need to go to it. You can make it a shell alias too.
Yes, it really works, there is no need to use sudo or su,
to fetch, extract, but unfortunately it starts asking passwords for every dependency,
when you try to build a port and it is annoying IMHO a little bit.
Well that's because it's using su(1) which doesn't cache credentials like sudo(8). You can use sudo by setting
Code:
SU_CMD=/usr/local/bin/sudo -E sh -c
in /etc/make.conf.
 
Back
Top