Make sure we define "extension" for older versions of GCC (5 and under).

Make systemd/dbus support optional in Makefile using WANT_SYSTEMD
flag.
Make sure "extension" keyword is defined for older versions of
GCC (5 and under).
- Patches provided by Petr Ovtchenkov and Dmitry Bogatov.
This commit is contained in:
Jesse Smith 2019-09-12 19:57:05 -03:00
parent 203422a946
commit 8b757f7584
4 changed files with 28 additions and 5 deletions

View File

@ -7,6 +7,11 @@ October 2019 (1.22.0) - jsmith@resonatingmedia.com
Added PREFIX variable to Makefile to better control where manual page and
insserv executable are stored. Defaults to /usr.
This effectively moves insserv executable from /sbin to /usr/sbin.
- Make sure we define "extension" for older versions of GCC (5 and under).
Make systemd/dbus support optional in Makefile using WANT_SYSTEMD
flag.
- Patches provided by Petr Ovtchenkov and Dmitry Bogatov.
July 2019 (1.21.0) - jsmith@resonatingmedia.com

View File

@ -15,8 +15,12 @@ DESTDIR =
VERSION = 1.21.0
TARBALL = $(PACKAGE)-$(VERSION).tar.xz
DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
CFLDBUS = $(shell pkg-config --cflags dbus-1)
PREFIX ?= /usr
ifdef WANT_SYSTEMD
CFLDBUS = $(shell pkg-config --cflags dbus-1)
else
CFLDBUS =
endif
#
# Architecture
@ -33,6 +37,9 @@ endif
endif
CFLAGS = -W -Wall -Wunreachable-code $(COPTS) $(DEBUG) $(LOOPS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \
$(ISSUSE) -DINITDIR=\"$(INITDIR)\" -DINSCONF=\"$(INSCONF)\" -pipe
ifdef WANT_SYSTEMD
CFLAGS += -DWANT_SYSTEMD=1
endif
CLOOP = # -falign-loops=0
LDFLAGS ?= -Wl,-O,3,--relax
LIBS =
@ -41,7 +48,9 @@ ifdef USE_RPMLIB
LDFLAGS += -Wl,--as-needed
LIBS += -lrpm
endif
ifdef WANT_SYSTEMD
LIBS += $(shell pkg-config --libs dbus-1)
endif
CC ?= gcc
RM = rm -f
MKDIR = mkdir -p
@ -74,11 +83,16 @@ endif
# The rules
#
ifdef WANT_SYSTEMD
SYSTEMD_O = systemd.o
SYSTEMD_H = systemd.h
endif
TODO = insserv insserv.8
all: $(TODO)
insserv: insserv.o listing.o systemd.o map.o
insserv: insserv.o listing.o ${SYSTEMD_O} map.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
listing.o: listing.c insserv.c listing.h config.h .system
@ -87,11 +101,13 @@ listing.o: listing.c insserv.c listing.h config.h .system
map.o: map.c listing.h config.h .system
$(CC) $(CFLAGS) $(CLOOP) $(CFLDBUS) -c $<
insserv.o: insserv.c map.o listing.h systemd.h config.h .system
insserv.o: insserv.c map.o listing.h ${SYSTEMD_H} config.h .system
$(CC) $(CFLAGS) $(CLOOP) $(CFLDBUS) insserv.c -c
ifdef WANT_SYSTEMD
systemd.o: systemd.c map.o listing.h systemd.h config.h .system
$(CC) $(CFLAGS) $(CLOOP) $(CFLDBUS) -c $<
endif
listing.h: .system

View File

@ -23,11 +23,13 @@
*
*/
#ifdef WANT_SYSTEMD
/*
* Systemd integration
*/
#define SYSTEMD_SERVICE_PATH "/lib/systemd/system"
#define SYSTEMD_BINARY_PATH "/bin/systemd"
#endif /* WANT_SYSTEMD */
#define MINIMAL_MAKE 1 /* Remove disabled scripts from .depend.boot,
* .depend.start, .depend.halt, and .depend.stop */

View File

@ -47,10 +47,10 @@ typedef unsigned int uint;
# ifndef asm
# define asm __asm__
# endif
#endif
# ifndef extension
# define extension __extension__
# endif
#endif
#ifndef attribute
# define attribute(attr) __attribute__(attr)
#endif