Solved How to allow user to build ports

I am trying to write a script that will build some ports and copy the bin in the user directory.

I need this because sterm, dwm and other software use config.h files for configuration.
The goal is to use the port to build sterm (as an exemple) with the local ~/.config/st/config.h and copy the bin in ~/.bin/bin/st

But if the user is not root, I havethis issue :

Code:
 You can build st with your own config.h using the ST_CONF knob:
make ST_CONF=/path/to/st/config.h install clean
===>  License MIT accepted by the user
===>   sterm-0.8.2 depends on file: /usr/local/sbin/pkg - found
=> st-0.8.2.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> /usr/ports/distfiles/ is not writable by you; cannot fetch.
*** Error code 1

Is there a way to allow "standard" user to write in the distfiles folder or (for me a best answer) to user /tmp instead of /usr/ports/distfiles/ ?

As each user will have custom build, the make install command will never append, so I do not have the need of a full root access.

If you have other option, I am aware, but I want to script it, so modifications in Makefile seems too hard.
 
The ports framework has lots of variables that you can set. The problem here is to find the right ones. ;D

Maybe make $DISTDIR=/... or make $LOCALBASE=... install clean?
 
The ports framework has lots of variables that you can set. The problem here is to find the right ones. ;D

Maybe make $DISTDIR=/... or make $LOCALBASE=... install clean?
Please do tell if you figure this out. I tried setting the following to directories writable by a regular user:
Code:
PKG_DBDIR
PORT_DBDIR
DISTDIR
WRKDIRPREFIX
PREFIX
But I still always stumble on PKG_DBDIR not only has to be writable, it has to be owned by root. Even with INSTALL_AS_USER defined, as recommended here: https://forums.freebsd.org/threads/compiling-and-installing-a-port-as-an-unprivileged-user.22368/
 
Thanks.
make DISTDIR=/tmp/suckless fetch works well.

When I find a way to push the bin in a directory inside the home folder, I will post here and change the title.

I still have issue with the directory (path with the version).
 
The best I found is (for st and the user hakaba) :
Code:
 make PREFIX=/home/hakaba/.bin DISTDIR=/tmp WRKDIRPREFIX=/tmp ST_CONF=/home/hakaba/.config/st/.config.h
(The build is in /tmp/usr/ports/x11/sterm/work/stage/home/hakaba/.bin/bin/st folder)

I found a lot of other option that seams sexy, but I failed to use it.
Like : NO_WRKSUBDIR and WRKSRC (to remove the stage/home/hakaba/.bin/ part).


The install command, despite the PREFIX still need the root password. The work arround is a cp.
 
I would question this whole solution. IMHO, there should never be a reason to have different versions of a program per user. Could you explain why you wanted that in the first place? Maybe there is a much better solution to the original problem.
 
I explain it quicky in the first post. Suckless software (dwm, dmenu, st, sxiv...) don't have a config file. They use a config.h file instead.
So each time you want to change your configuration, you need to recompile the soft.
See here for more detail

For my user, I create a ~/suckless folder to handle it. But now, I want to create a second user that use other config.h file (so other build). But the source is the same (config.h and custom patches appart).

One simple solution is to use the ports to retrieve the source, apply patches and config.h depending of the user.
 
Oh. Wonder how this "sucks less" then. Maybe it just isn't a good idea to assist here at all, seems this software just expects any user wanting to use it to build it himself locally ;)
 
Oh. Wonder how this "sucks less" then. Maybe it just isn't a good idea to assist here at all, seems this software just expects any user wanting to use it to build it himself locally ;)

Parts of the Suckless Philosophy are somewhat reminiscent of the Unix Philosophy's "do one thing and do it well" manifesto, emphasizing simplicity over complexity in programs. Based on dwm's source code, the definition of "minimalism" used by Suckless is "as few lines of code as possible without sacrificing readability". I do agree, however, that requiring someone to compile the code from source to effect changes in the software is ridiculous these days. Even TWM and xterm use .Xresources. If you want more features than what the software normally provides, that's why the source exists. Customizations of out-of-the-box features should be read from a file rather than compiled in.
 
You can customize x11/dmenu with lots command line options. Unfortunately, x11-wm/dwm has only one option ("-v").
For dwm, there is a patch to add cli options.
And I can use xarg to pass argument.
So the config file (and .Xressource is not a simple config file, it need to be «compiled»...) is not the simpliest way in the Unix philosophy.
For me, | (pipe) is the best tool. And the final goal of my current experiment is to pass color and font config via pipe and xarg. A tool that just send a color set with 2,8, 15 or more color in all my tools (vt is a target to).
Some software seems to be simple, but changing color is not that easy (dialog for exemple).
Why put CYAN in hard on the source ?

But that a next step...
 
Back
Top