mirror of
https://github.com/libexpat/libexpat.git
synced 2025-04-14 16:20:45 +00:00
Merge pull request #486 from libexpat/issue-485-fix-autotools-cmake-files
Fix CMake files installed by GNU Autotools build system (fixes #485)
This commit is contained in:
commit
caaf43470d
9 changed files with 114 additions and 10 deletions
65
.github/workflows/autotools-cmake.yml
vendored
65
.github/workflows/autotools-cmake.yml
vendored
|
@ -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
|
||||
|
|
|
@ -29,6 +29,7 @@ PACKAGE_STRING
|
|||
PACKAGE_TARNAME
|
||||
PACKAGE_URL
|
||||
PACKAGE_VERSION
|
||||
SIZEOF_VOID_P
|
||||
size_t
|
||||
STDC_HEADERS
|
||||
VERSION
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 \
|
||||
\
|
||||
|
|
|
@ -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()
|
||||
|
|
19
expat/cmake/autotools/expat-noconfig__macos.cmake.in
Normal file
19
expat/cmake/autotools/expat-noconfig__macos.cmake.in
Normal file
|
@ -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)
|
19
expat/cmake/autotools/expat-noconfig__windows.cmake.in
Normal file
19
expat/cmake/autotools/expat-noconfig__windows.cmake.in
Normal file
|
@ -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)
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue