Skip to content

Commit

Permalink
build: fix swig install under centos/manylinux
Browse files Browse the repository at this point in the history
  • Loading branch information
jgriffiths committed Jul 4, 2024
1 parent df384c0 commit b041664
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
os: [ubuntu-22.04, windows-2019, macos-14]
env:
CIBW_BEFORE_ALL_LINUX: yum install -y swig || apk add swig
CIBW_BEFORE_ALL_LINUX: ./tools/install_swig.sh
CIBW_BEFORE_ALL_MACOS: brew install gnu-sed swig automake libtool
CIBW_BEFORE_ALL_WINDOWS: choco install swig --version=3.0.12 --no-progress --allow-downgrade -y
CIBW_BEFORE_BUILD_WINDOWS: .\tools\msvc\swig.bat
Expand Down
49 changes: 49 additions & 0 deletions tools/install_swig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#! /usr/bin/env bash
set -e

if [ $(command -v swig) ]; then
# Already installed
exit 0
fi

if [ $(command -v apt) ]; then
# Debian/Ubuntu
apt install swig
exit 0
fi

if [ -d /etc/yum.repos.d ]; then
# Redhat/Fedora
if grep -- mirror.centos.org /etc/yum.repos.d/*.repo >/dev/null 2>&1; then
# mirror.centos.org has been nuked. Attempt to update the repo spec
# for older manylinux docker builds
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
fi
yum install -y swig
exit 0
fi

if [ $(command -v brew) ]; then
# MacOS
brew install swig
exit 0
fi

if [ $(command -v apk) ]; then
# Alpine
apk add swig
exit 0
fi

# Unknown - install from source
SWIG_URL='https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz?use_mirror=autoselect'
curl -sSL ${SWIG_URL} | tar xz
pushd swig-3.0.12 >/dev/null
./configure
make -j4
make install
popd >/dev/null
rm -rf swig-3.0.12
exit 0

0 comments on commit b041664

Please sign in to comment.