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 Added PREFIX variable to Makefile to better control where manual page and
insserv executable are stored. Defaults to /usr. insserv executable are stored. Defaults to /usr.
This effectively moves insserv executable from /sbin to /usr/sbin. 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 July 2019 (1.21.0) - jsmith@resonatingmedia.com

View File

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

View File

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

View File

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