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