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

also, move plugins  to ```libdir/rc/plugins``` which is the standard
location for plugins accessed via dlopen.
  • Loading branch information
williamh committed Sep 23, 2024
1 parent 4e0c16a commit 7c31e50
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 40 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
20 changes: 6 additions & 14 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,15 @@ 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')
pluginsdir = libdir / 'rc/plugins'
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 Expand Up @@ -230,7 +222,7 @@ if get_option('pkgconfig')
libraries : librc,
subdirs : ['openrc'],
variables: {
'rc_path': rc_libexecdir,
'pluginsdir': pluginsdir,
}
)
endif
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
9 changes: 2 additions & 7 deletions src/librc/meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
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('RC_PLUGINDIR', pluginsdir)
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
5 changes: 2 additions & 3 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 All @@ -34,7 +33,7 @@ extern "C" {
#define RC_RUNLEVELDIR RC_SYSCONFDIR "/runlevels"
#define RC_INITDIR RC_SYSCONFDIR "/init.d"
#define RC_CONFDIR RC_SYSCONFDIR "/conf.d"
#define RC_PLUGINDIR RC_LIBDIR "/plugins"
#define RC_PLUGINDIR "@RC_PLUGINDIR@"

#define RC_INIT_FIFO RC_SVCDIR"/init.ctl"
#define RC_PROFILE_ENV RC_SYSCONFDIR "/profile.env"
Expand Down

0 comments on commit 7c31e50

Please sign in to comment.