Skip to content

Commit

Permalink
build: drop ROOTPREFIX setting
Browse files Browse the repository at this point in the history
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
  • Loading branch information
williamh committed Sep 23, 2024
1 parent d98d7eb commit 12bc1ca
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 38 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
17 changes: 4 additions & 13 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
2 changes: 0 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
8 changes: 1 addition & 7 deletions sh/functions.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 0 additions & 5 deletions sh/meson.build
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
8 changes: 1 addition & 7 deletions src/librc/meson.build
Original file line number Diff line number Diff line change
@@ -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'))
Expand Down
3 changes: 1 addition & 2 deletions src/librc/rc.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 12bc1ca

Please sign in to comment.