CTSRD-CHERI / cheribuild

Easily build and run CHERI related projects
http://www.chericpu.com
Other
68 stars 46 forks source link

openssh: make args not honored on unclean builds #297

Closed brooksdavis closed 2 years ago

brooksdavis commented 2 years ago

In #295 I added DESTDIR to make arguments so DESTDIR is honored. This works on a clean build (e.g., cheribuild openssh-morello-purecap --clean) where gmake install is called with:

Installing openssh-morello-purecap (-morello-purecap) ... 
cd /home/bed22/cheri/build/openssh-morello-purecap-build && env PKG_CONFIG_PATH=/home/bed22/cheri/output/rootfs-morello-purecap/usr/libdata/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/lib/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/share/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/libdata/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/lib/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/share/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/libdata/pkgconfig PKG_CONFIG_LIBDIR=/home/bed22/cheri/output/rootfs-morello-purecap/usr/libdata/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/lib/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/share/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/libdata/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/lib/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/share/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/libdata/pkgconfig PKG_CONFIG_SYSROOT_DIR=/home/bed22/cheri/output/rootfs-morello-purecap DESTDIR=/home/bed22/cheri/output/rootfs-morello-purecap nice gmake install DESTDIR=/home/bed22/cheri/output/rootfs-morello-purecap

but when I run without --clean we get:

Installing openssh-morello-purecap (-morello-purecap) ... 
cd /home/bed22/cheri/build/openssh-morello-purecap-build && env PKG_CONFIG_PATH=/home/bed22/cheri/output/rootfs-morello-purecap/usr/libdata/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/lib/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/share/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/libdata/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/lib/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/share/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/libdata/pkgconfig PKG_CONFIG_LIBDIR=/home/bed22/cheri/output/rootfs-morello-purecap/usr/libdata/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/lib/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/share/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/morello-purecap/libdata/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/lib/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/share/pkgconfig:/home/bed22/cheri/output/rootfs-morello-purecap/usr/local/libdata/pkgconfig PKG_CONFIG_SYSROOT_DIR=/home/bed22/cheri/output/rootfs-morello-purecap DESTDIR=/home/bed22/cheri/output/rootfs-morello-purecap nice gmake install

and the install fails because it tries to write to /opt because the DESTDIR in the environment is ignored (the Makefile contains a DESTDIR= line near the top).

jrtc27 commented 2 years ago

Move the setting from configure to setup

jrtc27 commented 2 years ago

Best practice would be for the configure env calls to also live there, that way you keep all the what-options-to-pass behaviour in one central place with configure/build/install just dealing with how to interact with the build system