From 12bc1ca1fe6a4c6419fb6cf460f84517e0a2fb0d Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Fri, 20 Sep 2024 14:55:34 -0500 Subject: [PATCH] build: drop ROOTPREFIX setting This change removes the ROOTPREFIX build setting. If your OS expects to have / mounted earlier in the boot process than /usr, you will need to pass the appropriate directory settings to "meson setup" as part of the build process, for example: $ meson setup \ --bindir /bin --libdir /lib64 --libexecdir /lib --sbindir /sbin \ build --- README.md | 13 +++++++++++-- meson.build | 17 ++++------------- meson_options.txt | 2 -- sh/functions.sh.in | 8 +------- sh/meson.build | 5 ----- src/librc/meson.build | 8 +------- src/librc/rc.h.in | 3 +-- 7 files changed, 18 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 8164e04e6..2c32a13e2 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,6 @@ We don't support building a static OpenRC with PAM. `LOCAL_PREFIX` should be set to where user maintained packages are. Only set `LOCAL_PREFIX` if different from `PKG_PREFIX`. -`ROOTPREFIX` should be set when the root path is different from '/'. - `rc` and `rc.shutdown` are the hooks from the BSD init into OpenRC. `devd.conf` is modified from FreeBSD to call `/etc/rc.devd` which is a @@ -32,6 +30,17 @@ Obviously, if you're installing this onto a system that does not use OpenRC by default then you may wish to backup the above listed files, remove them and then install so that the OS hooks into OpenRC. +If you are installing this onto a system which has separate / and /usr +file systems and expects / to be mounted before /usr, you will need to +make sure the appropriate pieces are installed on / by passing the +appropriate options to "meson setup" as follows: + +``` +$ meson setup \ + --bindir /bin --libdir /lib64 --libexecdir /lib --sbindir /sbin \ + build_path +``` + ## Discussions We are testing [discussions](https://github.com/OpenRC/openrc/discussions), so diff --git a/meson.build b/meson.build index 770d6ff4e..e7e7709f5 100644 --- a/meson.build +++ b/meson.build @@ -79,23 +79,14 @@ else pkg_prefix = option_pkg_prefix endif -rootprefix = get_option('rootprefix') -if rootprefix == '' -rootprefix = '/' -endif - -bindir = rootprefix / get_option('bindir') -libdir = rootprefix / get_option('libdir') -libexecdir = get_option('libexecdir') -if os == 'Linux' and libexecdir == 'libexec' - libexecdir = 'lib' -endif -libexecdir = rootprefix / libexecdir +bindir = get_option('prefix') / get_option('bindir') +libdir = get_option('prefix') / get_option('libdir') +libexecdir = get_option('prefix') / get_option('libexecdir') rc_libexecdir = libexecdir / 'rc' rc_bindir = rc_libexecdir / 'bin' rc_sbindir = rc_libexecdir / 'sbin' rc_shdir = rc_libexecdir / 'sh' -sbindir = rootprefix / get_option('sbindir') +sbindir = get_option('prefix') / get_option('sbindir') pamdir = get_option('sysconfdir') / 'pam.d' crypt_dep = [] diff --git a/meson_options.txt b/meson_options.txt index 6092b114f..30a7dcfdb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -18,8 +18,6 @@ option('pkg_prefix', type : 'string', description : 'default location where packages are installed') option('pkgconfig', type : 'boolean', description : 'build PKGConfig files') -option('rootprefix', type : 'string', - description : 'override the root prefix') option('selinux', type : 'feature', value : 'auto', description : 'enable SELinux support') option('shell', type : 'string', value : '/bin/sh', diff --git a/sh/functions.sh.in b/sh/functions.sh.in index 63730b325..f58e710bd 100644 --- a/sh/functions.sh.in +++ b/sh/functions.sh.in @@ -79,16 +79,10 @@ if [ -n "$ZSH_VERSION" ]; then fi # Make a sane PATH -_PREFIX=@PREFIX@ _PKG_PREFIX=@PKG_PREFIX@ _LOCAL_PREFIX=@LOCAL_PREFIX@ _LOCAL_PREFIX=${_LOCAL_PREFIX:-/usr/local} -_PATH=@LIBEXECDIR@/bin -case "$_PREFIX" in - "$_PKG_PREFIX"|"$_LOCAL_PREFIX") ;; - *) _PATH="$_PATH:$_PREFIX/bin:$_PREFIX/sbin";; -esac -_PATH="$_PATH":/bin:/sbin:/usr/bin:/usr/sbin +_PATH="@LIBEXECDIR@/bin:/bin:/sbin:/usr/bin:/usr/sbin" if [ -n "$_PKG_PREFIX" ]; then _PATH="$_PATH:$_PKG_PREFIX/bin:$_PKG_PREFIX/sbin" diff --git a/sh/meson.build b/sh/meson.build index e8849d40e..981340b0a 100644 --- a/sh/meson.build +++ b/sh/meson.build @@ -1,9 +1,4 @@ sh_conf_data = configuration_data() -if rootprefix == '/' - sh_conf_data.set('PREFIX', '') - else - sh_conf_data.set('PREFIX', rootprefix) -endif sh_conf_data.set('BINDIR', bindir) sh_conf_data.set('LIBEXECDIR', rc_libexecdir) sh_conf_data.set('LOCAL_PREFIX', local_prefix) diff --git a/src/librc/meson.build b/src/librc/meson.build index 30caa1f3f..4971cb979 100644 --- a/src/librc/meson.build +++ b/src/librc/meson.build @@ -1,11 +1,5 @@ rc_h_conf_data = configuration_data() -if rootprefix == '/' - rc_h_conf_data.set('PREFIX', '') - else - rc_h_conf_data.set('PREFIX', rootprefix) - endif -rc_h_conf_data.set('LIB', libname) -rc_h_conf_data.set('LIBEXECDIR', rc_libexecdir) +rc_h_conf_data.set('RC_LIBEXECDIR', rc_libexecdir) rc_h_conf_data.set('LOCAL_PREFIX', local_prefix) rc_h_conf_data.set('PKG_PREFIX', pkg_prefix) rc_h_conf_data.set('SYSCONFDIR', get_option('sysconfdir')) diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in index 425cbd217..3695a82df 100644 --- a/src/librc/rc.h.in +++ b/src/librc/rc.h.in @@ -23,8 +23,7 @@ extern "C" { #endif #define RC_SYSCONFDIR "@SYSCONFDIR@" -#define RC_LIBDIR "/@LIB@/rc" -#define RC_LIBEXECDIR "@LIBEXECDIR@" +#define RC_LIBEXECDIR "@RC_LIBEXECDIR@" #if defined(__linux__) || (defined(__FreeBSD_kernel__) && \ defined(__GLIBC__)) || defined(__GNU__) #define RC_SVCDIR "/run/openrc"