From b5958052939bd47455197c937bdd38a48f467c4f Mon Sep 17 00:00:00 2001 From: Tom Schoonjans Date: Fri, 2 Aug 2024 21:10:55 +0100 Subject: [PATCH 1/5] Build Windows installer with meson --- .github/workflows/ci.yml | 656 +++++++++++++++++++-------------------- cplusplus/meson.build | 4 +- doc/meson.build | 8 + example/meson.build | 6 + meson.build | 12 + meson_options.txt | 1 + pascal/meson.build | 6 + src/meson.build | 11 +- windows/meson.build | 66 ++++ windows/xraylib.iss | 4 +- 10 files changed, 438 insertions(+), 336 deletions(-) create mode 100644 doc/meson.build create mode 100644 example/meson.build create mode 100644 pascal/meson.build create mode 100644 windows/meson.build diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c2e6311..cb3bb2a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,36 +11,36 @@ on: - master jobs: - visual-studio: - timeout-minutes: 60 - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] - compiler: - - cl - - clang-cl - name: Visual Studio with ${{matrix.compiler}} and Python ${{ matrix.python-version }} - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install meson, ninja, numpy and cython - run: | - python -m pip install -U numpy pip - python -m pip install meson ninja cython - - uses: ilammy/msvc-dev-cmd@v1 - - name: Build with meson - run: | - meson setup meson-build --buildtype=release -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled - meson compile -C meson-build - meson test -C meson-build || (cat meson-build\meson-logs\testlog.txt) - # ninja -v -C meson-build dist - env: - CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} + # visual-studio: + # timeout-minutes: 60 + # runs-on: windows-latest + # strategy: + # fail-fast: false + # matrix: + # python-version: ['3.9', '3.10', '3.11', '3.12'] + # compiler: + # - cl + # - clang-cl + # name: Visual Studio with ${{matrix.compiler}} and Python ${{ matrix.python-version }} + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python-version }} + # - name: Install meson, ninja, numpy and cython + # run: | + # python -m pip install -U numpy pip + # python -m pip install meson ninja cython + # - uses: ilammy/msvc-dev-cmd@v1 + # - name: Build with meson + # run: | + # meson setup meson-build --buildtype=release -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled + # meson compile -C meson-build + # meson test -C meson-build || (cat meson-build\meson-logs\testlog.txt) + # # ninja -v -C meson-build dist + # env: + # CC: ${{ matrix.compiler }} + # CXX: ${{ matrix.compiler }} msys2: timeout-minutes: 60 @@ -63,9 +63,9 @@ jobs: run: shell: msys2 {0} steps: - # - uses: crazy-max/ghaction-chocolatey@v2.0.0 - # with: - # args: install innosetup lazarus + - uses: crazy-max/ghaction-chocolatey@v3 + with: + args: install innosetup # required for the lib command - uses: ilammy/msvc-dev-cmd@v1.12.0 with: @@ -89,20 +89,16 @@ jobs: mingw-w64-x86_64-python3-numpy mingw-w64-x86_64-meson mingw-w64-x86_64-swig - automake - autoconf - libtool - make - patch - wget - tar - uses: actions/checkout@v4 - name: Primary build and test with Meson if: matrix.buildsystem == 'meson' run: | set -ex - meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled + meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled -Dwindows-installer=enabled meson compile -C meson-build + ls -l meson-build/src + ls -l meson-build/windows || true + find . -name '*.lib' meson test -C meson-build || (cat meson-build/meson-logs/testlog.txt && exit 1) set +ex @@ -142,307 +138,307 @@ jobs: CC: ${{matrix.cc}} CXX: ${{matrix.cxx}} - name: Upload Windows installer - if: matrix.buildsystem == 'autotools' && matrix.cc == 'gcc' + if: matrix.buildsystem == 'meson' && matrix.cc == 'gcc' uses: actions/upload-artifact@v4 with: name: windows-installer - path: windows\xraylib-*-win64.exe + path: meson-build\windows\xraylib-*-win64.exe retention-days: 1 - macos: - timeout-minutes: 60 - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - buildsystem: - # - autotools - - meson - compiler: - - llvm - - gcc@13 - include: - - ldflags: "-Wl,-ld_classic" - - compiler: llvm - cc: /opt/homebrew/opt/llvm/bin/clang - cxx: /opt/homebrew/opt/llvm/bin/clang++ - # ldflags: -L/opt/homebrew/opt/llvm/lib - enable_ruby: enable - - compiler: gcc@13 - cc: gcc-13 - cxx: g++-13 - # -fdeclspec is only supported by llvm's clang! - enable_ruby: disable - steps: - - uses: actions/checkout@v4 - - name: Install Homebrew dependencies - run: | - set -ex - rm -f /opt/homebrew/bin/2to3 - brew uninstall -f bazel bazelisk mongodb-community - brew update - brew upgrade - brew install git autoconf automake libtool pkg-config ${{ matrix.compiler }} swig ruby fpc lua bash numpy meson ninja cython - brew link --overwrite python - brew unlink python && brew link --overwrite python - ls -l /opt/homebrew/bin/python3 - echo "/opt/homebrew/opt/cython/bin" >> "${GITHUB_PATH}" - set +ex - env: - HOMEBREW_CURL_RETRIES: 5 - - name: Primary Build and test with Meson - if: matrix.buildsystem == 'meson' - run: | - set -ex - meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled - meson compile -C meson-build - meson test -C meson-build - meson dist -C meson-build + # macos: + # timeout-minutes: 60 + # runs-on: macos-latest + # strategy: + # fail-fast: false + # matrix: + # buildsystem: + # # - autotools + # - meson + # compiler: + # - llvm + # - gcc@13 + # include: + # - ldflags: "-Wl,-ld_classic" + # - compiler: llvm + # cc: /opt/homebrew/opt/llvm/bin/clang + # cxx: /opt/homebrew/opt/llvm/bin/clang++ + # # ldflags: -L/opt/homebrew/opt/llvm/lib + # enable_ruby: enable + # - compiler: gcc@13 + # cc: gcc-13 + # cxx: g++-13 + # # -fdeclspec is only supported by llvm's clang! + # enable_ruby: disable + # steps: + # - uses: actions/checkout@v4 + # - name: Install Homebrew dependencies + # run: | + # set -ex + # rm -f /opt/homebrew/bin/2to3 + # brew uninstall -f bazel bazelisk mongodb-community + # brew update + # brew upgrade + # brew install git autoconf automake libtool pkg-config ${{ matrix.compiler }} swig ruby fpc lua bash numpy meson ninja cython + # brew link --overwrite python + # brew unlink python && brew link --overwrite python + # ls -l /opt/homebrew/bin/python3 + # echo "/opt/homebrew/opt/cython/bin" >> "${GITHUB_PATH}" + # set +ex + # env: + # HOMEBREW_CURL_RETRIES: 5 + # - name: Primary Build and test with Meson + # if: matrix.buildsystem == 'meson' + # run: | + # set -ex + # meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled + # meson compile -C meson-build + # meson test -C meson-build + # meson dist -C meson-build - set +ex - env: - CC: ${{matrix.cc}} - CXX: ${{matrix.cxx}} - LDFLAGS: ${{matrix.ldflags}} - - name: Secondary build with Autotools - if: matrix.buildsystem == 'meson' - run: | - set -ex - export SHELL="$(which bash)" - cd meson-build/meson-dist/ - TARBALL=$(ls *.tar.xz) - tar xfJ $TARBALL - cd ${TARBALL%.tar.xz} - autoreconf -fi - ./configure --enable-python SHELL=${SHELL} PYTHON=/opt/homebrew/bin/python3 - make -j$(nproc) - make check - set +ex - env: - CC: ${{matrix.cc}} - CXX: ${{matrix.cxx}} - LDFLAGS: ${{matrix.ldflags}} - - name: Build with Autotools - if: matrix.buildsystem == 'autotools' - run: | - set -ex - export SHELL="$(which bash)" - autoreconf -fi + # set +ex + # env: + # CC: ${{matrix.cc}} + # CXX: ${{matrix.cxx}} + # LDFLAGS: ${{matrix.ldflags}} + # - name: Secondary build with Autotools + # if: matrix.buildsystem == 'meson' + # run: | + # set -ex + # export SHELL="$(which bash)" + # cd meson-build/meson-dist/ + # TARBALL=$(ls *.tar.xz) + # tar xfJ $TARBALL + # cd ${TARBALL%.tar.xz} + # autoreconf -fi + # ./configure --enable-python SHELL=${SHELL} PYTHON=/opt/homebrew/bin/python3 + # make -j$(nproc) + # make check + # set +ex + # env: + # CC: ${{matrix.cc}} + # CXX: ${{matrix.cxx}} + # LDFLAGS: ${{matrix.ldflags}} + # - name: Build with Autotools + # if: matrix.buildsystem == 'autotools' + # run: | + # set -ex + # export SHELL="$(which bash)" + # autoreconf -fi - # Build without python - ./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --enable-pascal --disable-java --disable-php --${{matrix.enable_ruby}}-ruby SHELL=${SHELL} RUBY=/opt/homebrew/opt/ruby/bin/ruby - make -j$(nproc) - make check - make distclean + # # Build without python + # ./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --enable-pascal --disable-java --disable-php --${{matrix.enable_ruby}}-ruby SHELL=${SHELL} RUBY=/opt/homebrew/opt/ruby/bin/ruby + # make -j$(nproc) + # make check + # make distclean - # Build without bindings in ANSI-C - ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" SHELL=${SHELL} - make -j$(nproc) - make check - make distclean + # # Build without bindings in ANSI-C + # ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" SHELL=${SHELL} + # make -j$(nproc) + # make check + # make distclean - # Build with Python3 bindings - ./configure --disable-ruby --disable-perl --disable-lua --enable-python-numpy --enable-python PYTHON=${XRL_PYTHON3} SHELL=${SHELL} - make -j$(nproc) - make check - make distclean + # # Build with Python3 bindings + # ./configure --disable-ruby --disable-perl --disable-lua --enable-python-numpy --enable-python PYTHON=${XRL_PYTHON3} SHELL=${SHELL} + # make -j$(nproc) + # make check + # make distclean - # Build static library - ./configure --disable-all-bindings --disable-shared --enable-static SHELL=${SHELL} - make -j$(nproc) - make check - make distclean + # # Build static library + # ./configure --disable-all-bindings --disable-shared --enable-static SHELL=${SHELL} + # make -j$(nproc) + # make check + # make distclean - # Run make distcheck - ./configure - make distcheck SHELL=${SHELL} PYTHON=${XRL_PYTHON3} DISTCHECK_CONFIGURE_FLAGS="--${{matrix.enable_ruby}}-ruby" RUBY=/opt/homebrew/opt/ruby/bin/ruby + # # Run make distcheck + # ./configure + # make distcheck SHELL=${SHELL} PYTHON=${XRL_PYTHON3} DISTCHECK_CONFIGURE_FLAGS="--${{matrix.enable_ruby}}-ruby" RUBY=/opt/homebrew/opt/ruby/bin/ruby - set +ex - env: - CC: ${{matrix.cc}} - CXX: ${{matrix.cxx}} - LDFLAGS: ${{matrix.ldflags}} - XRL_PYTHON3: /opt/homebrew/bin/python3 - - name: Secondary build with Meson - if: matrix.buildsystem == 'autotools' - run: | - set -ex - export PATH=${HOME}/.local/bin:${PATH} - TARBALL=$(ls *.tar.gz) - tar xfz $TARBALL - cd ${TARBALL%.tar.gz} - meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled - meson compile -C meson-build - set +ex - env: - CC: ${{matrix.cc}} - CXX: ${{matrix.cxx}} - LDFLAGS: ${{matrix.ldflags}} + # set +ex + # env: + # CC: ${{matrix.cc}} + # CXX: ${{matrix.cxx}} + # LDFLAGS: ${{matrix.ldflags}} + # XRL_PYTHON3: /opt/homebrew/bin/python3 + # - name: Secondary build with Meson + # if: matrix.buildsystem == 'autotools' + # run: | + # set -ex + # export PATH=${HOME}/.local/bin:${PATH} + # TARBALL=$(ls *.tar.gz) + # tar xfz $TARBALL + # cd ${TARBALL%.tar.gz} + # meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled + # meson compile -C meson-build + # set +ex + # env: + # CC: ${{matrix.cc}} + # CXX: ${{matrix.cxx}} + # LDFLAGS: ${{matrix.ldflags}} - linux: - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - image: - - ubuntu:jammy - - debian:bookworm - - rockylinux:9 - - fedora:latest - cc: - - clang - - gcc - buildsystem: - - autotools - - meson - exclude: - # there's some weird segfault - - image: rockylinux:8 - buildsystem: autotools - cc: clang - include: - - cc: gcc - cxx: g++ - - cc: clang - cxx: clang++ - - fpc: enable - fortran: enable - python: enable - # - cc: clang - # image: rockylinux:8 - # libs: -stdlib=libstdc++ - # fortran: disable - # clang_cflags: -Qunused-arguments - # python: enable - - cc: clang - image: fedora:latest - python: disable - clang_cflags: -Qunused-arguments - - image: rockylinux:8 - lua: /usr/bin/lua - - image: fedora:latest - lua: /usr/bin/lua + # linux: + # timeout-minutes: 60 + # strategy: + # fail-fast: false + # matrix: + # image: + # - ubuntu:jammy + # - debian:bookworm + # - rockylinux:9 + # - fedora:latest + # cc: + # - clang + # - gcc + # buildsystem: + # - autotools + # - meson + # exclude: + # # there's some weird segfault + # - image: rockylinux:8 + # buildsystem: autotools + # cc: clang + # include: + # - cc: gcc + # cxx: g++ + # - cc: clang + # cxx: clang++ + # - fpc: enable + # fortran: enable + # python: enable + # # - cc: clang + # # image: rockylinux:8 + # # libs: -stdlib=libstdc++ + # # fortran: disable + # # clang_cflags: -Qunused-arguments + # # python: enable + # - cc: clang + # image: fedora:latest + # python: disable + # clang_cflags: -Qunused-arguments + # - image: rockylinux:8 + # lua: /usr/bin/lua + # - image: fedora:latest + # lua: /usr/bin/lua - runs-on: ubuntu-latest - container: - image: ${{ matrix.image }} + # runs-on: ubuntu-latest + # container: + # image: ${{ matrix.image }} - steps: - - name: Install Git - if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') - run: | - set -ex - apt-get --yes --force-yes update - apt-get --yes --force-yes install git - set +ex - env: - DEBIAN_FRONTEND: noninteractive - - name: Install Git - if: startsWith(matrix.image, 'rockylinux') || startsWith(matrix.image, 'fedora') - run: | - set -ex - yum install -y git - set +ex - - uses: actions/checkout@v4 - - name: Install ubuntu dependencies - if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') - run: | - set -ex - apt-get --yes --force-yes update - apt-get --yes --force-yes install autoconf automake libtool python3-pip python3-all-dev python3-numpy cython3 fpc gfortran gcc swig lua5.3 liblua5.3-dev ruby-dev default-jdk clang - set +ex - env: - DEBIAN_FRONTEND: noninteractive - - name: Install ubuntu dependencies Meson and Ninja - if: matrix.buildsystem == 'meson' && (startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')) - run: | - set -ex - apt-get --yes --force-yes install meson ninja-build - set +ex - env: - DEBIAN_FRONTEND: noninteractive - - name: Activate RockyLinux 8 PowerTools and EPEL repo - if: matrix.image == 'rockylinux:8' - run: | - set -ex - dnf install -y 'dnf-command(config-manager)' - dnf config-manager --set-enabled powertools - dnf install -y epel-release - set +ex - - name: Activate RockyLinux 9 PowerTools and EPEL repo - if: matrix.image == 'rockylinux:9' - run: | - set -ex - dnf install -y 'dnf-command(config-manager)' - dnf config-manager --set-enabled crb - dnf install -y epel-release - set +ex - - name: Install RHEL dependencies - if: startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux') - run: | - set -ex - yum update -y - yum install -y make autoconf automake libtool python3-setuptools python3-devel python3-numpy python3-Cython fpc gcc-gfortran gcc swig lua lua-devel ruby ruby-devel rubygem-minitest rubygem-test-unit java-1.8.0-openjdk java-1.8.0-openjdk-devel clang libstdc++-devel gcc-c++ which - java -version - which java - javac -version - which javac - set +ex - - name: Install RHEL dependencies Meson and Ninja - if: matrix.buildsystem == 'meson' && (startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux')) - run: | - set -ex - yum install -y meson ninja-build - set +ex - - name: Build and test with Meson - if: matrix.buildsystem == 'meson' - run: | - set -ex - git config --global --add safe.directory /__w/xraylib/xraylib - meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled - meson compile -C meson-build - meson test -C meson-build - meson dist -C meson-build - set +ex - env: - CC: ${{matrix.cc}} - CXX: ${{matrix.cxx}} - # LIBS: ${{matrix.libs}} - - name: Build and test with Autotools - if: matrix.buildsystem == 'autotools' - run: | - set -ex - autoreconf -fi - # disable java for now - ./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --${FPC_ENABLE}-pascal --disable-java --disable-php --enable-ruby --${FORTRAN_ENABLE}-fortran2003 || (cat config.log && exit 1) - make -j$(nproc) - make check || (cat example/xrlexample12.sh.log && exit 1) - make distclean - ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic $CFLAGS" - make -j$(nproc) - make check - make distclean - ./configure --disable-ruby --disable-perl --disable-lua --disable-fortran2003 --${PYTHON_ENABLE}-python-numpy --${PYTHON_ENABLE}-python PYTHON=${XRL_PYTHON3} - make -j$(nproc) - make check || (cat example/xrlexample13.sh.log && exit 1) - make distclean - ./configure --disable-all-bindings --disable-shared --enable-static - make -j$(nproc) - make check - make distclean - ./configure --disable-all-bindings - make distcheck PYTHON=${XRL_PYTHON3} - set +ex - env: - CC: ${{matrix.cc}} - CXX: ${{matrix.cxx}} - CXXFLAGS: -std=c++11 - # LIBS: ${{matrix.libs}} - XRL_PYTHON3: /usr/bin/python3 - LUA: ${{matrix.lua}} - JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 - PYTHON_ENABLE: ${{matrix.python}} - FORTRAN_ENABLE: ${{matrix.fortran}} - FPC_ENABLE: ${{matrix.fpc}} - DISTCHECK_CONFIGURE_FLAGS: --${{matrix.fpc}}-pascal --enable-java --disable-perl --enable-lua --${{matrix.python}}-python --${{matrix.python}}-python-numpy --disable-php --enable-ruby --${{matrix.fortran}}-fortran2003 - CFLAGS: ${{matrix.clang_cflags}} + # steps: + # - name: Install Git + # if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') + # run: | + # set -ex + # apt-get --yes --force-yes update + # apt-get --yes --force-yes install git + # set +ex + # env: + # DEBIAN_FRONTEND: noninteractive + # - name: Install Git + # if: startsWith(matrix.image, 'rockylinux') || startsWith(matrix.image, 'fedora') + # run: | + # set -ex + # yum install -y git + # set +ex + # - uses: actions/checkout@v4 + # - name: Install ubuntu dependencies + # if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') + # run: | + # set -ex + # apt-get --yes --force-yes update + # apt-get --yes --force-yes install autoconf automake libtool python3-pip python3-all-dev python3-numpy cython3 fpc gfortran gcc swig lua5.3 liblua5.3-dev ruby-dev default-jdk clang + # set +ex + # env: + # DEBIAN_FRONTEND: noninteractive + # - name: Install ubuntu dependencies Meson and Ninja + # if: matrix.buildsystem == 'meson' && (startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')) + # run: | + # set -ex + # apt-get --yes --force-yes install meson ninja-build + # set +ex + # env: + # DEBIAN_FRONTEND: noninteractive + # - name: Activate RockyLinux 8 PowerTools and EPEL repo + # if: matrix.image == 'rockylinux:8' + # run: | + # set -ex + # dnf install -y 'dnf-command(config-manager)' + # dnf config-manager --set-enabled powertools + # dnf install -y epel-release + # set +ex + # - name: Activate RockyLinux 9 PowerTools and EPEL repo + # if: matrix.image == 'rockylinux:9' + # run: | + # set -ex + # dnf install -y 'dnf-command(config-manager)' + # dnf config-manager --set-enabled crb + # dnf install -y epel-release + # set +ex + # - name: Install RHEL dependencies + # if: startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux') + # run: | + # set -ex + # yum update -y + # yum install -y make autoconf automake libtool python3-setuptools python3-devel python3-numpy python3-Cython fpc gcc-gfortran gcc swig lua lua-devel ruby ruby-devel rubygem-minitest rubygem-test-unit java-1.8.0-openjdk java-1.8.0-openjdk-devel clang libstdc++-devel gcc-c++ which + # java -version + # which java + # javac -version + # which javac + # set +ex + # - name: Install RHEL dependencies Meson and Ninja + # if: matrix.buildsystem == 'meson' && (startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux')) + # run: | + # set -ex + # yum install -y meson ninja-build + # set +ex + # - name: Build and test with Meson + # if: matrix.buildsystem == 'meson' + # run: | + # set -ex + # git config --global --add safe.directory /__w/xraylib/xraylib + # meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled + # meson compile -C meson-build + # meson test -C meson-build + # meson dist -C meson-build + # set +ex + # env: + # CC: ${{matrix.cc}} + # CXX: ${{matrix.cxx}} + # # LIBS: ${{matrix.libs}} + # - name: Build and test with Autotools + # if: matrix.buildsystem == 'autotools' + # run: | + # set -ex + # autoreconf -fi + # # disable java for now + # ./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --${FPC_ENABLE}-pascal --disable-java --disable-php --enable-ruby --${FORTRAN_ENABLE}-fortran2003 || (cat config.log && exit 1) + # make -j$(nproc) + # make check || (cat example/xrlexample12.sh.log && exit 1) + # make distclean + # ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic $CFLAGS" + # make -j$(nproc) + # make check + # make distclean + # ./configure --disable-ruby --disable-perl --disable-lua --disable-fortran2003 --${PYTHON_ENABLE}-python-numpy --${PYTHON_ENABLE}-python PYTHON=${XRL_PYTHON3} + # make -j$(nproc) + # make check || (cat example/xrlexample13.sh.log && exit 1) + # make distclean + # ./configure --disable-all-bindings --disable-shared --enable-static + # make -j$(nproc) + # make check + # make distclean + # ./configure --disable-all-bindings + # make distcheck PYTHON=${XRL_PYTHON3} + # set +ex + # env: + # CC: ${{matrix.cc}} + # CXX: ${{matrix.cxx}} + # CXXFLAGS: -std=c++11 + # # LIBS: ${{matrix.libs}} + # XRL_PYTHON3: /usr/bin/python3 + # LUA: ${{matrix.lua}} + # JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 + # PYTHON_ENABLE: ${{matrix.python}} + # FORTRAN_ENABLE: ${{matrix.fortran}} + # FPC_ENABLE: ${{matrix.fpc}} + # DISTCHECK_CONFIGURE_FLAGS: --${{matrix.fpc}}-pascal --enable-java --disable-perl --enable-lua --${{matrix.python}}-python --${{matrix.python}}-python-numpy --disable-php --enable-ruby --${{matrix.fortran}}-fortran2003 + # CFLAGS: ${{matrix.clang_cflags}} diff --git a/cplusplus/meson.build b/cplusplus/meson.build index 96f5fc86..b2641367 100644 --- a/cplusplus/meson.build +++ b/cplusplus/meson.build @@ -1,4 +1,6 @@ -install_headers(files('xraylib++.h'), subdir: 'xraylib') +cplusplus_source_files = files('xraylib++.h') + +install_headers(cplusplus_source_files, subdir: 'xraylib') cplusplus_source_dir = meson.current_source_dir() diff --git a/doc/meson.build b/doc/meson.build new file mode 100644 index 00000000..ab666304 --- /dev/null +++ b/doc/meson.build @@ -0,0 +1,8 @@ +docs_src_dir = meson.current_source_dir() +docs_bld_dir = meson.current_build_dir() + +doc_files = files( + 'xraydoc.txt' +) + +install_data(doc_files) \ No newline at end of file diff --git a/example/meson.build b/example/meson.build new file mode 100644 index 00000000..940baee4 --- /dev/null +++ b/example/meson.build @@ -0,0 +1,6 @@ +windows_installer_example_files = files( + 'xrlexample1.c', + 'xrlexample6.cpp', + 'xrlexample8.cs', + 'xrlexample14.pas', +) \ No newline at end of file diff --git a/meson.build b/meson.build index 691f38bf..2ed1f51b 100644 --- a/meson.build +++ b/meson.build @@ -17,6 +17,8 @@ lib_current = 12 lib_revision = 1 lib_age = 1 +lib_current_minus_age = lib_current - lib_age + version = '@0@.@1@.@2@'.format((lib_current - lib_age), lib_age, lib_revision) current = lib_current + 1 @@ -98,9 +100,12 @@ xraylib_build_dep = [m_dep] pkgconfig = import('pkgconfig') subdir('include') +subdir('doc') subdir('src') subdir('tests') subdir('cplusplus') +subdir('example') +subdir('pascal') if not (get_option('python-bindings').disabled() and get_option('python-numpy-bindings').disabled()) pymod = import('python') @@ -189,3 +194,10 @@ ENDPROGRAM f2003_main endif endif + +if host_system == 'windows' and \ + cc.get_id() == 'gcc' and \ + get_option('windows-installer').enabled() and \ + meson.version().version_compare('>=1.4.0') + subdir('windows') +endif \ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt index 93bf0334..95fb1334 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,3 +2,4 @@ option('fortran-bindings', type: 'feature', value: 'auto', description: 'Build F option('python-bindings', type: 'feature', value: 'auto', description: 'Build classic Python bindings') option('python-numpy-bindings', type: 'feature', value: 'auto', description: 'Build numpy Python bindings') option('swig', type : 'string', value : 'swig', description: 'Path to swig executable') +option('windows-installer', type: 'feature', value: 'disabled', description: 'Build Windows installer') \ No newline at end of file diff --git a/pascal/meson.build b/pascal/meson.build new file mode 100644 index 00000000..e7af286d --- /dev/null +++ b/pascal/meson.build @@ -0,0 +1,6 @@ +pascal_source_files = files( + 'xraylib.pas', + 'xraylib_const.pas', + 'xraylib_iface.pas', + 'xraylib_impl.pas', +) \ No newline at end of file diff --git a/src/meson.build b/src/meson.build index 59ccc7a0..c3977076 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,3 +1,6 @@ +src_source_dir = meson.current_source_dir() +src_build_dir = meson.current_build_dir() + core_c_args = [ '-DHAVE_CONFIG_H', '-D_GNU_SOURCE', @@ -108,6 +111,10 @@ libxrl_sources = shared_sources + [xrayglob_inline] + files( 'xrf_cross_sections_aux.c', ) +libxrl_def_file = join_paths(src_build_dir, 'libxrl-@0@.def'.format(lib_current_minus_age)) + +libxrl_link_args = cc.get_supported_link_arguments(['-Wl,--output-def,@0@'.format(libxrl_def_file)]) + xraylib_lib = library( 'xrl', libxrl_sources, @@ -118,6 +125,7 @@ xraylib_lib = library( c_args: core_c_args + xraylib_error_flags, gnu_symbol_visibility: 'hidden', include_directories: extra_include_dirs, + link_args: libxrl_link_args ) xraylib_lib_dep = declare_dependency( @@ -128,9 +136,6 @@ xraylib_lib_dep = declare_dependency( swig_interface = files('xraylib.i') -src_source_dir = meson.current_source_dir() -src_build_dir = meson.current_build_dir() - pkgconfig.generate( xraylib_lib, name: 'xraylib', diff --git a/windows/meson.build b/windows/meson.build new file mode 100644 index 00000000..49c3df60 --- /dev/null +++ b/windows/meson.build @@ -0,0 +1,66 @@ +fs = import('fs') + +windows_src_dir = meson.current_source_dir() +windows_bld_dir = meson.current_build_dir() + +unix2dos_cmd = find_program('unix2dos', required : true) +lib_cmd = find_program('lib', required : true) +iscc_cmd = find_program('iscc', required: true) + +unix2dos_input_files = { + join_paths(project_source_root, 'README') : 'README.txt', + join_paths(project_source_root, 'AUTHORS') : 'AUTHORS.txt', + join_paths(project_source_root, 'TODO') : 'TODO.txt', + join_paths(project_source_root, 'Changelog') : 'Changelog.txt', + join_paths(windows_src_dir, 'README') : 'README2.txt', +} + +foreach f: xraylib_headers + doc_files + windows_installer_example_files + pascal_source_files + cplusplus_source_files + unix2dos_input_files += { + f.full_path() : fs.name(f) + } +endforeach + +unix2dos_custom_targets = [] + +foreach input, output : unix2dos_input_files + unix2dos_custom_targets += custom_target( + command: [unix2dos_cmd, '-n', '@INPUT@', '@OUTPUT@'], + input: [input], + output: [output], + build_by_default: true + ) +endforeach + +lib_custom_target = custom_target( + command: [ + lib_cmd, + '/machine:X64', + '/def:@0@'.format(libxrl_def_file), + '/out:@OUTPUT0@', + ], + output: [ + 'libxrl-@0@.lib'.format(lib_current_minus_age), + 'libxrl-@0@.exp'.format(lib_current_minus_age), + ], + build_by_default: true, + depends: [xraylib_lib] +) + +iscc_custom_target = custom_target( + command: [ + iscc_cmd, + '-dXRL64', + '-dLIB_CURRENT_MINUS_AGE=@0@'.format(lib_current_minus_age), + '-dMyAppVersion=@0@'.format(meson.project_version()), + '-dabs_top_srcdir_win=@0@'.format(project_source_root), + '-dabs_top_builddir_win=@0@'.format(project_build_root), + '@INPUT0@', + ], + input: files('xraylib.iss'), + output: [ + 'xraylib-@0@-win64.exe'.format(meson.project_version()) + ], + build_by_default: true, + depends: [lib_custom_target, unix2dos_custom_targets] +) diff --git a/windows/xraylib.iss b/windows/xraylib.iss index 4521943b..be35d3f2 100644 --- a/windows/xraylib.iss +++ b/windows/xraylib.iss @@ -60,7 +60,7 @@ Name: "dotnet" ; Description: ".NET/C# bindings" ; Types: full Name: "pascal" ; Description: "Delphi/Pascal" ; Types: full [Files] -Source: "{#builddir}\src\.libs\libxrl-{#LIB_CURRENT_MINUS_AGE}.dll"; DestDir: "{sys}" ; Flags: sharedfile ; Components: core +Source: "{#builddir}\src\libxrl-{#LIB_CURRENT_MINUS_AGE}.dll"; DestDir: "{sys}" ; Flags: sharedfile ; Components: core Source: "{#builddir}\windows\README.txt" ; DestDir: "{app}" ; Flags: isreadme ; Components: core Source: "{#builddir}\windows\AUTHORS.txt" ; DestDir: "{app}" ; Components: core Source: "{#builddir}\windows\Changelog.txt" ; DestDir: "{app}" ; Components: core @@ -69,7 +69,7 @@ Source: "{#builddir}\windows\xraydoc.txt" ; DestDir: "{app}\Doc" ; Components: c Source: "{#builddir}\windows\libxrl-{#LIB_CURRENT_MINUS_AGE}.lib" ; DestDir: "{app}\Lib" ; Components: sdk Source: "{#builddir}\windows\libxrl-{#LIB_CURRENT_MINUS_AGE}.exp" ; DestDir: "{app}\Lib" ; Components: sdk -Source: "{#builddir}\src\.libs\libxrl.dll.a" ; DestDir: "{app}\Lib" ; Components: sdk +Source: "{#builddir}\src\libxrl.dll.a" ; DestDir: "{app}\Lib" ; Components: sdk Source: "{#builddir}\src\libxrl-{#LIB_CURRENT_MINUS_AGE}.def" ; DestDir: "{app}\Lib" ; Components: sdk Source: "{#builddir}\windows\README2.txt" ; DestDir: "{app}\Doc" ; DestName: "README.txt";Components: sdk Source: "{#builddir}\windows\xrlexample1.c" ; DestDir: "{app}\Example" ; Components: sdk From 2ecbcb37e9bac11ffe5ad7a3346cfc19db0dcec9 Mon Sep 17 00:00:00 2001 From: Tom Schoonjans Date: Tue, 6 Aug 2024 22:18:31 +0200 Subject: [PATCH 2/5] Remove windows installer support in autotools --- Makefile.am | 7 ------ configure.ac | 16 ------------ windows/Makefile.am | 61 --------------------------------------------- windows/README | 17 ------------- 4 files changed, 101 deletions(-) delete mode 100644 windows/Makefile.am diff --git a/Makefile.am b/Makefile.am index e7041eca..9d03f142 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,7 +19,6 @@ SUBDIRS = include \ doc \ data \ java \ - windows \ perl \ lua \ fortran \ @@ -36,10 +35,4 @@ if ENABLE_FORTRAN pkgconfig_DATA += libxrlf03.pc endif -windows: - $(MAKE) -C windows windows - - EXTRA_DIST = xraylib.spec Changelog meson.build meson_options.txt - -.PHONY: windows diff --git a/configure.ac b/configure.ac index 563d011b..2eca6abb 100644 --- a/configure.ac +++ b/configure.ac @@ -1046,7 +1046,6 @@ AC_CONFIG_FILES([Makefile java/tests/Makefile java/build.gradle java/settings.gradle - windows/Makefile perl/Makefile lua/Makefile fortran/Makefile @@ -1074,21 +1073,6 @@ abs_top_srcdir=`pwd -P` cd $abs_top_builddir AC_SUBST(abs_top_srcdir) -#windows slashes versions -if test x$OS_WINDOWS = "x1" ; then - abs_top_builddir_win=`pwd -W` - AC_SUBST(abs_top_builddir_win) - abs_top_srcdir_win=`AS_DIRNAME([$0])` - cd $abs_top_srcdir_win - abs_top_srcdir_win=`pwd -W` - cd $abs_top_builddir_win - AC_SUBST(abs_top_srcdir_win) - cd - abs_homedir_win=`pwd -W` - AC_SUBST(abs_homedir_win) - cd $abs_top_builddir_win -fi - AM_CONDITIONAL([ABS_SRC_BUILD_EQUAL],[test x$abs_top_builddir = x$abs_top_srcdir]) AC_OUTPUT diff --git a/windows/Makefile.am b/windows/Makefile.am deleted file mode 100644 index 56b1421e..00000000 --- a/windows/Makefile.am +++ /dev/null @@ -1,61 +0,0 @@ -#Copyright (c) 2010, Tom Schoonjans -#All rights reserved. - -#Redistribution and use in source and binary forms, with or without -#modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -# * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. - -#THIS SOFTWARE IS PROVIDED BY Tom Schoonjans ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Tom Schoonjans BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -if OS_WINDOWS_32 -windows: - $(MAKE) common - lib /machine:i386 /def:libxrl-$(LIB_CURRENT_MINUS_AGE).def - iscc.exe "-dLIB_CURRENT_MINUS_AGE=$(LIB_CURRENT_MINUS_AGE)" "-dMyAppVersion=$(VERSION)" "-dabs_top_srcdir_win=$(abs_top_srcdir_win)" "-dabs_top_builddir_win=$(abs_top_builddir_win)" "${srcdir}/xraylib.iss" - rm libxrl-$(LIB_CURRENT_MINUS_AGE).def -endif - -if OS_WINDOWS_64 -windows: - $(MAKE) common - lib /machine:X64 /def:libxrl-$(LIB_CURRENT_MINUS_AGE).def - iscc.exe "-dXRL64" "-dLIB_CURRENT_MINUS_AGE=$(LIB_CURRENT_MINUS_AGE)" "-dMyAppVersion=$(VERSION)" "-dabs_top_srcdir_win=$(abs_top_srcdir_win)" "-dabs_top_builddir_win=$(abs_top_builddir_win)" "${srcdir}/xraylib.iss" - rm libxrl-$(LIB_CURRENT_MINUS_AGE).def -endif - -common: - cp ../src/libxrl-$(LIB_CURRENT_MINUS_AGE).def . - cp ../src/.libs/libxrl-$(LIB_CURRENT_MINUS_AGE).dll . - unix2dos -n ${top_srcdir}/README README.txt - unix2dos -n ${top_srcdir}/AUTHORS AUTHORS.txt - unix2dos -n ${top_srcdir}/TODO TODO.txt - unix2dos -n ${top_srcdir}/Changelog Changelog.txt - unix2dos -n ${top_srcdir}/doc/xraydoc.txt xraydoc.txt - unix2dos -n ${srcdir}/README README2.txt - unix2dos -n ${top_srcdir}/example/xrlexample8.cs xrlexample8.cs - unix2dos -n ${top_srcdir}/example/xrlexample1.c xrlexample1.c - unix2dos -n ${top_srcdir}/example/xrlexample6.cpp xrlexample6.cpp - unix2dos -n ${top_srcdir}/include/xraylib.h xraylib.h - unix2dos -n ${top_srcdir}/include/xraylib-parser.h xraylib-parser.h - unix2dos -n ${top_srcdir}/include/xraylib-lines.h xraylib-lines.h - unix2dos -n ${top_srcdir}/include/xraylib-shells.h xraylib-shells.h - unix2dos -n ${top_srcdir}/include/xraylib-auger.h xraylib-auger.h - unix2dos -n ${top_srcdir}/include/xraylib-crystal-diffraction.h xraylib-crystal-diffraction.h - unix2dos -n ${top_srcdir}/include/xraylib-defs.h xraylib-defs.h - unix2dos -n ${top_srcdir}/include/xraylib-deprecated.h xraylib-deprecated.h - unix2dos -n ${top_srcdir}/include/xraylib-error.h xraylib-error.h - unix2dos -n ${top_srcdir}/include/xraylib-nist-compounds.h xraylib-nist-compounds.h - unix2dos -n ${top_srcdir}/include/xraylib-radionuclides.h xraylib-radionuclides.h - unix2dos -n ${top_srcdir}/include/xraylib-aux.h xraylib-aux.h - unix2dos -n ${top_srcdir}/pascal/xraylib.pas xraylib.pas - unix2dos -n ${top_srcdir}/pascal/xraylib_const.pas xraylib_const.pas - unix2dos -n ${top_srcdir}/pascal/xraylib_iface.pas xraylib_iface.pas - unix2dos -n ${top_srcdir}/pascal/xraylib_impl.pas xraylib_impl.pas - unix2dos -n ${top_srcdir}/example/xrlexample14.pas xrlexample14.pas - unix2dos -n ${top_srcdir}/cplusplus/xraylib++.h xraylib++.h - - - -EXTRA_DIST = License.rtf README xraylib.iss diff --git a/windows/README b/windows/README index 0bd50851..07178c41 100644 --- a/windows/README +++ b/windows/README @@ -1,20 +1,3 @@ -Some info on how we have built the Windows package: - -We use two separate Windows 7 64-bit VirtualBox VMs, one with 32-bit versions of GCC, and a second one with 64-bit counterparts of these. All work is done using a MSYS shell. In both cases the GCC compilers were packaged by the TDM-GCC project. - -Compilation starts out as on Linux/Mac OS X... - - ./configure && make - -... followed by: - - make windows - -followed by running InnoSetup to create the installer package. - -This procedure is heavily adapted to my own directory layout and will require considerable changes to get it working on your system. - - .NET bindings ============= From a084c60e9b397193905e28fa60c9026a6db20138 Mon Sep 17 00:00:00 2001 From: Tom Schoonjans Date: Tue, 6 Aug 2024 22:19:43 +0200 Subject: [PATCH 3/5] Reenable all CI --- .github/workflows/ci.yml | 634 +++++++++++++++++++-------------------- 1 file changed, 317 insertions(+), 317 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb3bb2a8..24234a41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,36 +11,36 @@ on: - master jobs: - # visual-studio: - # timeout-minutes: 60 - # runs-on: windows-latest - # strategy: - # fail-fast: false - # matrix: - # python-version: ['3.9', '3.10', '3.11', '3.12'] - # compiler: - # - cl - # - clang-cl - # name: Visual Studio with ${{matrix.compiler}} and Python ${{ matrix.python-version }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-python@v5 - # with: - # python-version: ${{ matrix.python-version }} - # - name: Install meson, ninja, numpy and cython - # run: | - # python -m pip install -U numpy pip - # python -m pip install meson ninja cython - # - uses: ilammy/msvc-dev-cmd@v1 - # - name: Build with meson - # run: | - # meson setup meson-build --buildtype=release -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled - # meson compile -C meson-build - # meson test -C meson-build || (cat meson-build\meson-logs\testlog.txt) - # # ninja -v -C meson-build dist - # env: - # CC: ${{ matrix.compiler }} - # CXX: ${{ matrix.compiler }} + visual-studio: + timeout-minutes: 60 + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12'] + compiler: + - cl + - clang-cl + name: Visual Studio with ${{matrix.compiler}} and Python ${{ matrix.python-version }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install meson, ninja, numpy and cython + run: | + python -m pip install -U numpy pip + python -m pip install meson ninja cython + - uses: ilammy/msvc-dev-cmd@v1 + - name: Build with meson + run: | + meson setup meson-build --buildtype=release -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled + meson compile -C meson-build + meson test -C meson-build || (cat meson-build\meson-logs\testlog.txt) + # ninja -v -C meson-build dist + env: + CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} msys2: timeout-minutes: 60 @@ -145,300 +145,300 @@ jobs: path: meson-build\windows\xraylib-*-win64.exe retention-days: 1 - # macos: - # timeout-minutes: 60 - # runs-on: macos-latest - # strategy: - # fail-fast: false - # matrix: - # buildsystem: - # # - autotools - # - meson - # compiler: - # - llvm - # - gcc@13 - # include: - # - ldflags: "-Wl,-ld_classic" - # - compiler: llvm - # cc: /opt/homebrew/opt/llvm/bin/clang - # cxx: /opt/homebrew/opt/llvm/bin/clang++ - # # ldflags: -L/opt/homebrew/opt/llvm/lib - # enable_ruby: enable - # - compiler: gcc@13 - # cc: gcc-13 - # cxx: g++-13 - # # -fdeclspec is only supported by llvm's clang! - # enable_ruby: disable - # steps: - # - uses: actions/checkout@v4 - # - name: Install Homebrew dependencies - # run: | - # set -ex - # rm -f /opt/homebrew/bin/2to3 - # brew uninstall -f bazel bazelisk mongodb-community - # brew update - # brew upgrade - # brew install git autoconf automake libtool pkg-config ${{ matrix.compiler }} swig ruby fpc lua bash numpy meson ninja cython - # brew link --overwrite python - # brew unlink python && brew link --overwrite python - # ls -l /opt/homebrew/bin/python3 - # echo "/opt/homebrew/opt/cython/bin" >> "${GITHUB_PATH}" - # set +ex - # env: - # HOMEBREW_CURL_RETRIES: 5 - # - name: Primary Build and test with Meson - # if: matrix.buildsystem == 'meson' - # run: | - # set -ex - # meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled - # meson compile -C meson-build - # meson test -C meson-build - # meson dist -C meson-build + macos: + timeout-minutes: 60 + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + buildsystem: + # - autotools + - meson + compiler: + - llvm + - gcc@13 + include: + - ldflags: "-Wl,-ld_classic" + - compiler: llvm + cc: /opt/homebrew/opt/llvm/bin/clang + cxx: /opt/homebrew/opt/llvm/bin/clang++ + # ldflags: -L/opt/homebrew/opt/llvm/lib + enable_ruby: enable + - compiler: gcc@13 + cc: gcc-13 + cxx: g++-13 + # -fdeclspec is only supported by llvm's clang! + enable_ruby: disable + steps: + - uses: actions/checkout@v4 + - name: Install Homebrew dependencies + run: | + set -ex + rm -f /opt/homebrew/bin/2to3 + brew uninstall -f bazel bazelisk mongodb-community + brew update + brew upgrade + brew install git autoconf automake libtool pkg-config ${{ matrix.compiler }} swig ruby fpc lua bash numpy meson ninja cython + brew link --overwrite python + brew unlink python && brew link --overwrite python + ls -l /opt/homebrew/bin/python3 + echo "/opt/homebrew/opt/cython/bin" >> "${GITHUB_PATH}" + set +ex + env: + HOMEBREW_CURL_RETRIES: 5 + - name: Primary Build and test with Meson + if: matrix.buildsystem == 'meson' + run: | + set -ex + meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled + meson compile -C meson-build + meson test -C meson-build + meson dist -C meson-build - # set +ex - # env: - # CC: ${{matrix.cc}} - # CXX: ${{matrix.cxx}} - # LDFLAGS: ${{matrix.ldflags}} - # - name: Secondary build with Autotools - # if: matrix.buildsystem == 'meson' - # run: | - # set -ex - # export SHELL="$(which bash)" - # cd meson-build/meson-dist/ - # TARBALL=$(ls *.tar.xz) - # tar xfJ $TARBALL - # cd ${TARBALL%.tar.xz} - # autoreconf -fi - # ./configure --enable-python SHELL=${SHELL} PYTHON=/opt/homebrew/bin/python3 - # make -j$(nproc) - # make check - # set +ex - # env: - # CC: ${{matrix.cc}} - # CXX: ${{matrix.cxx}} - # LDFLAGS: ${{matrix.ldflags}} - # - name: Build with Autotools - # if: matrix.buildsystem == 'autotools' - # run: | - # set -ex - # export SHELL="$(which bash)" - # autoreconf -fi + set +ex + env: + CC: ${{matrix.cc}} + CXX: ${{matrix.cxx}} + LDFLAGS: ${{matrix.ldflags}} + - name: Secondary build with Autotools + if: matrix.buildsystem == 'meson' + run: | + set -ex + export SHELL="$(which bash)" + cd meson-build/meson-dist/ + TARBALL=$(ls *.tar.xz) + tar xfJ $TARBALL + cd ${TARBALL%.tar.xz} + autoreconf -fi + ./configure --enable-python SHELL=${SHELL} PYTHON=/opt/homebrew/bin/python3 + make -j$(nproc) + make check + set +ex + env: + CC: ${{matrix.cc}} + CXX: ${{matrix.cxx}} + LDFLAGS: ${{matrix.ldflags}} + - name: Build with Autotools + if: matrix.buildsystem == 'autotools' + run: | + set -ex + export SHELL="$(which bash)" + autoreconf -fi - # # Build without python - # ./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --enable-pascal --disable-java --disable-php --${{matrix.enable_ruby}}-ruby SHELL=${SHELL} RUBY=/opt/homebrew/opt/ruby/bin/ruby - # make -j$(nproc) - # make check - # make distclean + # Build without python + ./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --enable-pascal --disable-java --disable-php --${{matrix.enable_ruby}}-ruby SHELL=${SHELL} RUBY=/opt/homebrew/opt/ruby/bin/ruby + make -j$(nproc) + make check + make distclean - # # Build without bindings in ANSI-C - # ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" SHELL=${SHELL} - # make -j$(nproc) - # make check - # make distclean + # Build without bindings in ANSI-C + ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" SHELL=${SHELL} + make -j$(nproc) + make check + make distclean - # # Build with Python3 bindings - # ./configure --disable-ruby --disable-perl --disable-lua --enable-python-numpy --enable-python PYTHON=${XRL_PYTHON3} SHELL=${SHELL} - # make -j$(nproc) - # make check - # make distclean + # Build with Python3 bindings + ./configure --disable-ruby --disable-perl --disable-lua --enable-python-numpy --enable-python PYTHON=${XRL_PYTHON3} SHELL=${SHELL} + make -j$(nproc) + make check + make distclean - # # Build static library - # ./configure --disable-all-bindings --disable-shared --enable-static SHELL=${SHELL} - # make -j$(nproc) - # make check - # make distclean + # Build static library + ./configure --disable-all-bindings --disable-shared --enable-static SHELL=${SHELL} + make -j$(nproc) + make check + make distclean - # # Run make distcheck - # ./configure - # make distcheck SHELL=${SHELL} PYTHON=${XRL_PYTHON3} DISTCHECK_CONFIGURE_FLAGS="--${{matrix.enable_ruby}}-ruby" RUBY=/opt/homebrew/opt/ruby/bin/ruby + # Run make distcheck + ./configure + make distcheck SHELL=${SHELL} PYTHON=${XRL_PYTHON3} DISTCHECK_CONFIGURE_FLAGS="--${{matrix.enable_ruby}}-ruby" RUBY=/opt/homebrew/opt/ruby/bin/ruby - # set +ex - # env: - # CC: ${{matrix.cc}} - # CXX: ${{matrix.cxx}} - # LDFLAGS: ${{matrix.ldflags}} - # XRL_PYTHON3: /opt/homebrew/bin/python3 - # - name: Secondary build with Meson - # if: matrix.buildsystem == 'autotools' - # run: | - # set -ex - # export PATH=${HOME}/.local/bin:${PATH} - # TARBALL=$(ls *.tar.gz) - # tar xfz $TARBALL - # cd ${TARBALL%.tar.gz} - # meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled - # meson compile -C meson-build - # set +ex - # env: - # CC: ${{matrix.cc}} - # CXX: ${{matrix.cxx}} - # LDFLAGS: ${{matrix.ldflags}} + set +ex + env: + CC: ${{matrix.cc}} + CXX: ${{matrix.cxx}} + LDFLAGS: ${{matrix.ldflags}} + XRL_PYTHON3: /opt/homebrew/bin/python3 + - name: Secondary build with Meson + if: matrix.buildsystem == 'autotools' + run: | + set -ex + export PATH=${HOME}/.local/bin:${PATH} + TARBALL=$(ls *.tar.gz) + tar xfz $TARBALL + cd ${TARBALL%.tar.gz} + meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled + meson compile -C meson-build + set +ex + env: + CC: ${{matrix.cc}} + CXX: ${{matrix.cxx}} + LDFLAGS: ${{matrix.ldflags}} - # linux: - # timeout-minutes: 60 - # strategy: - # fail-fast: false - # matrix: - # image: - # - ubuntu:jammy - # - debian:bookworm - # - rockylinux:9 - # - fedora:latest - # cc: - # - clang - # - gcc - # buildsystem: - # - autotools - # - meson - # exclude: - # # there's some weird segfault - # - image: rockylinux:8 - # buildsystem: autotools - # cc: clang - # include: - # - cc: gcc - # cxx: g++ - # - cc: clang - # cxx: clang++ - # - fpc: enable - # fortran: enable - # python: enable - # # - cc: clang - # # image: rockylinux:8 - # # libs: -stdlib=libstdc++ - # # fortran: disable - # # clang_cflags: -Qunused-arguments - # # python: enable - # - cc: clang - # image: fedora:latest - # python: disable - # clang_cflags: -Qunused-arguments - # - image: rockylinux:8 - # lua: /usr/bin/lua - # - image: fedora:latest - # lua: /usr/bin/lua + linux: + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + image: + - ubuntu:jammy + - debian:bookworm + - rockylinux:9 + - fedora:latest + cc: + - clang + - gcc + buildsystem: + - autotools + - meson + exclude: + # there's some weird segfault + - image: rockylinux:8 + buildsystem: autotools + cc: clang + include: + - cc: gcc + cxx: g++ + - cc: clang + cxx: clang++ + - fpc: enable + fortran: enable + python: enable + # - cc: clang + # image: rockylinux:8 + # libs: -stdlib=libstdc++ + # fortran: disable + # clang_cflags: -Qunused-arguments + # python: enable + - cc: clang + image: fedora:latest + python: disable + clang_cflags: -Qunused-arguments + - image: rockylinux:8 + lua: /usr/bin/lua + - image: fedora:latest + lua: /usr/bin/lua - # runs-on: ubuntu-latest - # container: - # image: ${{ matrix.image }} + runs-on: ubuntu-latest + container: + image: ${{ matrix.image }} - # steps: - # - name: Install Git - # if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') - # run: | - # set -ex - # apt-get --yes --force-yes update - # apt-get --yes --force-yes install git - # set +ex - # env: - # DEBIAN_FRONTEND: noninteractive - # - name: Install Git - # if: startsWith(matrix.image, 'rockylinux') || startsWith(matrix.image, 'fedora') - # run: | - # set -ex - # yum install -y git - # set +ex - # - uses: actions/checkout@v4 - # - name: Install ubuntu dependencies - # if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') - # run: | - # set -ex - # apt-get --yes --force-yes update - # apt-get --yes --force-yes install autoconf automake libtool python3-pip python3-all-dev python3-numpy cython3 fpc gfortran gcc swig lua5.3 liblua5.3-dev ruby-dev default-jdk clang - # set +ex - # env: - # DEBIAN_FRONTEND: noninteractive - # - name: Install ubuntu dependencies Meson and Ninja - # if: matrix.buildsystem == 'meson' && (startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')) - # run: | - # set -ex - # apt-get --yes --force-yes install meson ninja-build - # set +ex - # env: - # DEBIAN_FRONTEND: noninteractive - # - name: Activate RockyLinux 8 PowerTools and EPEL repo - # if: matrix.image == 'rockylinux:8' - # run: | - # set -ex - # dnf install -y 'dnf-command(config-manager)' - # dnf config-manager --set-enabled powertools - # dnf install -y epel-release - # set +ex - # - name: Activate RockyLinux 9 PowerTools and EPEL repo - # if: matrix.image == 'rockylinux:9' - # run: | - # set -ex - # dnf install -y 'dnf-command(config-manager)' - # dnf config-manager --set-enabled crb - # dnf install -y epel-release - # set +ex - # - name: Install RHEL dependencies - # if: startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux') - # run: | - # set -ex - # yum update -y - # yum install -y make autoconf automake libtool python3-setuptools python3-devel python3-numpy python3-Cython fpc gcc-gfortran gcc swig lua lua-devel ruby ruby-devel rubygem-minitest rubygem-test-unit java-1.8.0-openjdk java-1.8.0-openjdk-devel clang libstdc++-devel gcc-c++ which - # java -version - # which java - # javac -version - # which javac - # set +ex - # - name: Install RHEL dependencies Meson and Ninja - # if: matrix.buildsystem == 'meson' && (startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux')) - # run: | - # set -ex - # yum install -y meson ninja-build - # set +ex - # - name: Build and test with Meson - # if: matrix.buildsystem == 'meson' - # run: | - # set -ex - # git config --global --add safe.directory /__w/xraylib/xraylib - # meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled - # meson compile -C meson-build - # meson test -C meson-build - # meson dist -C meson-build - # set +ex - # env: - # CC: ${{matrix.cc}} - # CXX: ${{matrix.cxx}} - # # LIBS: ${{matrix.libs}} - # - name: Build and test with Autotools - # if: matrix.buildsystem == 'autotools' - # run: | - # set -ex - # autoreconf -fi - # # disable java for now - # ./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --${FPC_ENABLE}-pascal --disable-java --disable-php --enable-ruby --${FORTRAN_ENABLE}-fortran2003 || (cat config.log && exit 1) - # make -j$(nproc) - # make check || (cat example/xrlexample12.sh.log && exit 1) - # make distclean - # ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic $CFLAGS" - # make -j$(nproc) - # make check - # make distclean - # ./configure --disable-ruby --disable-perl --disable-lua --disable-fortran2003 --${PYTHON_ENABLE}-python-numpy --${PYTHON_ENABLE}-python PYTHON=${XRL_PYTHON3} - # make -j$(nproc) - # make check || (cat example/xrlexample13.sh.log && exit 1) - # make distclean - # ./configure --disable-all-bindings --disable-shared --enable-static - # make -j$(nproc) - # make check - # make distclean - # ./configure --disable-all-bindings - # make distcheck PYTHON=${XRL_PYTHON3} - # set +ex - # env: - # CC: ${{matrix.cc}} - # CXX: ${{matrix.cxx}} - # CXXFLAGS: -std=c++11 - # # LIBS: ${{matrix.libs}} - # XRL_PYTHON3: /usr/bin/python3 - # LUA: ${{matrix.lua}} - # JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 - # PYTHON_ENABLE: ${{matrix.python}} - # FORTRAN_ENABLE: ${{matrix.fortran}} - # FPC_ENABLE: ${{matrix.fpc}} - # DISTCHECK_CONFIGURE_FLAGS: --${{matrix.fpc}}-pascal --enable-java --disable-perl --enable-lua --${{matrix.python}}-python --${{matrix.python}}-python-numpy --disable-php --enable-ruby --${{matrix.fortran}}-fortran2003 - # CFLAGS: ${{matrix.clang_cflags}} + steps: + - name: Install Git + if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') + run: | + set -ex + apt-get --yes --force-yes update + apt-get --yes --force-yes install git + set +ex + env: + DEBIAN_FRONTEND: noninteractive + - name: Install Git + if: startsWith(matrix.image, 'rockylinux') || startsWith(matrix.image, 'fedora') + run: | + set -ex + yum install -y git + set +ex + - uses: actions/checkout@v4 + - name: Install ubuntu dependencies + if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') + run: | + set -ex + apt-get --yes --force-yes update + apt-get --yes --force-yes install autoconf automake libtool python3-pip python3-all-dev python3-numpy cython3 fpc gfortran gcc swig lua5.3 liblua5.3-dev ruby-dev default-jdk clang + set +ex + env: + DEBIAN_FRONTEND: noninteractive + - name: Install ubuntu dependencies Meson and Ninja + if: matrix.buildsystem == 'meson' && (startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')) + run: | + set -ex + apt-get --yes --force-yes install meson ninja-build + set +ex + env: + DEBIAN_FRONTEND: noninteractive + - name: Activate RockyLinux 8 PowerTools and EPEL repo + if: matrix.image == 'rockylinux:8' + run: | + set -ex + dnf install -y 'dnf-command(config-manager)' + dnf config-manager --set-enabled powertools + dnf install -y epel-release + set +ex + - name: Activate RockyLinux 9 PowerTools and EPEL repo + if: matrix.image == 'rockylinux:9' + run: | + set -ex + dnf install -y 'dnf-command(config-manager)' + dnf config-manager --set-enabled crb + dnf install -y epel-release + set +ex + - name: Install RHEL dependencies + if: startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux') + run: | + set -ex + yum update -y + yum install -y make autoconf automake libtool python3-setuptools python3-devel python3-numpy python3-Cython fpc gcc-gfortran gcc swig lua lua-devel ruby ruby-devel rubygem-minitest rubygem-test-unit java-1.8.0-openjdk java-1.8.0-openjdk-devel clang libstdc++-devel gcc-c++ which + java -version + which java + javac -version + which javac + set +ex + - name: Install RHEL dependencies Meson and Ninja + if: matrix.buildsystem == 'meson' && (startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux')) + run: | + set -ex + yum install -y meson ninja-build + set +ex + - name: Build and test with Meson + if: matrix.buildsystem == 'meson' + run: | + set -ex + git config --global --add safe.directory /__w/xraylib/xraylib + meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled + meson compile -C meson-build + meson test -C meson-build + meson dist -C meson-build + set +ex + env: + CC: ${{matrix.cc}} + CXX: ${{matrix.cxx}} + # LIBS: ${{matrix.libs}} + - name: Build and test with Autotools + if: matrix.buildsystem == 'autotools' + run: | + set -ex + autoreconf -fi + # disable java for now + ./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --${FPC_ENABLE}-pascal --disable-java --disable-php --enable-ruby --${FORTRAN_ENABLE}-fortran2003 || (cat config.log && exit 1) + make -j$(nproc) + make check || (cat example/xrlexample12.sh.log && exit 1) + make distclean + ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic $CFLAGS" + make -j$(nproc) + make check + make distclean + ./configure --disable-ruby --disable-perl --disable-lua --disable-fortran2003 --${PYTHON_ENABLE}-python-numpy --${PYTHON_ENABLE}-python PYTHON=${XRL_PYTHON3} + make -j$(nproc) + make check || (cat example/xrlexample13.sh.log && exit 1) + make distclean + ./configure --disable-all-bindings --disable-shared --enable-static + make -j$(nproc) + make check + make distclean + ./configure --disable-all-bindings + make distcheck PYTHON=${XRL_PYTHON3} + set +ex + env: + CC: ${{matrix.cc}} + CXX: ${{matrix.cxx}} + CXXFLAGS: -std=c++11 + # LIBS: ${{matrix.libs}} + XRL_PYTHON3: /usr/bin/python3 + LUA: ${{matrix.lua}} + JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 + PYTHON_ENABLE: ${{matrix.python}} + FORTRAN_ENABLE: ${{matrix.fortran}} + FPC_ENABLE: ${{matrix.fpc}} + DISTCHECK_CONFIGURE_FLAGS: --${{matrix.fpc}}-pascal --enable-java --disable-perl --enable-lua --${{matrix.python}}-python --${{matrix.python}}-python-numpy --disable-php --enable-ruby --${{matrix.fortran}}-fortran2003 + CFLAGS: ${{matrix.clang_cflags}} From ab89170837de241aa8c9eddb9a8d202bdc00ae40 Mon Sep 17 00:00:00 2001 From: Tom Schoonjans Date: Tue, 6 Aug 2024 22:24:55 +0200 Subject: [PATCH 4/5] Add warning --- meson.build | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 2ed1f51b..a89ab162 100644 --- a/meson.build +++ b/meson.build @@ -195,9 +195,12 @@ ENDPROGRAM f2003_main endif endif -if host_system == 'windows' and \ - cc.get_id() == 'gcc' and \ - get_option('windows-installer').enabled() and \ - meson.version().version_compare('>=1.4.0') - subdir('windows') +if get_option('windows-installer').enabled() + if host_system == 'windows' and \ + cc.get_id() == 'gcc' and \ + meson.version().version_compare('>=1.4.0') + subdir('windows') + else + warning('The windows-installer option is only supported on Windows systems with gcc selected as compiler') + endif endif \ No newline at end of file From c05cb91525992cb8e7c91c23ee363cbee770b609 Mon Sep 17 00:00:00 2001 From: Tom Schoonjans Date: Tue, 6 Aug 2024 22:28:00 +0200 Subject: [PATCH 5/5] Cleanup CI --- .github/workflows/ci.yml | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24234a41..88cce1c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,6 @@ jobs: fail-fast: false matrix: buildsystem: - # - autotools - meson cc: - clang @@ -96,43 +95,8 @@ jobs: set -ex meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled -Dwindows-installer=enabled meson compile -C meson-build - ls -l meson-build/src - ls -l meson-build/windows || true - find . -name '*.lib' meson test -C meson-build || (cat meson-build/meson-logs/testlog.txt && exit 1) - set +ex - env: - CC: ${{matrix.cc}} - CXX: ${{matrix.cxx}} - - name: Primary build and test with Autotools - if: matrix.buildsystem == 'autotools' - run: | - set -ex - - autoreconf -fi - ./configure --disable-all-bindings --disable-shared --enable-static - make -j$(nproc) - make check - make distclean - - ./configure --disable-python --disable-python-numpy --enable-fortran2003 --disable-ruby - make -j$(nproc) - make check - make distclean - - ./configure --enable-python --enable-python-numpy PYTHON=python3 --disable-ruby - make -j$(nproc) - find . -name '*pyd' -print0 | xargs -0 ls -l - find . -name 'xraylib.py' -print0 | xargs -0 ls -l - make check || (cat python/tests/test-suite.log && exit 1) - make distclean - - ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" || (cat config.log && exit 1) - make -j$(nproc) - make check - make windows - set +ex env: CC: ${{matrix.cc}} @@ -152,7 +116,6 @@ jobs: fail-fast: false matrix: buildsystem: - # - autotools - meson compiler: - llvm