From c5f040325b59fccf5f895ab94a3027c1650628dc Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 29 Aug 2018 11:01:53 +0900 Subject: More changes for new gpg-error-config. * configure.ac: Change generating gpg-error-config. (GPG_ERROR_CONFIG_ISUBDIRAFTER): Remove. (GPG_ERROR_CONFIG_CFLAGS): Put -idirafter here. * src/Makefile.am (pkgconfig_DATA): Add. (EXTRA_DIST): Add gpg-error-config-head.in, pkgconf-funcs.sh, gpg-error-config-main.sh, gpg-error.pc.in. * src/gpg-error-config-head.in: New. * src/gpg-error-config-main.sh: Rename from src/gpg-error-config.in. * src/gpg-error.pc.in (isubdirafter): Remove. Signed-off-by: NIIBE Yutaka --- configure.ac | 20 +++++--- src/Makefile.am | 8 ++- src/gpg-error-config-head.in | 17 +++++++ src/gpg-error-config-main.sh | 100 ++++++++++++++++++++++++++++++++++++ src/gpg-error-config.in | 118 ------------------------------------------- src/gpg-error.pc.in | 1 - src/pkgconf-funcs.sh | 4 +- 7 files changed, 138 insertions(+), 130 deletions(-) create mode 100644 src/gpg-error-config-head.in create mode 100644 src/gpg-error-config-main.sh delete mode 100644 src/gpg-error-config.in diff --git a/configure.ac b/configure.ac index 1ea2135..5b460bf 100644 --- a/configure.ac +++ b/configure.ac @@ -483,13 +483,16 @@ if test "x$LIBMULTITHREAD" != x; then else GPG_ERROR_CONFIG_MT_LIBS="" fi -GPG_ERROR_CONFIG_CFLAGS="" +if test "$have_w32ce_system" = yes; then + GPG_ERROR_CONFIG_CFLAGS="-idirafter \${includedir}/gpg-extra" +else + GPG_ERROR_CONFIG_CFLAGS="" +fi if test "x$THREADLIB_CPPFLAGS" != x; then GPG_ERROR_CONFIG_MT_CFLAGS="${THREADLIB_CPPFLAGS}" else GPG_ERROR_CONFIG_MT_CFLAGS="" fi -GPG_ERROR_CONFIG_ISUBDIRAFTER="" GPG_ERROR_CONFIG_HOST="$host" case "$includedir" in '${prefix}/include'|/usr/include|/include) GPG_ERROR_CONFIG_INCLUDEDIR="" ;; @@ -500,17 +503,13 @@ case "$libdir" in *) GPG_ERROR_CONFIG_LIBDIR="-L$libdir" ;; esac -PKGCONF_FUNCS_SH_CONTENT=$(cat $srcdir/src/pkgconf-funcs.sh) - AC_SUBST(GPG_ERROR_CONFIG_LIBS) AC_SUBST(GPG_ERROR_CONFIG_CFLAGS) AC_SUBST(GPG_ERROR_CONFIG_MT_LIBS) AC_SUBST(GPG_ERROR_CONFIG_MT_CFLAGS) -AC_SUBST(GPG_ERROR_CONFIG_ISUBDIRAFTER) AC_SUBST(GPG_ERROR_CONFIG_HOST) AC_SUBST(GPG_ERROR_CONFIG_INCLUDEDIR) AC_SUBST(GPG_ERROR_CONFIG_LIBDIR) -AC_SUBST(PKGCONF_FUNCS_SH_CONTENT) # # Special defines for certain platforms @@ -523,7 +522,6 @@ if test "$have_w32_system" = yes; then fi if test "$have_w32ce_system" = yes; then AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE]) - GPG_ERROR_CONFIG_ISUBDIRAFTER="gpg-extra" fi force_use_syscfg=yes fi @@ -637,8 +635,14 @@ AC_CONFIG_FILES([doc/Makefile po/Makefile.in m4/Makefile]) AC_CONFIG_FILES([src/Makefile tests/Makefile]) AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd]) AC_CONFIG_FILES([src/versioninfo.rc src/gpg-error.w32-manifest]) -AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config]) AC_CONFIG_FILES([src/gpg-error.pc]) +AC_CONFIG_FILES([src/gpg-error-config-head]) +AC_CONFIG_COMMANDS([gen-gpg-error-config], [ +cat src/gpg-error-config-head \ + $srcdir/src/pkgconf-funcs.sh \ + $srcdir/src/gpg-error-config-main.sh > src/gpg-error-config +chmod +x src/gpg-error-config +]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index fcfbb83..98e3b94 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -88,11 +88,17 @@ nodist_bin_SCRIPTS = gpgrt-config m4datadir = $(datadir)/aclocal m4data_DATA = gpg-error.m4 gpgrt.m4 +pkgconfigdir = $(datadir)/pkgconfig +pkgconfig_DATA = gpg-error.pc + EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \ mkerrnos.awk errnos.in README \ mkerrcodes.awk mkerrcodes1.awk mkerrcodes2.awk mkerrcodes.c \ mkheader.c gpg-error.h.in mkw32errmap.c w32-add.h w32ce-add.h \ - err-sources.h err-codes.h gpg-error-config.in gpg-error.m4 gpgrt.m4 \ + err-sources.h err-codes.h \ + gpg-error-config-head.in pkgconf-funcs.sh gpg-error-config-main.sh \ + gpg-error.pc.in \ + gpg-error.m4 gpgrt.m4 \ gpg-error.vers gpg-error.def.in \ versioninfo.rc.in gpg-error.w32-manifest.in \ $(lock_obj_pub) diff --git a/src/gpg-error-config-head.in b/src/gpg-error-config-head.in new file mode 100644 index 0000000..1c50fa0 --- /dev/null +++ b/src/gpg-error-config-head.in @@ -0,0 +1,17 @@ +#!/bin/sh +# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# SPDX-License-Identifier: FSFULLR + +prefix=@prefix@ +datarootdir=@datarootdir@ +datadir=@datadir@ +PKG_CONFIG_PATH="${datadir}/pkgconfig" +# diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh new file mode 100644 index 0000000..e2ff26d --- /dev/null +++ b/src/gpg-error-config-main.sh @@ -0,0 +1,100 @@ + +if echo "$0" | grep gpg-error-config 2>/dev/null >/dev/null; then + myname="gpg-error-config" +else + myname="gpgrt-config" +fi + +if find_file_in_path ${myname%-config}.pc $PKG_CONFIG_PATH; then + CONFIG_FILE=$RESULT +else + echo "Can't find ${myname%-config}.pc" 1>&2 + exit 1 +fi + +output="" + +usage() +{ + cat <&2 +fi + +if [ "$1" != "--mt" ]; then + mt=no +else + mt=yes + shift +fi + +read_config_file < "$CONFIG_FILE" + +while test $# -gt 0; do + case "$1" in + -*=*) + optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` + ;; + *) + optarg= + ;; + esac + + case $1 in + --prefix) + output="$output $(get_var prefix)" + ;; + --exec-prefix) + output="$output $(get_var exec_prefix)" + ;; + --version) + echo "$(get_attr Version)" + exit 0 + ;; + --cflags) + output="$output $(get_attr Cflags)" + if test $mt = yes ; then + output="$output $(get_var mtcflags)" + fi + ;; + --libs) + output="$output $(get_attr Libs)" + if test $mt = yes ; then + output="$output $(get_var mtlibs)" + fi + ;; + --variable=*) + echo "$(get_var ${1#*=})" + exit 0 + ;; + --host) + echo "$(get_var host)" + exit 0 + ;; + *) + usage 1 1>&2 + ;; + esac + shift +done + +# +# Clean up +# +# eval unset $VAR_list VAR_list +# eval unset $ATTR_list ATTR_list +# + +echo $output diff --git a/src/gpg-error-config.in b/src/gpg-error-config.in deleted file mode 100644 index a0a0141..0000000 --- a/src/gpg-error-config.in +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh -# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This file is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# SPDX-License-Identifier: FSFULLR - -prefix=@prefix@ -datarootdir=@datarootdir@ -datadir=@datadir@ -PKG_CONFIG_PATH="${datadir}/pkgconfig" - -@PKGCONF_FUNCS_SH_CONTENT@ - -if echo "$0" | grep gpg-error-config 2>/dev/null >/dev/null; then - myname="gpg-error-config" -else - myname="gpgrt-config" -fi - -if find_file_in_path ${myname%-config}.pc $PKG_CONFIG_PATH; then - CONFIG_FILE=$RESULT -else - echo "Can't find ${myname%-config}.pc" 1>&2 - exit 1 -fi - -output="" - -usage() -{ - cat <&2 -fi - -if [ "$1" != "--mt" ]; then - mt=no -else - mt=yes - shift -fi - -read_config_file < "$CONFIG_FILE" - -while test $# -gt 0; do - case "$1" in - -*=*) - optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` - ;; - *) - optarg= - ;; - esac - - case $1 in - --prefix) - output="$output $(get_var prefix)" - ;; - --exec-prefix) - output="$output $(get_var exec_prefix)" - ;; - --version) - echo "$(get_attr Version)" - exit 0 - ;; - --cflags) - output="$output $(get_attr Cflags)" - if test $mt = yes ; then - output="$output $(get_var mtcflags)" - fi - ;; - --libs) - output="$output $(get_attr Libs)" - if test $mt = yes ; then - output="$output $(get_var mtlibs)" - fi - ;; - --variable=*) - echo "$(get_var ${1#*=})" - exit 0 - ;; - --host) - echo "$(get_var host)" - exit 0 - ;; - *) - usage 1 1>&2 - ;; - esac - shift -done - -# -# Clean up -# -# eval unset $VAR_list VAR_list -# eval unset $ATTR_list ATTR_list -# - -echo $output diff --git a/src/gpg-error.pc.in b/src/gpg-error.pc.in index fe8b553..3e8d328 100644 --- a/src/gpg-error.pc.in +++ b/src/gpg-error.pc.in @@ -2,7 +2,6 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ includedir=@includedir@ libdir=@libdir@ -isubdirafter=@GPG_ERROR_CONFIG_ISUBDIRAFTER@ host=@GPG_ERROR_CONFIG_HOST@ mtcflags=@GPG_ERROR_CONFIG_MT_CFLAGS@ mtlibs=@GPG_ERROR_CONFIG_MT_LIBS@ diff --git a/src/pkgconf-funcs.sh b/src/pkgconf-funcs.sh index 381243c..d06b68b 100644 --- a/src/pkgconf-funcs.sh +++ b/src/pkgconf-funcs.sh @@ -1,4 +1,4 @@ -#################### start of pkgconf-funcs +#### start of pkgconf-funcs # # Bourne shell functions for config file in pkg-config style, so that @@ -116,4 +116,4 @@ find_file_in_path () { RESULT="" return 1 } -#################### end of pkgconf-funcs +#### end of pkgconf-funcs -- cgit v1.2.3