xref: /OK3568_Linux_fs/buildroot/package/openrc/openrc.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# openrc
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunOPENRC_VERSION = 0.43.3
8*4882a593SmuzhiyunOPENRC_SITE = $(call github,OpenRC,openrc,$(OPENRC_VERSION))
9*4882a593SmuzhiyunOPENRC_LICENSE = BSD-2-Clause
10*4882a593SmuzhiyunOPENRC_LICENSE_FILES = LICENSE
11*4882a593SmuzhiyunOPENRC_CPE_ID_VENDOR = openrc_project
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunOPENRC_DEPENDENCIES = ncurses
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun# set LIBNAME so openrc puts files in proper directories and sets proper
16*4882a593Smuzhiyun# paths in installed files. Since in buildroot /lib64 and /lib32 always
17*4882a593Smuzhiyun# points to /lib, it's safe to hardcode it to "lib"
18*4882a593SmuzhiyunOPENRC_MAKE_OPTS = \
19*4882a593Smuzhiyun	LIBNAME=lib \
20*4882a593Smuzhiyun	LIBEXECDIR=/usr/libexec/rc \
21*4882a593Smuzhiyun	MKPKGCONFIG=no \
22*4882a593Smuzhiyun	MKSYSVINIT=yes \
23*4882a593Smuzhiyun	BRANDING="Buildroot $(BR2_VERSION_FULL)" \
24*4882a593Smuzhiyun	CC=$(TARGET_CC)
25*4882a593Smuzhiyun
26*4882a593Smuzhiyunifeq ($(BR2_SHARED_LIBS),y)
27*4882a593SmuzhiyunOPENRC_MAKE_OPTS += MKSTATICLIBS=no
28*4882a593Smuzhiyunelse
29*4882a593SmuzhiyunOPENRC_MAKE_OPTS += MKSTATICLIBS=yes
30*4882a593Smuzhiyunendif
31*4882a593Smuzhiyun
32*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_LIBSELINUX),y)
33*4882a593SmuzhiyunOPENRC_MAKE_OPTS += MKSELINUX=yes
34*4882a593SmuzhiyunOPENRC_DEPENDENCIES += libselinux
35*4882a593Smuzhiyunelse
36*4882a593SmuzhiyunOPENRC_MAKE_OPTS += MKSELINUX=no
37*4882a593Smuzhiyunendif
38*4882a593Smuzhiyun
39*4882a593Smuzhiyundefine OPENRC_BUILD_CMDS
40*4882a593Smuzhiyun	$(MAKE) $(OPENRC_MAKE_OPTS) -C $(@D)
41*4882a593Smuzhiyunendef
42*4882a593Smuzhiyun
43*4882a593Smuzhiyundefine OPENRC_INSTALL_TARGET_CMDS
44*4882a593Smuzhiyun	$(MAKE) $(OPENRC_MAKE_OPTS) DESTDIR=$(TARGET_DIR) -C $(@D) install
45*4882a593Smuzhiyun	$(INSTALL) -D -m 0755 $(OPENRC_PKGDIR)/sysv-rcs \
46*4882a593Smuzhiyun		$(TARGET_DIR)/etc/init.d/sysv-rcs
47*4882a593Smuzhiyunendef
48*4882a593Smuzhiyun
49*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_KBD),)
50*4882a593Smuzhiyun# keymaps and save-keymaps require kbd_mode and dumpkeys, respectively, so
51*4882a593Smuzhiyun# remove them if the kbd package is not selected (e.g. devices with serial
52*4882a593Smuzhiyun# console, only).
53*4882a593Smuzhiyundefine OPENRC_NO_KBD
54*4882a593Smuzhiyun	$(RM) $(TARGET_DIR)/etc/runlevels/boot/{keymaps,save-keymaps}
55*4882a593Smuzhiyun	$(RM) $(TARGET_DIR)/etc/init.d/{keymaps,save-keymaps}
56*4882a593Smuzhiyun	$(RM) $(TARGET_DIR)/etc/conf.d/keymaps
57*4882a593Smuzhiyunendef
58*4882a593SmuzhiyunOPENRC_POST_INSTALL_TARGET_HOOKS += OPENRC_NO_KBD
59*4882a593Smuzhiyunendif
60*4882a593Smuzhiyun
61*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_NETIFRC),y)
62*4882a593Smuzhiyun# netifrc replaces network, staticroute and loopback services which are
63*4882a593Smuzhiyun# installed by openrc
64*4882a593Smuzhiyundefine OPENRC_NO_NET
65*4882a593Smuzhiyun	$(RM) $(TARGET_DIR)/etc/runlevels/boot/{network,staticroute,loopback}
66*4882a593Smuzhiyun	$(RM) $(TARGET_DIR)/etc/init.d/{network,staticroute,loopback}
67*4882a593Smuzhiyun	$(RM) $(TARGET_DIR)/etc/conf.d/{network,staticroute,loopback}
68*4882a593Smuzhiyunendef
69*4882a593SmuzhiyunOPENRC_POST_INSTALL_TARGET_HOOKS += OPENRC_NO_NET
70*4882a593Smuzhiyunendif
71*4882a593Smuzhiyun
72*4882a593Smuzhiyundefine OPENRC_REMOVE_UNNEEDED
73*4882a593Smuzhiyun	$(RM) -r $(TARGET_DIR)/usr/share/openrc
74*4882a593Smuzhiyunendef
75*4882a593SmuzhiyunOPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
76*4882a593Smuzhiyun
77*4882a593Smuzhiyunifeq ($(BR2_TARGET_GENERIC_GETTY),y)
78*4882a593SmuzhiyunOPENRC_GETTY_SVCNAME = agetty.$(SYSTEM_GETTY_PORT)
79*4882a593SmuzhiyunOPENRC_GETTY_CONF_D = $(TARGET_DIR)/etc/conf.d/$(OPENRC_GETTY_SVCNAME)
80*4882a593Smuzhiyundefine OPENRC_SET_GETTY
81*4882a593Smuzhiyun	{ \
82*4882a593Smuzhiyun		echo "baud=\"$(SYSTEM_GETTY_BAUDRATE)\""; \
83*4882a593Smuzhiyun		echo "term_type=\"$(SYSTEM_GETTY_TERM)\"" ; \
84*4882a593Smuzhiyun		echo "agetty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\""; \
85*4882a593Smuzhiyun	} > $(OPENRC_GETTY_CONF_D)
86*4882a593Smuzhiyun	ln -sf agetty $(TARGET_DIR)/etc/init.d/$(OPENRC_GETTY_SVCNAME)
87*4882a593Smuzhiyun	ln -sf /etc/init.d/$(OPENRC_GETTY_SVCNAME) \
88*4882a593Smuzhiyun		$(TARGET_DIR)/etc/runlevels/default/$(OPENRC_GETTY_SVCNAME)
89*4882a593Smuzhiyunendef
90*4882a593SmuzhiyunOPENRC_TARGET_FINALIZE_HOOKS += OPENRC_SET_GETTY
91*4882a593Smuzhiyunendif # BR2_TARGET_GENERIC_GETTY
92*4882a593Smuzhiyun
93*4882a593Smuzhiyun$(eval $(generic-package))
94