1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
#!/bin/bash
if [ ! -f VERSION ]; then
echo "ERROR: must be executed from top directory"
exit 1
fi
version=`cat VERSION`
pdf_build_dir=build.pdf
PUBLIC="ec:/home/swipl/web/download/stable"
build_pdf()
{ rm -rf build.pdf
mkdir build.pdf
( cd build.pdf
cmake -DBUILD_PDF_DOCUMENTATION=ON -G Ninja ..
ninja
)
}
# Build the Windows version using the Docker from
# https://github.com/SWI-Prolog/docker-swipl-build-mingw.git
#
# Comment to build locally. See README.win32 for the setup. Be warned,
# this is complicated! Disabled profile guide optimization for Windows
# as it is broken in recent Ubuntu releases. Linking the instrumented
# binary fails due to a missing symbols in libgcov.a. The Docker is
# based on Fedora.
MINGW_DOCKER_DIR=$HOME/src/docker/docker-swipl-build-mingw
build_win32()
{ if [ ! -z "$MINGW_DOCKER_DIR" ]; then
make -C $MINGW_DOCKER_DIR SWIPLSRC=$HOME/src/swipl win32
else
rm -rf build.win32
mkdir build.win32
( cd build.win32
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=../cmake/cross/linux_win32.cmake \
-DJAVA_COMPATIBILITY=ON \
-G Ninja ..
ninja
cpack
)
fi
}
build_win64()
{ if [ ! -z "$MINGW_DOCKER_DIR" ]; then
make -C $MINGW_DOCKER_DIR SWIPLSRC=$HOME/src/swipl win64
else
rm -rf build.win64
mkdir build.win64
( cd build.win64
cmake -DCMAKE_BUILD_TYPE=Release \
-DJAVA_HOME="$HOME/.wine/drive_c/Program Files/Java/jdk-13.0.2" \
-DCMAKE_TOOLCHAIN_FILE=../cmake/cross/linux_win64.cmake \
-DJAVA_COMPATIBILITY=ON \
-G Ninja ..
ninja
cpack
)
fi
}
# Used on the M1 where we build using Clang and Qt 6.2.2
build_macosx()
{ rm -rf build.macosx
mkdir build.macosx
( cd build.macosx
export PATH=$HOME/deps/bin:$HOME/Qt/6.2.2/macos/bin:$PATH
MACOSX_DEPLOYMENT_TARGET=10.14 \
cmake -DCMAKE_BUILD_TYPE=Release \
-DUSE_GMP=OFF \
-DMACOSX_DEPENDENCIES_FROM=$HOME/deps \
-DBUILD_MACOS_BUNDLE=ON \
-DJAVA_COMPATIBILITY=ON \
-G Ninja ..
ninja
cpack
)
}
build_macos_universal_binary()
{ rm -rf build.macosx-fat
mkdir build.macosx-fat
( cd build.macosx-fat
export PATH=$HOME/deps/bin:$HOME/Qt/6.2.2/macos/bin:$PATH
CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64" \
MACOSX_DEPLOYMENT_TARGET=10.14 \
cmake -DCMAKE_BUILD_TYPE=Release \
-DUSE_GMP=OFF \
-DMACOSX_DEPENDENCIES_FROM=$HOME/deps \
-DMACOS_UNIVERSAL_BINARY=ON \
-DBUILD_MACOS_BUNDLE=ON \
-DJAVA_COMPATIBILITY=ON \
-G Ninja ..
ninja
cpack
)
}
# Use gcc 11 from Macport `port install gcc11`
build_macosx_gcc()
{ rm -rf build.macosx-gcc
mkdir build.macosx-gcc
( cd build.macosx-gcc
export PATH=$HOME/deps/bin:$PATH
export CC=gcc-mp-11
MACOSX_DEPLOYMENT_TARGET=10.14 \
cmake -DCMAKE_BUILD_TYPE=PGO \
-DMACOSX_DEPENDENCIES_FROM=$HOME/deps \
-DBUILD_MACOS_BUNDLE=ON \
-DJAVA_COMPATIBILITY=ON \
-G Ninja ..
ninja
cpack
)
}
build_source()
{ ./scripts/make-src-tape
}
build_PPAs()
{ git branch -D ppa || true
git checkout -b ppa
for distro in $(./scripts/make-ppa --list-distros); do
./scripts/make-ppa --distro=$distro --push
done
git checkout master
git submodule update debian
}
build()
{ if [ $(uname) = Darwin ]; then
if uname -a | grep arm64 > /dev/null; then
build_macos_universal_binary
else
build_macosx_gcc
fi
else
build_pdf
build_win32
build_win64
build_source
build_PPAs
fi
}
################
# Uploading
upload_file()
{ if [ -f "$2" ]; then
rsync -Pvu "$2" ${PUBLIC}/$1
fi
}
upload_win32()
{ upload_file bin build.win32/swipl-${version}-1.x86.exe
}
upload_win64()
{ upload_file bin build.win64/swipl-${version}-1.x64.exe
}
upload_macosx()
{ if [ -f build.macosx-fat/swipl-${version}-1.fat.dmg ]; then
echo "Uploading universal binary version"
upload_file bin build.macosx-fat/swipl-${version}-1.fat.dmg
elif [ -f build.macosx-gcc/swipl-${version}-1.x86_64.dmg ]; then
echo "Uploading fast GCC version"
upload_file bin build.macosx-gcc/swipl-${version}-1.x86_64.dmg
else
echo "WARNING: uploading slow Clang version"
upload_file bin build.macosx/swipl-${version}-1.x86_64.dmg
fi
}
upload_pdf()
{ upload_file doc build.pdf/man/SWI-Prolog-$version.pdf
}
upload_src()
{ upload_file src ../swipl-$version.tar.gz
}
upload()
{ if [ $(uname) = Darwin ]; then
upload_macosx
else
upload_win32
upload_win64
upload_pdf
upload_src
fi
}
|