Skip to content

Commit df6e94a

Browse files
committed
librc, meson: remove PKG_PREFIX
the same as the local prefix on seemingly all systems, of which was defined incorrectly as $prefix/usr/local. since most systems call it local prefix, drop the 'pkg' one
1 parent 67d10bf commit df6e94a

8 files changed

Lines changed: 20 additions & 51 deletions

File tree

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ usual methods for this build system to build and install.
1313

1414
We don't support building a static OpenRC with PAM.
1515

16-
`PKG_PREFIX` should be set to where packages install to by default.
17-
18-
`LOCAL_PREFIX` should be set to where user maintained packages are.
19-
Only set `LOCAL_PREFIX` if different from `PKG_PREFIX`.
20-
2116
`rc` and `rc.shutdown` are the hooks from the BSD init into OpenRC.
2217

2318
`devd.conf` is modified from FreeBSD to call `/etc/rc.devd` which is a

init.d/rc-enabled.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ start()
2121
{
2222
ebegin "Starting local rc services"
2323
local svc= enabled= retval=0 service= pkgdir=
24-
[ -n "@PKG_PREFIX@" ] && pkgdir="@PKG_PREFIX@/etc/rc.d/*"
25-
for svc in $(rcorder /etc/rc.d/* $pkgdir 2>/dev/null); do
24+
[ -n "@LOCAL_PREFIX@" ] && localdir="@LOCAL_PREFIX@/etc/rc.d/*"
25+
for svc in $(rcorder /etc/rc.d/* $localdir 2>/dev/null); do
2626
[ -x "$svc" ] || continue
2727
service=${svc##*/}
2828

meson.build

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ libname = get_option('libdir').split('/')[-1]
2929

3030
local_prefix = get_option('local_prefix')
3131
if local_prefix == ''
32-
local_prefix = get_option('prefix') / 'usr' / 'local'
32+
if os == 'netbsd'
33+
local_prefix = '/usr/pkg'
34+
else
35+
local_prefix = '/usr/local'
36+
endif
3337
endif
3438

3539
os = host_machine.system()
@@ -52,17 +56,6 @@ if get_option('pam')
5256
c_flags += '-DHAVE_PAM'
5357
endif
5458

55-
pkg_prefix = get_option('pkg_prefix')
56-
if pkg_prefix == ''
57-
if os == 'dragonfly' or os == 'freebsd'
58-
pkg_prefix = '/usr/local'
59-
elif os == 'gnu' or os == 'linux'
60-
pkg_prefix = '/usr'
61-
elif os == 'netbsd'
62-
pkg_prefix = '/usr/pkg'
63-
endif
64-
endif
65-
6659
bindir = get_option('prefix') / get_option('bindir')
6760
libdir = get_option('prefix') / get_option('libdir')
6861
pluginsdir = libdir / 'rc/plugins'
@@ -166,7 +159,7 @@ rc_incdir = include_directories('src/librc')
166159

167160
init_d_conf_data = configuration_data()
168161
init_d_conf_data.set('SBINDIR', sbindir)
169-
init_d_conf_data.set('PKG_PREFIX', pkg_prefix)
162+
init_d_conf_data.set('LOCAL_PREFIX', local_prefix)
170163
init_d_conf_data.set('SYSCONFDIR', get_option('sysconfdir'))
171164
init_d_conf_data.set('RC_LIBEXECDIR', rc_libexecdir)
172165

meson_options.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ option('pam', type : 'boolean',
1212
description : 'enable PAM support')
1313
option('pam_libdir', type : 'string',
1414
description : 'directory to install pam security modules')
15-
option('pkg_prefix', type : 'string',
16-
description : 'default location where packages are installed')
1715
option('pkgconfig', type : 'boolean',
1816
description : 'build PKGConfig files')
1917
option('selinux', type : 'feature', value : 'auto',

sh/functions.sh.in

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ _sanitize_path()
6161
case "$p" in
6262
@LIBEXECDIR@/bin|@LIBEXECDIR@/sbin);;
6363
@BINDIR@|@SBINDIR@|/usr/bin|/usr/sbin);;
64-
@PKG_PREFIX@/bin|@PKG_PREFIX@/sbin);;
6564
@LOCAL_PREFIX@/bin|@LOCAL_PREFIX@/sbin);;
6665
*) path="$path${path:+:}$p";;
6766
esac
6867
done
69-
echo "$path"
68+
[ "$path" ] && echo ":$path"
7069
}
7170

7271
# Allow our scripts to support zsh
@@ -78,20 +77,8 @@ if [ -n "$ZSH_VERSION" ]; then
7877
fi
7978

8079
# Make a sane PATH
81-
_PKG_PREFIX=@PKG_PREFIX@
82-
_LOCAL_PREFIX=@LOCAL_PREFIX@
83-
_LOCAL_PREFIX=${_LOCAL_PREFIX:-/usr/local}
84-
_PATH="@LIBEXECDIR@/bin:/bin:/sbin:/usr/bin:/usr/sbin"
85-
86-
if [ -n "$_PKG_PREFIX" ]; then
87-
_PATH="$_PATH:$_PKG_PREFIX/bin:$_PKG_PREFIX/sbin"
88-
fi
89-
if [ -n "$_LOCAL_PREFIX" ]; then
90-
_PATH="$_PATH:$_LOCAL_PREFIX/bin:$_LOCAL_PREFIX/sbin"
91-
fi
92-
_path="$(_sanitize_path "$PATH")"
93-
PATH="$_PATH${_path:+:}$_path" ; export PATH
94-
unset _sanitize_path _PREFIX _PKG_PREFIX _LOCAL_PREFIX _PATH _path
80+
export PATH="@LIBEXECDIR@/bin:/bin:/sbin:/usr/bin:/usr/sbin:@LOCAL_PREFIX@/bin:@LOCAL_PREFIX@/sbin$(_sanitize_path)"
81+
unset _sanitize_path
9582

9683
for arg; do
9784
case "$arg" in

sh/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ sh_conf_data = configuration_data()
22
sh_conf_data.set('BINDIR', bindir)
33
sh_conf_data.set('LIBEXECDIR', rc_libexecdir)
44
sh_conf_data.set('LOCAL_PREFIX', local_prefix)
5-
sh_conf_data.set('PKG_PREFIX', pkg_prefix)
65
sh_conf_data.set('SBINDIR', sbindir)
76
sh_conf_data.set('SHELL', get_option('shell'))
87
sh_conf_data.set('SYSCONFDIR', get_option('sysconfdir'))

src/librc/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ rc_h_conf_data = configuration_data()
22
rc_h_conf_data.set('RC_LIBEXECDIR', rc_libexecdir)
33
rc_h_conf_data.set('RC_PLUGINDIR', pluginsdir)
44
rc_h_conf_data.set('LOCAL_PREFIX', local_prefix)
5-
rc_h_conf_data.set('PKG_PREFIX', pkg_prefix)
65
rc_h_conf_data.set('SYSCONFDIR', get_option('sysconfdir'))
76

87
librc_sources = [

src/librc/rc.h.in

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,21 @@ extern "C" {
4747

4848
#define RC_PATH_PREFIX RC_LIBEXECDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin"
4949

50-
/* PKG_PREFIX is where packages are installed if different from the base OS
51-
* On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD
52-
* /usr/pkg. */
53-
#define RC_PKG_PREFIX "@PKG_PREFIX@"
54-
#ifdef RC_PKG_PREFIX
55-
# define RC_PKG_INITDIR RC_PKG_PREFIX "/etc/init.d"
56-
# define RC_PKG_CONFDIR RC_PKG_PREFIX "/etc/conf.d"
57-
#endif
58-
59-
/* LOCAL_PREFIX is for user written stuff, which the base OS and package
60-
* manager don't touch. */
50+
/* LOCAL_PREFIX is used for packages not part of the base system */
6151
#define RC_LOCAL_PREFIX "@LOCAL_PREFIX@"
6252
#ifdef RC_LOCAL_PREFIX
6353
# define RC_LOCAL_INITDIR RC_LOCAL_PREFIX "/etc/init.d"
6454
# define RC_LOCAL_CONFDIR RC_LOCAL_PREFIX "/etc/conf.d"
6555
#endif
6656

57+
/* Compat macros */
58+
#define RC_PKG_PREFIX RC_LOCAL_PREFIX
59+
#ifdef RC_PKG_PREFIX
60+
# define RC_PKG_INITDIR RC_PKG_PREFIX "/etc/init.d"
61+
# define RC_PKG_CONFDIR RC_PKG_PREFIX "/etc/conf.d"
62+
#endif
63+
64+
6765
#ifndef rc_private
6866
#define rc_private __attribute__((deprecated("private field")))
6967
#endif

0 commit comments

Comments
 (0)