Skip to content

Commit

Permalink
Split libsystemd for backwards-compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Dec 19, 2014
1 parent 1603489 commit e11e6cc
Show file tree
Hide file tree
Showing 27 changed files with 354 additions and 51 deletions.
65 changes: 46 additions & 19 deletions Makefile
Expand Up @@ -5,43 +5,70 @@ DESTDIR ?=
INSTALL = install -v
LN = ln -v

all: libsystemd/libsystemd.so.0 \
all: libsystemd-daemon/libsystemd-daemon.so \
libsystemd-journal/libsystemd-journal.so \
libsystemd-login/libsystemd-login.so \
libsystemd/libsystemd.so \
loginkitd/loginkitd \
pam_loginkit/pam_loginkit.so \
libsystemd/libsystemd.pc
pam_loginkit/pam_loginkit.so

common/libloginkit-common.a:
cd common; $(MAKE)

libsystemd/libsystemd.so.0 libsystemd/libsystemd.pc: common/libloginkit-common.a
cd libsystemd; $(MAKE)
libsystemd-daemon/libsystemd-daemon.so: common/libloginkit-common.a
cd libsystemd-daemon; $(MAKE)

libsystemd-journal/libsystemd-journal.so: common/libloginkit-common.a
cd libsystemd-journal; $(MAKE)

loginkitd/loginkitd: common/libloginkit-common.a
cd loginkitd; $(MAKE)

libsystemd-login/libsystemd-login.so: common/libloginkit-common.a
cd libsystemd-login; $(MAKE)

libsystemd/libsystemd.so: libsystemd-daemon/libsystemd-daemon.so \
libsystemd-journal/libsystemd-journal.so \
libsystemd-login/libsystemd-login.so
cd libsystemd; $(MAKE)

pam_loginkit/pam_loginkit.so: common/libloginkit-common.a
cd pam_loginkit; $(MAKE)

install: all
$(INSTALL) -D -m 644 pam_loginkit/pam_loginkit.so $(DESTDIR)/$(LIB_DIR)/security/pam_loginkit.so
$(INSTALL) -D -m 644 libsystemd/libsystemd.so.0 $(DESTDIR)/$(LIB_DIR)/libsystemd.so.0.0.1
$(LN) -s libsystemd.so.0.0.1 $(DESTDIR)/$(LIB_DIR)/libsystemd.so.0
$(INSTALL) -D -m 755 loginkitd/loginkitd $(DESTDIR)/$(SBIN_DIR)/loginkitd
$(INSTALL) -D -m 644 libsystemd-daemon/libsystemd-daemon.so $(DESTDIR)/$(LIB_DIR)/libsystemd-daemon.so.0.1
$(LN) -s libsystemd-daemon.so.0.1 $(DESTDIR)/$(LIB_DIR)/libsystemd-daemon.so.0
$(LN) -s libsystemd-daemon.so.0.1 $(DESTDIR)/$(LIB_DIR)/libsystemd-daemon.so
$(INSTALL) -D -m 644 libsystemd-daemon/sd-daemon.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/sd-daemon.h
$(INSTALL) -D -m 644 libsystemd-daemon/libsystemd-daemon.pc $(DESTDIR)/$(LIB_DIR)/pkgconfig/libsystemd-daemon.pc

$(INSTALL) -m 644 libsystemd-journal/libsystemd-journal.so $(DESTDIR)/$(LIB_DIR)/libsystemd-journal.so.0.1
$(LN) -s libsystemd-journal.so.0.1 $(DESTDIR)/$(LIB_DIR)/libsystemd-journal.so.0
$(LN) -s libsystemd-journal.so.0.1 $(DESTDIR)/$(LIB_DIR)/libsystemd-journal.so
$(INSTALL) -m 644 libsystemd-journal/journal.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/sd-journal.h
$(INSTALL) -m 644 libsystemd-journal/libsystemd-journal.pc $(DESTDIR)/$(LIB_DIR)/pkgconfig/libsystemd-journal.pc

$(INSTALL) -m 644 libsystemd-login/libsystemd-login.so $(DESTDIR)/$(LIB_DIR)/libsystemd-login.so.0.1
$(LN) -s libsystemd-login.so.0.1 $(DESTDIR)/$(LIB_DIR)/libsystemd-login.so.0
$(LN) -s libsystemd-login.so.0.1 $(DESTDIR)/$(LIB_DIR)/libsystemd-login.so
$(INSTALL) -m 644 libsystemd-login/session.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/session.h
$(INSTALL) -m 644 libsystemd-login/seat.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/seat.h
$(INSTALL) -m 644 libsystemd-login/pid.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/pid.h
$(INSTALL) -m 644 libsystemd-login/sd-login.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/sd-login.h
$(INSTALL) -m 644 libsystemd-login/libsystemd-login.pc $(DESTDIR)/$(LIB_DIR)/pkgconfig/libsystemd-login.pc

$(INSTALL) -D -m 644 libsystemd/session.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/session.h
$(INSTALL) -D -m 644 libsystemd/seat.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/seat.h
$(INSTALL) -D -m 644 libsystemd/pid.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/pid.h
$(INSTALL) -D -m 644 libsystemd/sd-login.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/sd-login.h
$(INSTALL) -D -m 644 libsystemd/journal.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/sd-journal.h
$(INSTALL) -D -m 644 libsystemd/sd-daemon.h $(DESTDIR)/$(INCLUDE_DIR)/systemd/sd-daemon.h
$(INSTALL) -m 644 libsystemd/libsystemd.so $(DESTDIR)/$(LIB_DIR)/libsystemd.so.0.1
$(LN) -s libsystemd.so.0.1 $(DESTDIR)/$(LIB_DIR)/libsystemd.so.0
$(LN) -s libsystemd.so.0.1 $(DESTDIR)/$(LIB_DIR)/libsystemd.so

$(INSTALL) -D -m 644 libsystemd/libsystemd.pc $(DESTDIR)/$(LIB_DIR)/pkgconfig/libsystemd.pc
$(LN) -s libsystemd.pc $(DESTDIR)/$(LIB_DIR)/pkgconfig/libsystemd-daemon.pc
$(LN) -s libsystemd.pc $(DESTDIR)/$(LIB_DIR)/pkgconfig/libsystemd-journal.pc
$(LN) -s libsystemd.pc $(DESTDIR)/$(LIB_DIR)/pkgconfig/libsystemd-login.pc
$(INSTALL) -D -m 644 pam_loginkit/pam_loginkit.so $(DESTDIR)/$(LIB_DIR)/security/pam_loginkit.so
$(INSTALL) -D -m 755 loginkitd/loginkitd $(DESTDIR)/$(SBIN_DIR)/loginkitd

clean:
cd pam_loginkit; $(MAKE) clean
cd loginkitd; $(MAKE) clean
cd libsystemd; $(MAKE) clean
cd libsystemd-login; $(MAKE) clean
cd libsystemd-journal; $(MAKE) clean
cd libsystemd-daemon; $(MAKE) clean
cd common; $(MAKE) clean
9 changes: 4 additions & 5 deletions Makefile.common
@@ -1,6 +1,6 @@
CC ?= cc
CFLAGS ?= -O2 -pipe
LDFLAGS ?= -s
LDFLAGS ?= -Wl,-s
PKG_CONFIG ?= pkg-config

PREFIX ?= /usr
Expand All @@ -10,8 +10,8 @@ DOC_DIR = $(PREFIX)/share/doc
LIB_DIR = $(PREFIX)/lib
INCLUDE_DIR = $(PREFIX)/include

CFLAGS += -I../common
LDFLAGS += -L../common
CFLAGS += -I$(PWD)/../common
LDFLAGS += -L$(PWD)/../common
LIBS = -lloginkit-common

GIO_CFLAGS = $(shell $(PKG_CONFIG) --cflags gio-2.0 gio-unix-2.0)
Expand All @@ -25,8 +25,7 @@ OBJS = $(SRCS:.c=.o)
CFLAGS += -std=gnu99 \
-Wall \
-pedantic \
-pthread \
-fvisibility=hidden \
-fPIC \
-DG_LOG_DOMAIN=\"LoginKit\"
LDFLAGS += -pthread -fPIC
LDFLAGS += -fPIC
22 changes: 22 additions & 0 deletions libsystemd-daemon/Makefile
@@ -0,0 +1,22 @@
include ../Makefile.common

LDFLAGS += -Wl,-soname=libsystemd-daemon.so.0 -Wl,--version-script=compat.sym

LIB = libsystemd-daemon.so

all: $(LIB) libsystemd-daemon.pc

%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)

$(LIB): $(OBJS) compat.sym
$(CC) -o $@ $(OBJS) -shared $(LDFLAGS) $(LIBS)

libsystemd-daemon.pc: libsystemd-daemon.pc.in
sed -e s~@PREFIX@~$(PREFIX)~g \
-e s~@LIB_DIR@~$(LIB_DIR)~g \
-e s~@INCLUDE_DIR@~$(INCLUDE_DIR)~g \
$^ > $@

clean:
rm -f libsystemd-daemon.pc $(LIB) $(OBJS)
9 changes: 2 additions & 7 deletions libsystemd/compat.sym → libsystemd-daemon/compat.sym
Expand Up @@ -22,12 +22,7 @@
* THE SOFTWARE.
*/

LIBSYSTEMD_209 {
LIBSYSTEMD_DAEMON_31 {
global:
sd_pid_get_session;
sd_pid_get_owner_uid;
sd_pid_get_machine_name;
sd_pid_get_unit;
sd_pid_get_user_unit;
sd_pid_get_slice;
sd_booted;
};
32 changes: 32 additions & 0 deletions libsystemd-daemon/libsystemd-daemon.pc.in
@@ -0,0 +1,32 @@
# this file is part of LoginKit.
#
# Copyright (c) 2014 Dima Krasner
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

prefix=@PREFIX@
exec_prefix=@PREFIX@
libdir=@LIB_DIR@
includedir=@INCLUDE_DIR@

Name: LoginKit
Description: LoginKit library
Version: 1
Libs: -L${libdir} -lsystemd
Cflags: -I${includedir}
7 changes: 0 additions & 7 deletions libsystemd/misc.c → libsystemd-daemon/misc.c
Expand Up @@ -22,7 +22,6 @@
* THE SOFTWARE.
*/

#include "bus.h"
#include "misc.h"

__attribute__((visibility("default")))
Expand All @@ -31,9 +30,3 @@ int sd_booted(void)
/* no, systemd is not PID 1 */
return 0;
}

__attribute__((destructor))
static void on_dlclose(void)
{
bus_close();
}
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions libsystemd-journal/Makefile
@@ -0,0 +1,22 @@
include ../Makefile.common

LDFLAGS += -Wl,-soname=libsystemd-journal.so.0 -Wl,--version-script=compat.sym

LIB = libsystemd-journal.so

all: $(LIB) libsystemd-journal.pc

%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)

$(LIB): $(OBJS) compat.sym
$(CC) -o $@ $(OBJS) -shared $(LDFLAGS) $(LIBS)

libsystemd-journal.pc: libsystemd-journal.pc.in
sed -e s~@PREFIX@~$(PREFIX)~g \
-e s~@LIB_DIR@~$(LIB_DIR)~g \
-e s~@INCLUDE_DIR@~$(INCLUDE_DIR)~g \
$^ > $@

clean:
rm -f libsystemd-journal.pc $(LIB) $(OBJS)
33 changes: 33 additions & 0 deletions libsystemd-journal/compat.sym
@@ -0,0 +1,33 @@
/*
* this file is part of LoginKit.
*
* Copyright (c) 2014 Dima Krasner
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

LIBSYSTEMD_JOURNAL_38 {
global:
sd_journal_printv;
sd_journal_print;
sd_journal_perror;
};

LIBSYSTEMD_JOURNAL_205 {
} LIBSYSTEMD_JOURNAL_38;
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions libsystemd-journal/libsystemd-journal.pc.in
@@ -0,0 +1,32 @@
# this file is part of LoginKit.
#
# Copyright (c) 2014 Dima Krasner
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

prefix=@PREFIX@
exec_prefix=@PREFIX@
libdir=@LIB_DIR@
includedir=@INCLUDE_DIR@

Name: LoginKit
Description: LoginKit library
Version: 1
Libs: -L${libdir} -lsystemd
Cflags: -I${includedir}
25 changes: 25 additions & 0 deletions libsystemd-login/Makefile
@@ -0,0 +1,25 @@
include ../Makefile.common

CFLAGS += -pthread
LDFLAGS += -pthread \
-Wl,-soname=libsystemd-login.so.0 \
-Wl,--version-script=compat.sym

LIB = libsystemd-login.so

all: $(LIB) libsystemd-login.pc

%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(GIO_CFLAGS)

$(LIB): $(OBJS) compat.sym
$(CC) -o $@ $(OBJS) -shared $(LDFLAGS) $(LIBS) $(GIO_LIBS)

libsystemd-login.pc: libsystemd-login.pc.in
sed -e s~@PREFIX@~$(PREFIX)~g \
-e s~@LIB_DIR@~$(LIB_DIR)~g \
-e s~@INCLUDE_DIR@~$(INCLUDE_DIR)~g \
$^ > $@

clean:
rm -f libsystemd-login.pc $(LIB) $(OBJS)
56 changes: 56 additions & 0 deletions libsystemd-login/compat.sym
@@ -0,0 +1,56 @@
/*
* this file is part of LoginKit.
*
* Copyright (c) 2014 Dima Krasner
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

LIBSYSTEMD_LOGIN_31 {
global:
sd_pid_get_session;
sd_pid_get_owner_uid;
sd_pid_get_user_unit;
sd_pid_get_slice;
sd_session_is_active;
sd_session_get_seat;
sd_session_get_uid;
sd_seat_can_multi_session;
sd_seat_get_sessions;
};

LIBSYSTEMD_LOGIN_38 {
global:
sd_pid_get_unit;
} LIBSYSTEMD_LOGIN_31;

LIBSYSTEMD_LOGIN_43 {
global:
sd_session_get_type;
} LIBSYSTEMD_LOGIN_38;

LIBSYSTEMD_LOGIN_186 {
global:
sd_session_get_state;
} LIBSYSTEMD_LOGIN_43;

LIBSYSTEMD_LOGIN_202 {
global:
sd_pid_get_machine_name;
} LIBSYSTEMD_LOGIN_186;

0 comments on commit e11e6cc

Please sign in to comment.