Skip to content

Commit

Permalink
add meson build files
Browse files Browse the repository at this point in the history
Closes OpenRC#116.
Closes OpenRC#171.
Closes OpenRC#172.
Closes OpenRC#175.
  • Loading branch information
williamh committed Sep 4, 2021
1 parent 92004a2 commit d6622a1
Show file tree
Hide file tree
Showing 29 changed files with 1,197 additions and 2 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ OpenRC NEWS
This file will contain a list of notable changes for each release. Note
the information in this file is in reverse order.

## OpenRC 0.44

This version is the first to use a meson-based build system.
I will keep the makefiles for the 0.44 branch, but meson will be the
only build system supported in the future.

## OpenRC 0.43

This version changes the behavior of the checkpath helper to address
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ OpenRC README
OpenRC is a dependency-based init system that works with the
system-provided init program, normally `/sbin/init`.

## Installation
## building and installing

OpenRC uses the [meson](http://mesonbuild.com) build system, so use the
usual methods for this build system to build and install.

The old build system is still available for the 0.44.x branch, but it
will be removed for the next release. The previous documentation is
below.

## Installation (historical)

OpenRC requires GNU make.

Expand All @@ -13,7 +22,7 @@ executed using this command:

`make install`

## Configuration
## Configuration (historical)

You may wish to configure the installation by passing one or more of the
below arguments to the make command
Expand Down
59 changes: 59 additions & 0 deletions conf.d/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
conf_d_dir = get_option('sysconfdir') / 'conf.d'

conf_common = [
'bootmisc',
'fsck',
'hostname',
'localmount',
'netmount',
'swap',
'urandom',
]

conf_net = [
'network',
'staticroute',
]

conf_FreeBSD = [
'ipfw',
'modules',
'moused',
'powerd',
'rarpd',
'savecore',
'syscons',
]

conf_Linux = [
'agetty',
'consolefont',
'devfs',
'dmesg',
'hwclock',
'keymaps',
'killprocs',
'modules',
'mtab',
'net-online',
]

conf_NetBSD = [
'moused',
'rarpd',
'savecore',
]

conf_data = conf_common
if get_option('newnet')
conf_data = conf_data + conf_net
endif
if os == 'FreeBSD'
conf_data = conf_data + conf_FreeBSD
elif os == 'Linux'
conf_data = conf_data + conf_Linux
elif os == 'NetBSD'
conf_data = conf_data + conf_NetBSD
endif

install_data(conf_data, install_dir : conf_d_dir)
44 changes: 44 additions & 0 deletions etc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
etc_conf_data = configuration_data()
if os == 'FreeBSD'
etc_conf_data.set('TERM', 'cons25')
elif os == 'Linux'
etc_conf_data.set('TERM', 'wsvt25')
endif

etc_conf_common = [
'rc.conf',
]

etc_bin_FreeBSD = [
'rc.devd',
]

etc_conf_FreeBSD = [
'devd.conf',
]

etc_bin_NetBSD = [
'rc.in',
'rc.shutdown.in',
]

install_data(etc_conf_common,
install_dir : get_option('sysconfdir'))

if os == 'FreeBSD'
install_data(etc_bin_FreeBSD,
install_dir : get_option('sysconfdir'),
install_mode: 'rwxr-xr-x')
install_data(etc_conf_FreeBSD,
install_dir : get_option('sysconfdir'))
endif

if os == 'FreeBSD' or os == 'NetBSD'
foreach file : etc_bin_NetBSD
configure_file(input : file,
output : '@BASENAME@',
configuration : etc_conf_data,
install_dir: get_option('sysconfdir'),
install_mode: 'rwxr-xr-x')
endforeach
endif
100 changes: 100 additions & 0 deletions init.d/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
init_d_dir = get_option('sysconfdir') / 'init.d'

init_common = [
'bootmisc.in',
'fsck.in',
'hostname.in',
'local.in',
'localmount.in',
'loopback.in',
'netmount.in',
'osclock.in',
'root.in',
'savecache.in',
'swap.in',
'swclock.in',
'sysctl.in',
'runsvdir.in',
'urandom.in',
's6-svscan.in',
]

if get_option('newnet')
init_common = init_common + [
'network.in',
'staticroute.in',
]
endif

init_Linux = [
'agetty.in',
'binfmt.in',
'cgroups.in',
'consolefont.in',
'devfs.in',
'dmesg.in',
'hwclock.in',
'keymaps.in',
'killprocs.in',
'modules.in',
'mount-ro.in',
'mtab.in',
'numlock.in',
'procfs.in',
'net-online.in',
'save-keymaps.in',
'save-termencoding.in',
'sysfs.in',
'termencoding.in',
]

init_BSD = [
'hostid.in',
'moused.in',
'newsyslog.in',
'pf.in',
'rarpd.in',
'rc-enabled.in',
'rpcbind.in',
'savecore.in',
'syslogd.in',
]

init_FreeBSD = [
'adjkerntz.in',
'devd .in',
'dumpon.in',
'encswap.in',
'ipfw.in',
'modules.in',
'mixer.in',
'nscd.in',
'powerd.in',
'syscons.in',
]

init_NetBSD = [
'devdb.in',
'swap-blk.in',
'ttys.in',
'wscons.in',
]

init_data = init_common
if os == 'Dragonfly'
init_data = init_data + init_BSD
elif os == 'FreeBSD' or os == 'Gnu-kFreeBSD'
init_data = init_data + init_BSD + init_FreeBSD
elif os == 'Linux'
init_data = init_data + init_Linux
elif os == 'NetBSD'
init_data = init_data + init_BSD + init_NetBSD
endif

foreach init_d_file : init_data
configure_file(input : init_d_file,
output : '@BASENAME@',
configuration : init_d_conf_data,
install_dir: init_d_dir,
install_mode: 'rwxr-xr-x')
endforeach
7 changes: 7 additions & 0 deletions local.d/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
local_d_dir = get_option('sysconfdir') / 'local.d'

local_data = [
'README'
]

install_data(local_data, install_dir : local_d_dir)
34 changes: 34 additions & 0 deletions man/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
man3 = [
'einfo.3',
'rc_config.3',
'rc_deptree.3',
'rc_find_pids.3',
'rc_plugin_hook.3',
'rc_runlevel.3',
'rc_service.3',
'rc_stringlist.3',
]

man8 = [
'openrc.8',
'openrc-run.8',
'rc-service.8',
'rc-status.8',
'rc-update.8',
'start-stop-daemon.8',
'supervise-daemon.8',
]

if os == 'Linux'
man8 = man8 + [
'rc-sstat.8',
'openrc-init.8',
'openrc-shutdown.8',
]
endif

install_data(man3,
install_dir : get_option('mandir') / 'man3')
install_data(man8,
install_dir : get_option('mandir') / 'man8')
meson.add_install_script('meson_man_links.sh', get_option('mandir'), man3 + man8)
20 changes: 20 additions & 0 deletions man/meson_man_links.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

get_links() {
sed -e 's/ ,//g' \
-e '/^\.Sh NAME$/,/\.Sh/ s/\.Nm //p' \
-n ${MESON_SOURCE_ROOT}/man/${1}
}

MANDIR="$1"
shift
for man in $@; do
prefix=${man%%.*}
suffix=${man#*.}
links=$(get_links ${man})
for link in ${links}; do
if [ "${link}" != "${prefix}" ]; then
ln -sf ${man} ${MESON_INSTALL_DESTDIR_PREFIX}/${MANDIR}/man${suffix}/${link}.${suffix}
fi
done
done
Loading

0 comments on commit d6622a1

Please sign in to comment.