summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2021-05-21 14:01:54 +0200
committerGitHub <noreply@github.com>2021-05-21 14:01:54 +0200
commitcaaf43470d360af7d76ee6a5f337c962831ce0f6 (patch)
tree53be6f7f7624557d53713dbf681007f0c985317c
parent0ee4a6a94e50fef516addcca066349b365614e5c (diff)
parent192af39be0458273f0a8ac407e4a848d52f484d6 (diff)
downloadlibexpat-git-caaf43470d360af7d76ee6a5f337c962831ce0f6.tar.gz
Merge pull request #486 from libexpat/issue-485-fix-autotools-cmake-files
Fix CMake files installed by GNU Autotools build system (fixes #485)
-rw-r--r--.github/workflows/autotools-cmake.yml65
-rw-r--r--.github/workflows/data/expat_config_h_in__expected.txt1
-rw-r--r--expat/Changes3
-rw-r--r--expat/Makefile.am3
-rw-r--r--expat/cmake/autotools/expat-config-version.cmake.in6
-rw-r--r--expat/cmake/autotools/expat-noconfig__linux.cmake.in (renamed from expat/cmake/autotools/expat-noconfig.cmake.in)0
-rw-r--r--expat/cmake/autotools/expat-noconfig__macos.cmake.in19
-rw-r--r--expat/cmake/autotools/expat-noconfig__windows.cmake.in19
-rw-r--r--expat/configure.ac8
9 files changed, 114 insertions, 10 deletions
diff --git a/.github/workflows/autotools-cmake.yml b/.github/workflows/autotools-cmake.yml
index 2dc1a5b8..12d5ad62 100644
--- a/.github/workflows/autotools-cmake.yml
+++ b/.github/workflows/autotools-cmake.yml
@@ -38,15 +38,43 @@ on:
jobs:
checks:
name: Ensure that GNU Autotools and CMake build systems agree
- runs-on: ubuntu-20.04
+ strategy:
+ matrix:
+ include:
+ - os: macos-10.15
+ configure_args:
+ cmake_args:
+ - os: ubuntu-20.04
+ configure_args:
+ cmake_args:
+ - os: ubuntu-20.04
+ configure_args: --host=i686-w64-mingw32
+ cmake_args: -DCMAKE_TOOLCHAIN_FILE=cmake/mingw-toolchain.cmake
+ defaults:
+ run:
+ shell: bash
+ runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@v2.3.4
- - name: Install build dependencies
+ - name: (Linux) Install build dependencies
+ if: "${{ runner.os == 'Linux' }}"
run: |-
sudo apt-get install --yes --no-install-recommends -V \
cmake \
docbook2x \
+ lzip \
+ mingw-w64
+
+ - name: (macOS) Install build dependencies
+ if: "${{ runner.os == 'macOS' }}"
+ run: |
+ brew install \
+ autoconf \
+ automake \
+ cmake \
+ docbook2x \
+ libtool \
lzip
- name: Produce and extract a release archive
@@ -64,8 +92,11 @@ jobs:
cd expat/expat-*.*.*/
mkdir build_autotools
cd build_autotools
- ../configure --libdir='${exec_prefix}/lib123'
+ ../configure \
+ --libdir='${exec_prefix}/lib123' \
+ ${{matrix.configure_args}}
make install DESTDIR="${PWD}"/ROOT
+ find ROOT | sort | xargs ls -ld
- name: Build and install using CMake
run: |
@@ -73,24 +104,46 @@ jobs:
cd expat/expat-*.*.*/
mkdir build_cmake
cd build_cmake
- cmake -DCMAKE_INSTALL_LIBDIR=lib123 ..
+ cmake \
+ -DCMAKE_INSTALL_LIBDIR=lib123 \
+ ${{matrix.cmake_args}} \
+ ..
make install DESTDIR="${PWD}"/ROOT
+ find ROOT | sort | xargs ls -ld
- name: Check for identical CMake files from both build systems
run: |
set -x
cd expat/expat-*.*.*/
+
+ if [[ "${{ matrix.configure_args }}" == *mingw* ]]; then
+ # There is one known difference between Autotools and CMake for MinGW:
+ # Autotools: usr/local/bin/libexpat-<major>.dll
+ # CMake: usr/local/bin/libexpat.dll
+ # We patch the Autotools side in line here to get the differ below to empty
+ mv build_autotools/ROOT/usr/local/bin/libexpat{-*,}.dll
+ ( cd build_autotools/ROOT/usr/local/lib*/cmake/expat-*/ \
+ && sed 's,libexpat-[0-9]\+\.dll,libexpat.dll,g' expat-noconfig.cmake > expat-noconfig-patched.cmake \
+ && ! diff -u0 expat-noconfig{,-patched}.cmake \
+ && mv expat-noconfig{-patched,}.cmake )
+ fi
+
diff \
--recursive \
--unified \
--exclude=xmlwf \
+ --exclude=xmlwf.exe \
--exclude=libexpat.a \
+ --exclude=libexpat.dll \
+ --exclude=libexpat.dll.a \
--exclude=libexpat.la \
- --exclude='*.so*' \
+ --exclude=libexpat.so\* \
+ --exclude=libexpat.\*dylib \
--exclude=expat_config.h \
build_{autotools,cmake}/ROOT
- - name: Check for identical exported symbols from both build systems
+ - name: (Linux except MinGW) Check for identical exported symbols from both build systems
+ if: "${{ runner.os == 'Linux' && ! contains(matrix.configure_args, 'mingw') }}"
run: |
list_shared_library_symbols_sh="${GITHUB_WORKSPACE}"/.github/workflows/scripts/list-shared-library-symbols.sh
exported_symbols_txt="${GITHUB_WORKSPACE}"/.github/workflows/data/exported-symbols.txt
diff --git a/.github/workflows/data/expat_config_h_in__expected.txt b/.github/workflows/data/expat_config_h_in__expected.txt
index 3c23e8fc..56f66137 100644
--- a/.github/workflows/data/expat_config_h_in__expected.txt
+++ b/.github/workflows/data/expat_config_h_in__expected.txt
@@ -29,6 +29,7 @@ PACKAGE_STRING
PACKAGE_TARNAME
PACKAGE_URL
PACKAGE_VERSION
+SIZEOF_VOID_P
size_t
STDC_HEADERS
VERSION
diff --git a/expat/Changes b/expat/Changes
index 60912e51..2870961f 100644
--- a/expat/Changes
+++ b/expat/Changes
@@ -19,6 +19,9 @@ Release X.X.X XXX XXXXX XX XXXX
#332 #470 For (non-default) compilation with -DEXPAT_MIN_SIZE=ON (CMake)
or CPPFLAGS=-DXML_MIN_SIZE (GNU Autotools): Fix segfault
for UTF-16 payloads containing CDATA sections.
+ #485 #486 Autotools: Fix generated CMake files for non-64bit and
+ non-Linux platforms (e.g. macOS and MinGW in particular)
+ that were introduced with release 2.3.0
New features:
#34 #466 #484 Add two new API functions to further tighten billion laughs
diff --git a/expat/Makefile.am b/expat/Makefile.am
index 49d157aa..6847d083 100644
--- a/expat/Makefile.am
+++ b/expat/Makefile.am
@@ -66,6 +66,9 @@ cmakedir = $(libdir)/cmake/expat-@PACKAGE_VERSION@
_EXTRA_DIST_CMAKE = \
+ cmake/autotools/expat-noconfig__linux.cmake.in \
+ cmake/autotools/expat-noconfig__macos.cmake.in \
+ cmake/autotools/expat-noconfig__windows.cmake.in \
cmake/autotools/expat-package-init.cmake \
cmake/mingw-toolchain.cmake \
\
diff --git a/expat/cmake/autotools/expat-config-version.cmake.in b/expat/cmake/autotools/expat-config-version.cmake.in
index 798d861d..5b296752 100644
--- a/expat/cmake/autotools/expat-config-version.cmake.in
+++ b/expat/cmake/autotools/expat-config-version.cmake.in
@@ -55,13 +55,13 @@ if("FALSE")
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
-if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@ac_cv_sizeof_void_p@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
-if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
- math(EXPR installedBits "8 * 8")
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@ac_cv_sizeof_void_p@")
+ math(EXPR installedBits "@ac_cv_sizeof_void_p@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
diff --git a/expat/cmake/autotools/expat-noconfig.cmake.in b/expat/cmake/autotools/expat-noconfig__linux.cmake.in
index 39595048..39595048 100644
--- a/expat/cmake/autotools/expat-noconfig.cmake.in
+++ b/expat/cmake/autotools/expat-noconfig__linux.cmake.in
diff --git a/expat/cmake/autotools/expat-noconfig__macos.cmake.in b/expat/cmake/autotools/expat-noconfig__macos.cmake.in
new file mode 100644
index 00000000..b6b1016c
--- /dev/null
+++ b/expat/cmake/autotools/expat-noconfig__macos.cmake.in
@@ -0,0 +1,19 @@
+#----------------------------------------------------------------
+# Generated CMake target import file.
+#----------------------------------------------------------------
+
+# Commands may need to know the format version.
+set(CMAKE_IMPORT_FILE_VERSION 1)
+
+# Import target "expat::expat" for configuration ""
+set_property(TARGET expat::expat APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
+set_target_properties(expat::expat PROPERTIES
+ IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/@LIBDIR_BASENAME@/libexpat.@SO_MAJOR@.@SO_MINOR@.@SO_PATCH@.dylib"
+ IMPORTED_SONAME_NOCONFIG "@rpath/libexpat.@SO_MAJOR@.dylib"
+ )
+
+list(APPEND _IMPORT_CHECK_TARGETS expat::expat )
+list(APPEND _IMPORT_CHECK_FILES_FOR_expat::expat "${_IMPORT_PREFIX}/@LIBDIR_BASENAME@/libexpat.@SO_MAJOR@.@SO_MINOR@.@SO_PATCH@.dylib" )
+
+# Commands beyond this point should not need to know the version.
+set(CMAKE_IMPORT_FILE_VERSION)
diff --git a/expat/cmake/autotools/expat-noconfig__windows.cmake.in b/expat/cmake/autotools/expat-noconfig__windows.cmake.in
new file mode 100644
index 00000000..66b2f5cb
--- /dev/null
+++ b/expat/cmake/autotools/expat-noconfig__windows.cmake.in
@@ -0,0 +1,19 @@
+#----------------------------------------------------------------
+# Generated CMake target import file.
+#----------------------------------------------------------------
+
+# Commands may need to know the format version.
+set(CMAKE_IMPORT_FILE_VERSION 1)
+
+# Import target "expat::expat" for configuration ""
+set_property(TARGET expat::expat APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
+set_target_properties(expat::expat PROPERTIES
+ IMPORTED_IMPLIB_NOCONFIG "${_IMPORT_PREFIX}/@LIBDIR_BASENAME@/libexpat.dll.a"
+ IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/bin/libexpat-@SO_MAJOR@.dll"
+ )
+
+list(APPEND _IMPORT_CHECK_TARGETS expat::expat )
+list(APPEND _IMPORT_CHECK_FILES_FOR_expat::expat "${_IMPORT_PREFIX}/@LIBDIR_BASENAME@/libexpat.dll.a" "${_IMPORT_PREFIX}/bin/libexpat-@SO_MAJOR@.dll" )
+
+# Commands beyond this point should not need to know the version.
+set(CMAKE_IMPORT_FILE_VERSION)
diff --git a/expat/configure.ac b/expat/configure.ac
index 7d60a2c2..84319d64 100644
--- a/expat/configure.ac
+++ b/expat/configure.ac
@@ -372,6 +372,7 @@ LIBDIR_BASENAME="$(basename "${libdir}")"
SO_MAJOR="$(expr "${LIBCURRENT}" - "${LIBAGE}")"
SO_MINOR="${LIBAGE}"
SO_PATCH="${LIBREVISION}"
+AC_CHECK_SIZEOF([void *]) # sets ac_cv_sizeof_void_p
AC_SUBST([EXPAT_ATTR_INFO])
AC_SUBST([EXPAT_DTD])
AC_SUBST([EXPAT_LARGE_SIZE])
@@ -384,6 +385,7 @@ AC_SUBST([LIBDIR_BASENAME])
AC_SUBST([SO_MAJOR])
AC_SUBST([SO_MINOR])
AC_SUBST([SO_PATCH])
+AC_SUBST([ac_cv_sizeof_void_p])
dnl write the Automake flags we set
@@ -395,11 +397,15 @@ AC_SUBST([AM_LDFLAGS])
dnl updating _EXPAT_OUTPUT_NAME variable to effect the package name in expat.pc file (issue #361)
AC_SUBST(_EXPAT_OUTPUT_NAME, ["$PACKAGE_NAME"])
+AS_CASE("${host_os}",
+ [darwin*], [CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__macos.cmake.in],
+ [mingw*], [CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__windows.cmake.in],
+ [CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__linux.cmake.in])
AC_CONFIG_FILES([Makefile]
[expat.pc]
[cmake/expat-config.cmake]
[cmake/autotools/expat-config-version.cmake]
- [cmake/autotools/expat-noconfig.cmake]
+ [cmake/autotools/expat-noconfig.cmake:${CMAKE_NOCONFIG_SOURCE}]
[doc/Makefile]
[examples/Makefile]
[lib/Makefile]