Compat stuff is moved to src/compat-libs/.
Warnings are issued when programs with the deprecated library.
---
 Makefile.am                            | 21 ++++----
 configure.ac                           | 12 +++++
 src/compat-libs/.gitignore             |  1 +
 src/compat-libs/libsystemd-login.pc.in | 18 +++++++
 src/compat-libs/libsystemd-login.sym   | 87 ++++++++++++++++++++++++++++++++++
 src/compat-libs/linkwarning.h          | 34 +++++++++++++
 src/login/.gitignore                   |  1 -
 src/login/libsystemd-login.pc.in       | 18 -------
 src/login/libsystemd-login.sym         | 87 ----------------------------------
 9 files changed, 165 insertions(+), 114 deletions(-)
 create mode 100644 src/compat-libs/.gitignore
 create mode 100644 src/compat-libs/libsystemd-login.pc.in
 create mode 100644 src/compat-libs/libsystemd-login.sym
 create mode 100644 src/compat-libs/linkwarning.h
 delete mode 100644 src/login/libsystemd-login.pc.in
 delete mode 100644 src/login/libsystemd-login.sym

diff --git a/Makefile.am b/Makefile.am
index 9929e24..f6bdc6d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4357,7 +4357,7 @@ polkitpolicy_in_files += \
 
 EXTRA_DIST += \
        src/login/logind-gperf.gperf \
-       src/login/libsystemd-login.pc.in \
+       src/compat-libs/libsystemd-login.pc.in \
        src/login/71-seat.rules.in \
        src/login/73-seat-late.rules.in \
        units/systemd-logind.service.in \
@@ -4520,23 +4520,26 @@ clean-python:
        -rm -f _daemon.la id128.la _journal.la login.la _reader.la
 
 # 
------------------------------------------------------------------------------
+if ENABLE_COMPAT_LIBS
+
 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' <$< >$@
+       $(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")));\nobsolete_lib(\1,$(notdir $(basename 
$<)));\n/p' <$< >$@
 endef
 
 libsystemd_login_la_SOURCES = \
        libsystemd-login.c \
-       src/login/libsystemd-login.sym
+       src/compat-libs/libsystemd-login.sym
 
 libsystemd_login_la_CFLAGS = \
        $(AM_CFLAGS) \
-       -fvisibility=default
+       -fvisibility=default \
+       -imacros $(top_srcdir)/src/compat-libs/linkwarning.h
 
 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
+       -Wl,--version-script=$(top_srcdir)/src/compat-libs/libsystemd-login.sym
 
 libsystemd_login_la_LIBADD = \
        libsystemd.la
@@ -4544,14 +4547,14 @@ libsystemd_login_la_LIBADD = \
 BUILT_SOURCES += \
        libsystemd-login.c
 
-libsystemd-login.c: src/login/libsystemd-login.sym
+libsystemd-login.c: src/compat-libs/libsystemd-login.sym
        $(generate-fake-lib)
 
 lib_LTLIBRARIES += \
        libsystemd-login.la
 
 pkgconfiglib_DATA += \
-       src/login/libsystemd-login.pc
+       src/compat-libs/libsystemd-login.pc
 
 # move lib from $(libdir) to $(rootlibdir) and update devel link, if needed
 libsystemd-login-install-hook:
@@ -4563,6 +4566,8 @@ libsystemd-login-uninstall-hook:
 INSTALL_EXEC_HOOKS += libsystemd-login-install-hook
 UNINSTALL_EXEC_HOOKS += libsystemd-login-uninstall-hook
 
+endif
+
 # 
------------------------------------------------------------------------------
 substitutions = \
        '|rootlibexecdir=$(rootlibexecdir)|' \
@@ -4999,7 +5004,7 @@ test-libsystemd-journal-sym.c: \
        $(generate-sym-test)
 
 test-libsystemd-login-sym.c: \
-       src/login/libsystemd-login.sym \
+       src/compat-libs/libsystemd-login.sym \
        src/systemd/sd-login.h
        $(generate-sym-test)
 
diff --git a/configure.ac b/configure.ac
index 939ba6d..ac723a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,6 +258,17 @@ AS_IF([test "x$enable_dbus" != "xno"], [
 AM_CONDITIONAL(HAVE_DBUS, [test "$have_dbus" = "yes"])
 
 # 
------------------------------------------------------------------------------
+have_compat_libs=no
+AC_ARG_ENABLE([compat_libs], AS_HELP_STRING([--enable-compat-libs],[Enable 
creation of compatibility libraries]),
+                [case "${enableval}" in
+                        yes) have_compat_libs=yes ;;
+                        no) have_compat_libs=no ;;
+                        *) AC_MSG_ERROR(bad value ${enableval} for 
--enable-compat-libs) ;;
+                esac],
+                [have_compat_libs=no])
+AM_CONDITIONAL([ENABLE_COMPAT_LIBS], [test "$have_compat_libs" = "yes"])
+
+# 
------------------------------------------------------------------------------
 have_coverage=no
 AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable test 
coverage]))
 if test "x$enable_coverage" = "xyes" ; then
@@ -1116,6 +1127,7 @@ AC_MSG_RESULT([
         test coverage:           ${have_coverage}
         Split /usr:              ${enable_split_usr}
         SysV compatibility:      ${SYSTEM_SYSV_COMPAT}
+        compatibility libraries: ${have_compat_libs}
 
         prefix:                  ${prefix}
         rootprefix:              ${with_rootprefix}
diff --git a/src/compat-libs/.gitignore b/src/compat-libs/.gitignore
new file mode 100644
index 0000000..0b8d106
--- /dev/null
+++ b/src/compat-libs/.gitignore
@@ -0,0 +1 @@
+/libsystemd-login.pc
diff --git a/src/compat-libs/libsystemd-login.pc.in 
b/src/compat-libs/libsystemd-login.pc.in
new file mode 100644
index 0000000..677f6b6
--- /dev/null
+++ b/src/compat-libs/libsystemd-login.pc.in
@@ -0,0 +1,18 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: systemd
+Description: systemd Login Utility Library deprecated compatibility library
+URL: @PACKAGE_URL@
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lsystemd
+Cflags: -I${includedir}
diff --git a/src/compat-libs/libsystemd-login.sym 
b/src/compat-libs/libsystemd-login.sym
new file mode 100644
index 0000000..54aa91c
--- /dev/null
+++ b/src/compat-libs/libsystemd-login.sym
@@ -0,0 +1,87 @@
+/***
+  This file is part of systemd.
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+***/
+
+/* Original symbols from systemd v31 */
+
+LIBSYSTEMD_LOGIN_31 {
+global:
+        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;
+local:
+        *;
+};
+
+LIBSYSTEMD_LOGIN_38 {
+global:
+        sd_pid_get_unit;
+        sd_session_get_service;
+} LIBSYSTEMD_LOGIN_31;
+
+LIBSYSTEMD_LOGIN_43 {
+global:
+        sd_session_get_type;
+        sd_session_get_class;
+        sd_session_get_display;
+} LIBSYSTEMD_LOGIN_38;
+
+LIBSYSTEMD_LOGIN_186 {
+global:
+        sd_session_get_state;
+        sd_seat_can_tty;
+        sd_seat_can_graphical;
+} LIBSYSTEMD_LOGIN_43;
+
+LIBSYSTEMD_LOGIN_198 {
+global:
+        sd_session_get_tty;
+} LIBSYSTEMD_LOGIN_186;
+
+LIBSYSTEMD_LOGIN_201 {
+global:
+        sd_login_monitor_get_events;
+        sd_login_monitor_get_timeout;
+} LIBSYSTEMD_LOGIN_198;
+
+LIBSYSTEMD_LOGIN_202 {
+global:
+        sd_pid_get_user_unit;
+        sd_pid_get_machine_name;
+} LIBSYSTEMD_LOGIN_201;
+
+LIBSYSTEMD_LOGIN_203 {
+global:
+        sd_get_machine_names;
+} LIBSYSTEMD_LOGIN_202;
+
+LIBSYSTEMD_LOGIN_205 {
+global:
+        sd_pid_get_slice;
+} LIBSYSTEMD_LOGIN_203;
+
+LIBSYSTEMD_LOGIN_207 {
+global:
+        sd_session_get_vt;
+} LIBSYSTEMD_LOGIN_205;
diff --git a/src/compat-libs/linkwarning.h b/src/compat-libs/linkwarning.h
new file mode 100644
index 0000000..1a412e9
--- /dev/null
+++ b/src/compat-libs/linkwarning.h
@@ -0,0 +1,34 @@
+/***
+  This file is part of systemd, but is heavily based on
+  glibc's libc-symbols.h.
+
+  Copyright (C) 1995-1998,2000-2006,2008,2009 Free Software Foundation, Inc
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+
+#define __make_section_unallocated(section_string)      \
+  asm (".section " section_string "\n\t.previous");
+
+#define __sec_comment "\n#APP\n\t#"
+
+#define link_warning(symbol, msg) \
+  __make_section_unallocated (".gnu.warning." #symbol)  \
+  static const char __evoke_link_warning_##symbol[]     \
+    __attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \
+    = msg
+
+#define obsolete_lib(name,lib)                          \
+  link_warning(name, #name " was moved to libsystemd. Do not use " #lib ".")
diff --git a/src/login/.gitignore b/src/login/.gitignore
index d3840c7..5c0b2ac 100644
--- a/src/login/.gitignore
+++ b/src/login/.gitignore
@@ -1,4 +1,3 @@
-/libsystemd-login.pc
 /logind-gperf.c
 /org.freedesktop.login1.policy
 /71-seat.rules
diff --git a/src/login/libsystemd-login.pc.in b/src/login/libsystemd-login.pc.in
deleted file mode 100644
index 7b2a724..0000000
--- a/src/login/libsystemd-login.pc.in
+++ /dev/null
@@ -1,18 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: systemd
-Description: systemd Login Utility Library
-URL: @PACKAGE_URL@
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lsystemd-login
-Cflags: -I${includedir}
diff --git a/src/login/libsystemd-login.sym b/src/login/libsystemd-login.sym
deleted file mode 100644
index 54aa91c..0000000
--- a/src/login/libsystemd-login.sym
+++ /dev/null
@@ -1,87 +0,0 @@
-/***
-  This file is part of systemd.
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-***/
-
-/* Original symbols from systemd v31 */
-
-LIBSYSTEMD_LOGIN_31 {
-global:
-        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;
-local:
-        *;
-};
-
-LIBSYSTEMD_LOGIN_38 {
-global:
-        sd_pid_get_unit;
-        sd_session_get_service;
-} LIBSYSTEMD_LOGIN_31;
-
-LIBSYSTEMD_LOGIN_43 {
-global:
-        sd_session_get_type;
-        sd_session_get_class;
-        sd_session_get_display;
-} LIBSYSTEMD_LOGIN_38;
-
-LIBSYSTEMD_LOGIN_186 {
-global:
-        sd_session_get_state;
-        sd_seat_can_tty;
-        sd_seat_can_graphical;
-} LIBSYSTEMD_LOGIN_43;
-
-LIBSYSTEMD_LOGIN_198 {
-global:
-        sd_session_get_tty;
-} LIBSYSTEMD_LOGIN_186;
-
-LIBSYSTEMD_LOGIN_201 {
-global:
-        sd_login_monitor_get_events;
-        sd_login_monitor_get_timeout;
-} LIBSYSTEMD_LOGIN_198;
-
-LIBSYSTEMD_LOGIN_202 {
-global:
-        sd_pid_get_user_unit;
-        sd_pid_get_machine_name;
-} LIBSYSTEMD_LOGIN_201;
-
-LIBSYSTEMD_LOGIN_203 {
-global:
-        sd_get_machine_names;
-} LIBSYSTEMD_LOGIN_202;
-
-LIBSYSTEMD_LOGIN_205 {
-global:
-        sd_pid_get_slice;
-} LIBSYSTEMD_LOGIN_203;
-
-LIBSYSTEMD_LOGIN_207 {
-global:
-        sd_session_get_vt;
-} LIBSYSTEMD_LOGIN_205;
-- 
1.8.1.rc0.194.gaf2e3a9

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to