[PATCH 4/4] WINGs: add version script to hide non-public API symbols from WUtil and WINGS
As it is a good practice to keep only the public API symbols in a library, because it reduce risk of name conflicts and the probability to mis-use an internal function which would be a problem for evolution; because there is a script that can generate that list of symbol, without the burden of creating a file prone to errors and annoying to maintain; this patch adds the necessary stuff to get the version-script generated automatically and makes it used by LD. Reset the version's AGE to 0 because interfaces have been removed (no user interface, but internal symbol are removed); did not increment CURRENT because it has already been done for the next release. Signed-off-by: Christophe CURIS christophe.cu...@free.fr --- .gitignore| 2 ++ WINGs/Makefile.am | 22 ++ configure.ac | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 384ef46..0d943a4 100644 --- a/.gitignore +++ b/.gitignore @@ -85,6 +85,8 @@ WINGs/WINGs.pc WINGs/WUtil.pc wrlib/libwraster.map +WINGs/libWUtil.map +WINGs/libWINGs.map WindowMaker/Defaults/WMRootMenu WindowMaker/Defaults/WMState diff --git a/WINGs/Makefile.am b/WINGs/Makefile.am index 017f1d7..a88d040 100644 --- a/WINGs/Makefile.am +++ b/WINGs/Makefile.am @@ -100,6 +100,28 @@ pkgconfig_DATA = WINGs.pc WUtil.pc DISTCLEANFILES = $(pkgconfig_DATA) get-wings-flags get-wutil-flags + +if HAVE_LD_VERSION_SCRIPT +# We make sure that only the symbols that are present in the public API are +# visible in the compiled library +libWUtil_la_LDFLAGS += -Wl,--version-script=libWUtil.map +libWINGs_la_LDFLAGS += -Wl,--version-script=libWINGs.map + +EXTRA_libWUtil_la_DEPENDENCIES = libWUtil.map +EXTRA_libWINGs_la_DEPENDENCIES = libWINGs.map + +CLEANFILES = libWUtil.map libWINGs.map + +libWUtil.map: $(srcdir)/WINGs/WUtil.h $(srcdir)/WINGs/WINGsP.h $(top_srcdir)/script/generate-mapfile-from-header.sh + $(AM_V_GEN)$(top_srcdir)/script/generate-mapfile-from-header.sh \ + -n WUtil -v $(WUTIL_VERSION) $(srcdir)/WINGs/WUtil.h $(srcdir)/WINGs/WINGsP.h libWUtil.map + +libWINGs.map: $(srcdir)/WINGs/WINGs.h $(srcdir)/WINGs/WINGsP.h $(top_srcdir)/script/generate-mapfile-from-header.sh + $(AM_V_GEN)$(top_srcdir)/script/generate-mapfile-from-header.sh \ + -n WINGs -v $(WINGS_VERSION) $(srcdir)/WINGs/WINGs.h $(srcdir)/WINGs/WINGsP.h libWINGs.map +endif + + WINGs.pc: Makefile @echo Generating $@ @echo 'Name: WINGs' $@ diff --git a/configure.ac b/configure.ac index 1cb4c4c..29f46d4 100644 --- a/configure.ac +++ b/configure.ac @@ -76,7 +76,7 @@ dnl dnl libWINGs WINGS_CURRENT=4 WINGS_REVISION=0 -WINGS_AGE=1 +WINGS_AGE=0 WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE AC_SUBST(WINGS_VERSION) dnl -- 2.1.4 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
[PATCH 3/4] WINGs: move declaration from WINGs.h into WUtil for consistency
For historical reason, some functions defined in WINGs.h are actually compiled into the WUtil.so library. Although it would be better to compile them in the appropriate library instead (and fix the code accordingly to make it work), this would break the binary compatibility. This patch moves the declaration from WINGs.h to the WUtil.h header to be consistent with what is really done; This will not break backward compatibility because WINGs.h starts by including the WUtil.h header, so on source side it is equivalent. Versions for WUtil and WINGs are, of course, not changed then as the whole purpose of this patch is to keep both source and binary compatibility. Signed-off-by: Christophe CURIS christophe.cu...@free.fr --- WINGs/WINGs/WINGs.h | 17 + WINGs/WINGs/WUtil.h | 23 +++ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h index 4798174..7760431 100644 --- a/WINGs/WINGs/WINGs.h +++ b/WINGs/WINGs/WINGs.h @@ -26,7 +26,7 @@ #include WINGs/WUtil.h #include X11/Xlib.h -#define WINGS_H_VERSION 20141205 +#define WINGS_H_VERSION 20141220 #ifdef __cplusplus @@ -639,21 +639,6 @@ WMRect wmkrect(int x, int y, unsigned int width, unsigned int height); #define wmkpoint(x, y) (WMPoint){(x), (y)} #endif -/* ---[ WINGs/wapplication.c ] */ - - -void WMInitializeApplication(const char *applicationName, int *argc, char **argv); - -/* You're supposed to call this funtion before exiting so WINGs can terminate properly */ -void WMReleaseApplication(void); - -void WMSetResourcePath(const char *path); - -/* don't free the returned string */ -char* WMGetApplicationName(void); - -/* Try to locate resource file. ext may be NULL */ -char* WMPathForResourceOfType(const char *resource, const char *ext); /* ---[ WINGs/widgets.c ]- */ diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h index 04e1197..e312c92 100644 --- a/WINGs/WINGs/WUtil.h +++ b/WINGs/WINGs/WUtil.h @@ -298,6 +298,29 @@ void wutil_shutdown(void); void wusleep(unsigned int usec); + +/* ---[ WINGs/wapplication.c ] */ + +/* + * Conceptually, these functions should be part of WINGs, not WUtil, but for + * historical reason they have been compiled into WUtil, so to avoid beaking + * binary compatibility we keep them here + */ + +void WMInitializeApplication(const char *applicationName, int *argc, char **argv); + +/* You're supposed to call this funtion before exiting so WINGs can terminate properly */ +void WMReleaseApplication(void); + +void WMSetResourcePath(const char *path); + +/* don't free the returned string */ +char* WMGetApplicationName(void); + +/* Try to locate resource file. ext may be NULL */ +char* WMPathForResourceOfType(const char *resource, const char *ext); + + /* ---[ WINGs/handlers.c ] */ /* Event handlers: timer, idle, input */ -- 2.1.4 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
[PATCH 2/4] wrlib: generate automatically the list of symbols to keep from the API header
Instead of having to maintain manually the map file for LD with the list of symbols that we want to keep in the WRaster library (the purpose is to hide internal symbols), this patch implements a script that parses the public API header and extracts automatically the list of names that are supposed to be visible to the user. The goal is to reduce possible human errors, like for example the function RCombineAlpha that was forgotten from the list, yet still keep the map file feature which is considered a good practice (it reduces the risk for name clash and the risk of mis-use of internal stuff from the library). Signed-off-by: Christophe CURIS christophe.cu...@free.fr --- .gitignore | 2 + script/generate-mapfile-from-header.sh | 241 + wrlib/Makefile.am | 11 +- wrlib/libwraster.map | 101 -- 4 files changed, 252 insertions(+), 103 deletions(-) create mode 100755 script/generate-mapfile-from-header.sh delete mode 100644 wrlib/libwraster.map diff --git a/.gitignore b/.gitignore index bda811c..384ef46 100644 --- a/.gitignore +++ b/.gitignore @@ -84,6 +84,8 @@ wrlib/wrlib.pc WINGs/WINGs.pc WINGs/WUtil.pc +wrlib/libwraster.map + WindowMaker/Defaults/WMRootMenu WindowMaker/Defaults/WMState WindowMaker/Defaults/WMWindowAttributes diff --git a/script/generate-mapfile-from-header.sh b/script/generate-mapfile-from-header.sh new file mode 100755 index 000..ef5767b --- /dev/null +++ b/script/generate-mapfile-from-header.sh @@ -0,0 +1,241 @@ +#!/bin/sh +### +# +# Window Maker window manager +# +# Copyright (c) 2014 Christophe CURIS +# Copyright (c) 2014 Window Maker Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +### +# +# generate-mapfile-from-header.sh: +# from a list of C header files, extract the name of the functions and +# global variables that are considered public for a library, and generate +# a 'version script' for ld with that list, so that all other symbols +# will be considered local. +# +# The goal is that the symbol that are not part of the public API should +# not be visible to the user because it can be a source of problems (from +# name clash to evolutivity issues). +# +### +# +# Please note that this script is writen in sh+awk on purpose: this script +# is gonna be run on the machine of the person who is trying to compile +# WindowMaker, and as such we cannot be sure to find any scripting language +# in a known version and that works (python/ruby/tcl/perl/php/you-name-it). +# +# So for portability, we stick to the same sh+awk constraint as Autotools +# to limit the problem, see for example: +# http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Portable-Shell.html +# +### + +# Report an error on stderr and exit with status 1 to tell make could not work +arg_error() { +echo $0: $@ 2 +exit 1 +} + +# print help and exit with success status +print_help() { +echo $0: generate a script for ld to keep only the symbols from C header +echo Usage: $0 [options...] input_file[s] +echo valid options are: +echo -l : add symbol's definition line number for debug +echo -n name: name to use for the library +echo -v version : set the library version for ld +exit 0 +} + +# Extract command line arguments +while [ $# -gt 0 ]; do +case $1 in +-l) +debug_info=' /* symbol_type at FILENAME : NR */' + ;; + +-n) +shift +echo $1 | grep '^[A-Za-z][A-Za-z_0-9]*$' /dev/null || arg_error invalid name \$1\ for a library +libname=$1 + ;; + +-v) +shift +# Version may be 'x:y:z', we keep only 'x' +version=`echo $1 | sed -e 's,:.*$,,' ` +# the version should only be a number +echo $version | grep '^[1-9][0-9]*$' /dev/null || \ +arg_error version \$1\ is not valid +
[PATCH 1/4] updated autoconf macro gl_LD_VERSION_SCRIPT from gnulib to version 4
This new version now checks that version script with syntax error are rejected, it probably led to mis-detect the option as supported when it was actually just ignored with at most a warning; it also now implement caching of the result to speed-up re-run of configure if user enabled it. Signed-off-by: Christophe CURIS christophe.cu...@free.fr --- m4/ld-version-script.m4 | 38 +- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/m4/ld-version-script.m4 b/m4/ld-version-script.m4 index 8fd8c89..211d67b 100644 --- a/m4/ld-version-script.m4 +++ b/m4/ld-version-script.m4 @@ -1,5 +1,5 @@ -# ld-version-script.m4 serial 2 -dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +# ld-version-script.m4 serial 4 +dnl Copyright (C) 2008-2015 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -18,14 +18,18 @@ dnl From Simon Josefsson AC_DEFUN([gl_LD_VERSION_SCRIPT], [ AC_ARG_ENABLE([ld-version-script], -AS_HELP_STRING([--enable-ld-version-script], - [enable linker version script (default is enabled when possible)]), - [have_ld_version_script=$enableval], []) - if test -z $have_ld_version_script; then -AC_MSG_CHECKING([if LD -Wl,--version-script works]) -save_LDFLAGS=$LDFLAGS -LDFLAGS=$LDFLAGS -Wl,--version-script=conftest.map -cat conftest.map EOF +[AS_HELP_STRING([--enable-ld-version-script], + [enable linker version script (default is enabled when possible)])], +[have_ld_version_script=$enableval], +[AC_CACHE_CHECK([if LD -Wl,--version-script works], + [gl_cv_sys_ld_version_script], + [gl_cv_sys_ld_version_script=no +save_LDFLAGS=$LDFLAGS +LDFLAGS=$LDFLAGS -Wl,--version-script=conftest.map +echo foo conftest.map +AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [], + [cat conftest.map EOF VERS_1 { global: sym; }; @@ -34,11 +38,11 @@ VERS_2 { global: sym; } VERS_1; EOF -AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [have_ld_version_script=yes], [have_ld_version_script=no]) -rm -f conftest.map -LDFLAGS=$save_LDFLAGS -AC_MSG_RESULT($have_ld_version_script) - fi - AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test $have_ld_version_script = yes) + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [gl_cv_sys_ld_version_script=yes])]) +rm -f conftest.map +LDFLAGS=$save_LDFLAGS]) + have_ld_version_script=$gl_cv_sys_ld_version_script]) + AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT], +[test $have_ld_version_script = yes]) ]) -- 2.1.4 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
Re: [PATCH 3/4] WINGs: move declaration from WINGs.h into WUtil for consistency
On Mon, 5 Jan 2015 at 11:06:32 +0100, Christophe CURIS wrote: For historical reason, some functions defined in WINGs.h are actually compiled into the WUtil.so library. Although it would be better to compile them in the appropriate library instead (and fix the code accordingly to make it work), this would break the binary compatibility. I think you could try the better approach you mentioned above since I suppose not too many programs use the library anyway. Do you know any? -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
Re: [PATCH 3/4] WINGs: move declaration from WINGs.h into WUtil for consistency
- Carlos R. Mafra crma...@gmail.com a écrit : On Mon, 5 Jan 2015 at 11:06:32 +0100, Christophe CURIS wrote: For historical reason, some functions defined in WINGs.h are actually compiled into the WUtil.so library. Although it would be better to compile them in the appropriate library instead (and fix the code accordingly to make it work), this would break the binary compatibility. I think you could try the better approach you mentioned above since I suppose not too many programs use the library anyway. Do you know any? WPrefs? Ok, that was an easy one ;-) I don't think there are a lot of app left, but on the other hand the change would impact apps that use only WUtil, not WINGs, and that's probably even less... Will see what I can do (I already started to look at it, but stopped considereing the compatibility break). Patch 1 and 2 are still valid, though... -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
RE: [PATCH 3/4] WINGs: move declaration from WINGs.h into WUtil for consistency
From: Carlos R. Mafra [crma...@gmail.com] Sent: Monday, January 05, 2015 9:39 AM To: wmaker-dev@lists.windowmaker.org Subject: Re: [PATCH 3/4] WINGs: move declaration from WINGs.h into WUtil for consistency I suppose not too many programs use the library anyway. Do you know any? WPrefs? Ok, that was an easy one ;-) I don't think there are a lot of app left, but on the other hand the change would impact apps that use only WUtil, not WINGs, and that's probably even less... There's wdm, I've just realized. On Debian-based systems, a reverse dependency lookup on the library packages reveals two more: wmforecast (which I maintain and can easily update) and fookb-wmaker (which depends on WUtil but not WINGs). Doug -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
[PATCH] Add generate-mapfile-from-header.sh to distribution tarball.
--- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index ddbb0c9..d3d4221 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,7 +38,8 @@ EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N INSTALL \ The-perfect-Window-Maker-patch.txt \ README COPYING.WTFPL autogen.sh \ email-clients.txt checkpatch.pl update-changelog.pl \ - script/nested-func-to-macro.sh + script/nested-func-to-macro.sh \ + script/generate-mapfile-from-header.sh if USE_LCOV coverage-reset: -- 2.1.0 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
[repo.or.cz] wmaker-crm.git branch next updated: wmaker-0.95.6-195-g97fc9f96
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project wmaker-crm.git. The branch, next has been updated via 97fc9f963b27586fdbe20c014ca1ffa6556792b5 (commit) from d458304610637ab394f5727fc256d8da4972e58e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - http://repo.or.cz/w/wmaker-crm.git/commit/97fc9f963b27586fdbe20c014ca1ffa6556792b5 commit 97fc9f963b27586fdbe20c014ca1ffa6556792b5 Author: Doug Torrance dtorra...@monmouthcollege.edu Date: Mon Jan 5 11:06:35 2015 -0600 Add generate-mapfile-from-header.sh to distribution tarball. diff --git a/Makefile.am b/Makefile.am index ddbb0c90..d3d4221e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,7 +38,8 @@ EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N INSTALL The-perfect-Window-Maker-patch.txt README COPYING.WTFPL autogen.sh email-clients.txt checkpatch.pl update-changelog.pl - script/nested-func-to-macro.sh + script/nested-func-to-macro.sh + script/generate-mapfile-from-header.sh if USE_LCOV coverage-reset: --- Summary of changes: Makefile.am |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) repo.or.cz automatic notification. Contact project admin crma...@gmail.com if you want to unsubscribe, or site admin ad...@repo.or.cz if you receive no reply. -- wmaker-crm.git (The Window Maker window manager) -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
Re: [PATCH 3/4] WINGs: move declaration from WINGs.h into WUtil for consistency
On Mon, 5 Jan 2015 at 16:10:50 +0100, Christophe wrote: - Carlos R. Mafra crma...@gmail.com a écrit : On Mon, 5 Jan 2015 at 11:06:32 +0100, Christophe CURIS wrote: For historical reason, some functions defined in WINGs.h are actually compiled into the WUtil.so library. Although it would be better to compile them in the appropriate library instead (and fix the code accordingly to make it work), this would break the binary compatibility. I think you could try the better approach you mentioned above since I suppose not too many programs use the library anyway. Do you know any? WPrefs? Ok, that was an easy one ;-) I don't think there are a lot of app left, but on the other hand the change would impact apps that use only WUtil, not WINGs, and that's probably even less... There's wdm, I've just realized. wdm stopped working for me in my openSUSE a long time ago (probably because of systemd but I'm not sure). I'd like to ask if anyone is using it currently in a modern distro, but I think that unless wdm development comes back and we could somehow synchronize changes to both wmaker and wdm, we cannot really break binary compatibility right now. I'd really like to use wdm myself, so if there are people out there using it I'd like to know. Will see what I can do (I already started to look at it, but stopped considereing the compatibility break). Patch 1 and 2 are still valid, though... Already applied, will wait a bit till the dust settles to apply the rest. -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
Re: [PATCH 3/4] WINGs: move declaration from WINGs.h into WUtil for consistency
Carlos R. Mafra schreef: There's wdm, I've just realized. wdm stopped working for me in my openSUSE a long time ago (probably because of systemd but I'm not sure). I'd like to ask if anyone is using it currently in a modern distro, but I think that unless wdm development comes back and we could somehow synchronize changes to both wmaker and wdm, we cannot really break binary compatibility right now. I'd really like to use wdm myself, so if there are people out there using it I'd like to know. I'm using it on 2 PC's at home. It's still available, and works fine in Gentoo Linux, although the package seems unmaintaned upstream (http://voins.program.ru/wdm/ is offline for some years maybe). I'm using OpenRC. These are the libs it depends on: # readelf -d /usr/bin/wdm Dynamic section at offset 0x15db8 contains 35 entries: TagType Name/Value 0x0001 (NEEDED) Shared library: [libcrypt.so.1] 0x0001 (NEEDED) Shared library: [libX11.so.6] 0x0001 (NEEDED) Shared library: [libWUtil.so.5] 0x0001 (NEEDED) Shared library: [libpam.so.0] 0x0001 (NEEDED) Shared library: [libXmu.so.6] 0x0001 (NEEDED) Shared library: [libXau.so.6] 0x0001 (NEEDED) Shared library: [libXdmcp.so.6] 0x0001 (NEEDED) Shared library: [libc.so.6] (...) # readelf -d /usr/bin/wdmLogin Dynamic section at offset 0x7dd8 contains 33 entries: TagType Name/Value 0x0001 (NEEDED) Shared library: [libX11.so.6] 0x0001 (NEEDED) Shared library: [libXinerama.so.1] 0x0001 (NEEDED) Shared library: [libWINGs.so.3] 0x0001 (NEEDED) Shared library: [libWUtil.so.5] 0x0001 (NEEDED) Shared library: [libwraster.so.5] 0x0001 (NEEDED) Shared library: [libc.so.6] (...) -- [alwin] -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.