chiark / gitweb /
build-sys: merge libsystemd-login into libsystemd
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 19 Jan 2014 05:12:20 +0000 (00:12 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 25 Jan 2014 23:10:08 +0000 (18:10 -0500)
A compatibility libsystemd-login library is created which uses
.symver and ifunc magic proposed by Lennart to make programs linked
to the old library name continue to work seamlessly.

Unfortunately the bfd linker crashes:
  https://sourceware.org/bugzilla/show_bug.cgi?id=16467
This will be fixed in binutils 2.25.

As a work-around, gold can be used:
  LDFLAGS=-Wl,-fuse-ld=gold

Unfortunately the switch to pick the linker appeared in gcc 4.8.

This also doesn't work with LLVM:
  http://llvm.org/bugs/show_bug.cgi?id=11897

.gitignore
Makefile.am
src/libsystemd/libsystemd.sym
src/login/libsystemd-login.sym

index b706ab9..36b91b4 100644 (file)
@@ -33,6 +33,7 @@
 /hostnamectl
 /install-tree
 /journalctl
+/libsystemd-login.c
 /libtool
 /localectl
 /loginctl
index 6c4f834..53707d9 100644 (file)
@@ -44,7 +44,7 @@ LIBGUDEV_REVISION=3
 LIBGUDEV_AGE=1
 
 LIBSYSTEMD_LOGIN_CURRENT=9
-LIBSYSTEMD_LOGIN_REVISION=1
+LIBSYSTEMD_LOGIN_REVISION=2
 LIBSYSTEMD_LOGIN_AGE=9
 
 LIBSYSTEMD_DAEMON_CURRENT=0
@@ -1804,14 +1804,7 @@ systemctl_LDADD = \
        libsystemd-units.la \
        libsystemd-label.la \
        libsystemd-internal.la \
-       libsystemd-logs.la
-
-if ENABLE_LOGIND
-systemctl_LDADD += \
-       libsystemd-login-internal.la
-endif
-
-systemctl_LDADD += \
+       libsystemd-logs.la \
        libsystemd-journal-internal.la \
        libsystemd-id128-internal.la \
        libsystemd-daemon-internal.la \
@@ -1986,6 +1979,7 @@ libsystemd_la_SOURCES = \
        src/systemd/sd-event.h \
        src/systemd/sd-rtnl.h \
        src/systemd/sd-resolve.h \
+       src/systemd/sd-login.h \
        src/libsystemd/sd-bus/sd-bus.c \
        src/libsystemd/sd-bus/bus-control.c \
        src/libsystemd/sd-bus/bus-control.h \
@@ -2032,7 +2026,10 @@ libsystemd_la_SOURCES = \
        src/libsystemd/sd-rtnl/rtnl-util.h \
        src/libsystemd/sd-rtnl/rtnl-util.c \
        src/libsystemd/sd-resolve/sd-resolve.c \
-       src/libsystemd/sd-resolve/resolve-util.h
+       src/libsystemd/sd-resolve/resolve-util.h \
+       src/login/sd-login.c \
+       src/login/login-shared.c \
+       src/login/login-shared.h
 
 nodist_libsystemd_la_SOURCES = \
        src/libsystemd/sd-bus/bus-error-mapping.c
@@ -3272,11 +3269,6 @@ libsystemd_journal_core_la_LIBADD = \
        libsystemd-id128-internal.la \
        libsystemd-shared.la
 
-if ENABLE_LOGIND
-libsystemd_journal_core_la_LIBADD += \
-       libsystemd-login-internal.la
-endif
-
 if HAVE_ACL
 libsystemd_journal_core_la_LIBADD += \
        libsystemd-acl.la
@@ -3474,12 +3466,8 @@ systemd_coredump_SOURCES = \
 systemd_coredump_LDADD = \
        libsystemd-journal-internal.la \
        libsystemd-label.la \
-       libsystemd-shared.la
-
-if ENABLE_LOGIND
-systemd_coredump_LDADD += \
-       libsystemd-login-internal.la
-endif
+       libsystemd-shared.la \
+       libsystemd-internal.la
 
 rootlibexec_PROGRAMS += \
        systemd-coredump
@@ -4242,14 +4230,14 @@ test_login_SOURCES = \
        src/login/test-login.c
 
 test_login_LDADD = \
-       libsystemd-login-internal.la \
+       libsystemd-internal.la \
        libsystemd-shared.la
 
 test_login_shared_SOURCES = \
        src/login/test-login-shared.c
 
 test_login_shared_LDADD = \
-       libsystemd-login-internal.la \
+       libsystemd-internal.la \
        libsystemd-shared.la
 
 test_inhibit_SOURCES = \
@@ -4275,29 +4263,6 @@ tests += \
        test-login-tables \
        test-login-shared
 
-libsystemd_login_la_SOURCES = \
-       src/login/libsystemd-login.sym \
-       src/login/sd-login.c \
-       src/systemd/sd-login.h \
-       src/login/login-shared.c \
-       src/login/login-shared.h
-
-libsystemd_login_la_CFLAGS = \
-       $(AM_CFLAGS) \
-       -fvisibility=hidden
-
-libsystemd_login_la_LDFLAGS = \
-       $(AM_LDFLAGS) \
-       -version-info $(LIBSYSTEMD_LOGIN_CURRENT):$(LIBSYSTEMD_LOGIN_REVISION):$(LIBSYSTEMD_LOGIN_AGE) \
-       -Wl,--version-script=$(top_srcdir)/src/login/libsystemd-login.sym
-
-libsystemd_login_la_LIBADD = \
-       libsystemd-daemon-internal.la \
-       libsystemd-shared.la
-
-libsystemd_login_internal_la_SOURCES = \
-       $(libsystemd_login_la_SOURCES)
-
 if HAVE_PAM
 pam_systemd_la_SOURCES = \
        src/login/pam-module.c
@@ -4330,16 +4295,6 @@ dist_pamconf_DATA = \
        src/login/systemd-user
 endif
 
-# move lib from $(libdir) to $(rootlibdir) and update devel link, if needed
-libsystemd-login-install-hook:
-       libname=libsystemd-login.so && $(move-to-rootlibdir)
-
-libsystemd-login-uninstall-hook:
-       rm -f $(DESTDIR)$(rootlibdir)/libsystemd-login.so*
-
-INSTALL_EXEC_HOOKS += libsystemd-login-install-hook
-UNINSTALL_EXEC_HOOKS += libsystemd-login-uninstall-hook
-
 nodist_systemunit_DATA += \
        units/systemd-logind.service \
        units/systemd-user-sessions.service
@@ -4360,15 +4315,6 @@ dist_pkgsysconf_DATA += \
 pkginclude_HEADERS += \
        src/systemd/sd-login.h
 
-lib_LTLIBRARIES += \
-       libsystemd-login.la
-
-noinst_LTLIBRARIES += \
-       libsystemd-login-internal.la
-
-pkgconfiglib_DATA += \
-       src/login/libsystemd-login.pc
-
 polkitpolicy_files += \
        src/login/org.freedesktop.login1.policy
 
@@ -4536,7 +4482,7 @@ login_la_LDFLAGS = \
 login_la_LIBADD = \
        $(PYTHON_DEVEL_LIBS) \
        libsystemd-journal.la \
-       libsystemd-login.la \
+       libsystemd.la \
        libsystemd-daemon-internal.la \
        libsystemd-shared.la
 
@@ -4581,6 +4527,50 @@ clean-python:
        -rm -f _daemon.la id128.la _journal.la login.la _reader.la
 
 # ------------------------------------------------------------------------------
+define generate-fake-lib
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
+       $(AM_V_GEN)sed -r -n 's/^ +(sd_.*);/void new_\1(void);\n__asm__(".symver new_\1,\1@LIBSYSTEMD_209");\nstatic void (*resolve_\1(void)) (void) {\n\treturn new_\1;\n}\nvoid \1(void) __attribute__((ifunc("resolve_\1")));\n/p' <$< >$@
+endef
+
+libsystemd_login_la_SOURCES = \
+       libsystemd-login.c \
+       src/login/libsystemd-login.sym
+
+libsystemd_login_la_CFLAGS = \
+       $(AM_CFLAGS) \
+       -fvisibility=default
+
+libsystemd_login_la_LDFLAGS = \
+       $(AM_LDFLAGS) \
+       -version-info $(LIBSYSTEMD_LOGIN_CURRENT):$(LIBSYSTEMD_LOGIN_REVISION):$(LIBSYSTEMD_LOGIN_AGE) \
+       -Wl,--version-script=$(top_srcdir)/src/login/libsystemd-login.sym
+
+libsystemd_login_la_LIBADD = \
+       libsystemd.la
+
+BUILT_SOURCES += \
+       libsystemd-login.c
+
+libsystemd-login.c: src/login/libsystemd-login.sym
+       $(generate-fake-lib)
+
+lib_LTLIBRARIES += \
+       libsystemd-login.la
+
+pkgconfiglib_DATA += \
+       src/login/libsystemd-login.pc
+
+# move lib from $(libdir) to $(rootlibdir) and update devel link, if needed
+libsystemd-login-install-hook:
+       libname=libsystemd-login.so && $(move-to-rootlibdir)
+
+libsystemd-login-uninstall-hook:
+       rm -f $(DESTDIR)$(rootlibdir)/libsystemd-login.so*
+
+INSTALL_EXEC_HOOKS += libsystemd-login-install-hook
+UNINSTALL_EXEC_HOOKS += libsystemd-login-uninstall-hook
+
+# ------------------------------------------------------------------------------
 substitutions = \
        '|rootlibexecdir=$(rootlibexecdir)|' \
        '|rootbindir=$(rootbindir)|' \
@@ -4996,7 +4986,8 @@ endef
 test-libsystemd-sym.c: \
        src/libsystemd/libsystemd.sym \
        src/systemd/sd-bus.h \
-       src/systemd/sd-utf8.h
+       src/systemd/sd-utf8.h \
+       src/systemd/sd-login.h
        $(generate-sym-test)
 
 test-libsystemd-daemon-sym.c: \
index e2e917e..9b10604 100644 (file)
@@ -9,6 +9,67 @@
 
 LIBSYSTEMD_209 {
 global:
+
+        /* originally LIBSYSTEMD_LOGIN_31 */
+        sd_get_seats;
+        sd_get_sessions;
+        sd_get_uids;
+        sd_login_monitor_flush;
+        sd_login_monitor_get_fd;
+        sd_login_monitor_new;
+        sd_login_monitor_unref;
+        sd_pid_get_owner_uid;
+        sd_pid_get_session;
+        sd_seat_can_multi_session;
+        sd_seat_get_active;
+        sd_seat_get_sessions;
+        sd_session_get_seat;
+        sd_session_get_uid;
+        sd_session_is_active;
+        sd_uid_get_seats;
+        sd_uid_get_sessions;
+        sd_uid_get_state;
+        sd_uid_is_on_seat;
+
+        /* originally LIBSYSTEMD_LOGIN_38 */
+        sd_pid_get_unit;
+        sd_session_get_service;
+
+        /* originally LIBSYSTEMD_LOGIN_43 */
+        sd_session_get_type;
+        sd_session_get_class;
+        sd_session_get_display;
+
+        /* originally LIBSYSTEMD_LOGIN_186 */
+        sd_session_get_state;
+        sd_seat_can_tty;
+        sd_seat_can_graphical;
+
+        /* originally LIBSYSTEMD_LOGIN_198 */
+        sd_session_get_tty;
+
+        /* originally LIBSYSTEMD_LOGIN_201 */
+        sd_login_monitor_get_events;
+        sd_login_monitor_get_timeout;
+
+        /* originally LIBSYSTEMD_LOGIN_202 */
+        sd_pid_get_user_unit;
+        sd_pid_get_machine_name;
+
+        /* originally LIBSYSTEMD_LOGIN_203 */
+        sd_get_machine_names;
+
+        /* originally LIBSYSTEMD_LOGIN_205 */
+        sd_pid_get_slice;
+
+        /* originally LIBSYSTEMD_LOGIN_207 */
+        sd_session_get_vt;
+
+        /* new in LIBSYSTEMD_LOGIN_209 */
+        sd_session_is_remote;
+        sd_session_get_remote_user;
+        sd_session_get_remote_host;
+
         /* Same order as in sd-bus.h should be used */
 
         /* Connections */
index 1d33982..54aa91c 100644 (file)
@@ -85,10 +85,3 @@ LIBSYSTEMD_LOGIN_207 {
 global:
         sd_session_get_vt;
 } LIBSYSTEMD_LOGIN_205;
-
-LIBSYSTEMD_LOGIN_209 {
-global:
-        sd_session_is_remote;
-        sd_session_get_remote_user;
-        sd_session_get_remote_host;
-} LIBSYSTEMD_LOGIN_207;