diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-01-19 08:50:02 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-01-25 18:10:08 -0500 |
commit | 53e856e16ac37fe30b8bb59153ff69aad0fa9c27 (patch) | |
tree | 0bbd3b2a038de5cc66249fdf892f38001d4f0586 | |
parent | 242465b5bfcc2ea1b1d704907e7dd5f1c15d4404 (diff) |
build-sys: create "compatibility libraries" section
Compat stuff is moved to src/compat-libs/.
Warnings are issued when programs are linked with the deprecated library.
-rw-r--r-- | Makefile.am | 25 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | src/compat-libs/.gitignore | 1 | ||||
-rw-r--r-- | src/compat-libs/libsystemd-login.pc.in (renamed from src/login/libsystemd-login.pc.in) | 4 | ||||
-rw-r--r-- | src/compat-libs/libsystemd-login.sym (renamed from src/login/libsystemd-login.sym) | 0 | ||||
-rw-r--r-- | src/compat-libs/linkwarning.h | 34 | ||||
-rw-r--r-- | src/login/.gitignore | 1 |
7 files changed, 66 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am index dcfad0353d..769d24a90a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4364,7 +4364,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 \ @@ -4527,24 +4527,27 @@ 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 \ + -imacros $(top_srcdir)/src/compat-libs/linkwarning.h \ -fno-lto 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 @@ -4552,14 +4555,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: @@ -4571,6 +4574,8 @@ libsystemd-login-uninstall-hook: INSTALL_EXEC_HOOKS += libsystemd-login-install-hook UNINSTALL_EXEC_HOOKS += libsystemd-login-uninstall-hook +endif + # ------------------------------------------------------------------------------ substitutions = \ '|rootlibexecdir=$(rootlibexecdir)|' \ @@ -5007,7 +5012,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) @@ -5059,9 +5064,13 @@ tests += \ test-libsystemd-daemon-sym \ test-libsystemd-id128-sym \ test-libsystemd-journal-sym \ - test-libsystemd-login-sym \ test-libudev-sym +if ENABLE_COMPAT_LIBS +tests += \ + test-libsystemd-login-sym +endif + cppcheck: cppcheck --enable=all -q $(top_srcdir) diff --git a/configure.ac b/configure.ac index 6c1ba7c23b..d92f1fe015 100644 --- a/configure.ac +++ b/configure.ac @@ -259,6 +259,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 @@ -1117,6 +1128,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 0000000000..0b8d1067d9 --- /dev/null +++ b/src/compat-libs/.gitignore @@ -0,0 +1 @@ +/libsystemd-login.pc diff --git a/src/login/libsystemd-login.pc.in b/src/compat-libs/libsystemd-login.pc.in index 7b2a7245fc..677f6b6681 100644 --- a/src/login/libsystemd-login.pc.in +++ b/src/compat-libs/libsystemd-login.pc.in @@ -11,8 +11,8 @@ libdir=@libdir@ includedir=@includedir@ Name: systemd -Description: systemd Login Utility Library +Description: systemd Login Utility Library deprecated compatibility library URL: @PACKAGE_URL@ Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lsystemd-login +Libs: -L${libdir} -lsystemd Cflags: -I${includedir} diff --git a/src/login/libsystemd-login.sym b/src/compat-libs/libsystemd-login.sym index 54aa91c609..54aa91c609 100644 --- a/src/login/libsystemd-login.sym +++ b/src/compat-libs/libsystemd-login.sym diff --git a/src/compat-libs/linkwarning.h b/src/compat-libs/linkwarning.h new file mode 100644 index 0000000000..b6a6ac2940 --- /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 d3840c7afc..5c0b2ac68c 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 |