1# __ __ _ 2# ___\ \/ /_ __ __ _| |_ 3# / _ \\ /| '_ \ / _` | __| 4# | __// \| |_) | (_| | |_ 5# \___/_/\_\ .__/ \__,_|\__| 6# |_| XML parser 7# 8# Copyright (c) 2021-2024 Sebastian Pipping <sebastian@pipping.org> 9# Copyright (c) 2023 Joyce Brum <joycebrum@google.com> 10# Copyright (c) 2024 Dag-Erling Smørgrav <des@des.dev> 11# Licensed under the MIT license: 12# 13# Permission is hereby granted, free of charge, to any person obtaining 14# a copy of this software and associated documentation files (the 15# "Software"), to deal in the Software without restriction, including 16# without limitation the rights to use, copy, modify, merge, publish, 17# distribute, sublicense, and/or sell copies of the Software, and to permit 18# persons to whom the Software is furnished to do so, subject to the 19# following conditions: 20# 21# The above copyright notice and this permission notice shall be included 22# in all copies or substantial portions of the Software. 23# 24# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 27# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 28# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 29# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 30# USE OR OTHER DEALINGS IN THE SOFTWARE. 31 32name: Ensure that GNU Autotools and CMake build systems agree 33 34on: 35 pull_request: 36 push: 37 schedule: 38 - cron: '0 2 * * 5' # Every Friday at 2am 39 workflow_dispatch: 40 41permissions: 42 contents: read 43 44jobs: 45 checks: 46 name: Ensure that GNU Autotools and CMake build systems agree 47 strategy: 48 matrix: 49 include: 50 - os: macos-14 51 configure_args: 52 cmake_args: 53 - os: ubuntu-20.04 54 configure_args: 55 cmake_args: 56 - os: ubuntu-20.04 57 configure_args: --host=i686-w64-mingw32 58 cmake_args: -DCMAKE_TOOLCHAIN_FILE=cmake/mingw-toolchain.cmake 59 defaults: 60 run: 61 shell: bash 62 runs-on: "${{ matrix.os }}" 63 steps: 64 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 65 66 - name: (Linux) Install build dependencies 67 if: "${{ runner.os == 'Linux' }}" 68 run: |- 69 set -x 70 sudo apt-get update 71 sudo apt-get install --yes --no-install-recommends -V \ 72 cmake \ 73 docbook2x \ 74 lzip \ 75 mingw-w64 76 77 - name: (macOS) Install build dependencies 78 if: "${{ runner.os == 'macOS' }}" 79 run: | 80 brew install \ 81 autoconf \ 82 automake \ 83 cmake \ 84 docbook2x \ 85 libtool \ 86 lzip 87 88 - name: Produce and extract a release archive 89 run: | 90 set -x 91 cd expat 92 ./buildconf.sh 93 ./configure 94 make dist 95 tar xf expat-*.*.*.tar.gz 96 97 - name: Build and install using GNU Autotools 98 run: | 99 set -x 100 cd expat/expat-*.*.*/ 101 mkdir build_autotools 102 cd build_autotools 103 ../configure \ 104 --libdir='${exec_prefix}/lib123' \ 105 ${{matrix.configure_args}} 106 make install DESTDIR="${PWD}"/ROOT 107 find ROOT | sort | xargs ls -ld 108 109 - name: Build and install using CMake 110 run: | 111 set -x 112 cd expat/expat-*.*.*/ 113 mkdir build_cmake 114 cd build_cmake 115 cmake \ 116 -DCMAKE_INSTALL_LIBDIR=lib123 \ 117 ${{matrix.cmake_args}} \ 118 .. 119 make install DESTDIR="${PWD}"/ROOT 120 find ROOT | sort | xargs ls -ld 121 122 - name: Check for identical CMake files from both build systems 123 run: | 124 set -x 125 cd expat/expat-*.*.*/ 126 127 if [[ "${{ runner.os }}" == macOS ]]; then 128 # Autotools' LT_LIB_M has a hardcoded exclude for "*-*-darwin*" hosts, 129 # while macOS does have libm and is successfully found by CMake. 130 # We patch the CMake side in line here to get the differ below to empty. 131 # 132 # Both GNU and BSD sed can edit in-place without creating a backup, 133 # but not with the same syntax. The syntax for editing in-place 134 # _with_ a backup however is the same, so do that, then remove the 135 # backup so it doesn't show up in the diff later. 136 sed -e 's,-lm,,' -i.bak \ 137 build_cmake/ROOT/usr/local/lib*/pkgconfig/expat.pc 138 rm -f build_cmake/ROOT/usr/local/lib*/pkgconfig/expat.pc.bak 139 fi 140 141 diff \ 142 --recursive \ 143 --unified \ 144 --exclude=xmlwf \ 145 --exclude=xmlwf.exe \ 146 --exclude=libexpat.a \ 147 --exclude=libexpat-*.dll \ 148 --exclude=libexpat.dll.a \ 149 --exclude=libexpat.la \ 150 --exclude=libexpat.so\* \ 151 --exclude=libexpat.\*dylib \ 152 --exclude=expat_config.h \ 153 build_{autotools,cmake}/ROOT 154 155 - name: (Linux except MinGW) Check for identical exported symbols from both build systems 156 if: "${{ runner.os == 'Linux' && ! contains(matrix.configure_args, 'mingw') }}" 157 run: | 158 list_shared_library_symbols_sh="${GITHUB_WORKSPACE}"/.github/workflows/scripts/list-shared-library-symbols.sh 159 exported_symbols_txt="${GITHUB_WORKSPACE}"/.github/workflows/data/exported-symbols.txt 160 161 set -x 162 cd expat/expat-*.*.*/ 163 diff -u "${exported_symbols_txt}" <("${list_shared_library_symbols_sh}" build_autotools/ROOT/usr/local/lib*/libexpat.so) 164 diff -u "${exported_symbols_txt}" <("${list_shared_library_symbols_sh}" build_cmake/ROOT/usr/local/lib*/libexpat.so) 165