Solved How to tell gmake to install in /usr/local instead of /usr in order not to pollute base.

Alain De Vos

Daemon

Reaction score: 742
Messages: 2,468

(title) Also /usr/local is on a zfs filesystem so i can take snapshot and rollback
 

ekvz

Well-Known Member

Reaction score: 281
Messages: 431

Well, if there is an configure script configure --prefix=/usr/local would probably do that. If it's just a lone Makefile you might be lucky to have it respect the DESTDIR variable (either passed in the environment or on the make commandline) but there really isn't any generic way.
 

ralphbsz

Son of Beastie

Reaction score: 2,389
Messages: 3,277

That depends on the make file. Most of them have a variable that's something like "INSTALL_DESTINATION" or "TARGET", or the DESTDIR that ekvz already mentioned. Read the makefile and understand it. Perhaps start by doing a string search for "usr".
 

memreflect

Well-Known Member

Reaction score: 221
Messages: 257

Depends on what you're compiling. For example, the dwm source code uses PREFIX in its config.mk while projects like VILE use prefix; Makefile macro names are case-sensitive. If the makefile supports it, you can also use DESTDIR=/usr/local/ to force installation to /usr/local/{prefix}; I recommend ensuring the path specified by DESTDIR ends with a trailing slash, possibly resulting in a path such as /usr/local//usr/bin since I have encountered some makefiles with broken DESTDIR behavior (i.e. ${DESTDIR}${prefix} where ${prefix} was not an absolute path resulted in things like /usr/localprefix/bin instead of /usr/local/prefix/bin). And as ekvz mentioned, if you have a configure script, you usually can use --prefix=/usr/local anyway.
 

ralphbsz

Son of Beastie

Reaction score: 2,389
Messages: 3,277

Perverse idea (don't try this it home, it's insane): Leave the make file as it is. Take a union file system, and mount an empty file system over /usr. Like that, all the writes into /usr will end up in the empty file system, but all the reads from /usr still work. Then unmount the union mount, remount the (formerly empty) file system somewhere (like /tmp/new_stuff), and rsync from there to /usr/local.

The same could be accomplished by taking a snapshot of /usr, running make, rsync'ing the new stuff out to /usr/local, then reverting /usr to the snapshot.

All these ideas are INSANE, and only presented for amusement. But they might work.
 
OP
Alain De Vos

Alain De Vos

Daemon

Reaction score: 742
Messages: 2,468

I had read unionfs works fine if there are no name clashes. Because then you should yourself in the foot.

It was for this. In linux there are packages, but no FreeBSD package. It builds correctly with gmake however.
 

memreflect

Well-Known Member

Reaction score: 221
Messages: 257

For that project, a simple gmake worked fine for me. You might try env -u prefix gmake in case a prefix environment variable is defined for some reason. If it still doesn't work, I'm not sure what the problem would be unless you edited the GNUmakefile to set the prefix macro to a value other than the default /usr/local or used something like gmake prefix=/usr.
 
OP
Alain De Vos

Alain De Vos

Daemon

Reaction score: 742
Messages: 2,468

I did
Code:
gmake prefix=/usr/local
gmake install prefix=/usr/local
OK

Code:
pkg-config --cflags --libs gtkd-3
returned nothing.

But the manually include and library works fine!
Code:
ldmd2 -I/usr/local/include/d/gtkd-3 -L-lgtkd-3 ./hello.d
 

memreflect

Well-Known Member

Reaction score: 221
Messages: 257

Code:
pkg-config --cflags --libs gtkd-3
returned nothing.

But the manually include and library works fine!
Code:
ldmd2 -I/usr/local/include/d/gtkd-3 -L-lgtkd-3 ./hello.d
That's because pkgconf(1) looks in /usr/local/libdata/pkgconfig while the makefile installs into /usr/local/lib/pkgconfig. If you pull the latest changes on the master branch, you can use gmake install prefix=/usr/local pkgconfigdir=libdata/pkgconfig. Then you can use pkg-config/pkgconf as usual, instead of dealing with the includes and libs manually.
 

kpedersen

Son of Beastie

Reaction score: 2,150
Messages: 2,998

It is usually case sensitive:

Code:
# gmake install PREFIX=/usr/local
or
# gmake install DESTDIR=/usr/local
 
OP
Alain De Vos

Alain De Vos

Daemon

Reaction score: 742
Messages: 2,468

GtkD uses the lowercase prefix setting. Consistency and orthogonality :).
Is there no group of wise and old man who can bow over if prefix should be capital or small on UNIX'es.
 
OP
Alain De Vos

Alain De Vos

Daemon

Reaction score: 742
Messages: 2,468

Or provide developers and universities with free keyboards with only capital letters. Problem solved.
 

kpedersen

Son of Beastie

Reaction score: 2,150
Messages: 2,998

Or provide developers and universities with free keyboards with only capital letters. Problem solved.

I actually quite like this idea. Almost like if a child's handwriting is messy, they don't let them "upgrade" from pencil to pen in primary school.

The way some of my past students demonstrate a blatant disregard for case, It would be a very productive exercise to hand them a "beginner" keyboard!
 

ralphbsz

Son of Beastie

Reaction score: 2,389
Messages: 3,277

Shall we have the snake_case versus CamelCase discussion now? Probably not.
 
Top