Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ libvips*
sharp-libvips*
*.log
build/wasm-vips-*
build-win64-mxe/
deps/
target/
npm/*/*
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ the same shared libraries within multiple containers.

### Windows

The output of libvips' [build-win64-mxe](https://github.com/libvips/build-win64-mxe)
static "web" releases are [post-processed](build/win.sh) within a [container](platforms/win32/Dockerfile).
The [Windows build script](build/win.sh) runs on Linux and uses the
[build-win64-mxe](https://github.com/libvips/build-win64-mxe) repo
to cross-compile the "web" group of dependencies into static binaries.

### macOS

Expand Down
3 changes: 1 addition & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ fi
for flavour in win32-x64 win32-arm64v8; do
if [ $PLATFORM = "all" ] || [ $PLATFORM = $flavour ]; then
echo "Building $flavour..."
docker build --pull -t vips-dev-win32 platforms/win32
docker run --rm -e "PLATFORM=${flavour}" -v $PWD:/packaging vips-dev-win32 sh -c "/packaging/build/win.sh"
PLATFORM=$flavour ./build/win.sh
fi
done

Expand Down
47 changes: 20 additions & 27 deletions build/win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,44 @@ set -e
## SPDX-License-Identifier: Apache-2.0

# Dependency version numbers
source /packaging/versions.properties
source ./versions.properties

VERSION_VIPS_SHORT=${VERSION_VIPS%.[[:digit:]]*}

# Common options for curl
CURL="curl --silent --location --retry 3 --retry-max-time 30"

# Fetch and unzip
mkdir /vips
cd /vips

case ${PLATFORM} in
*arm64v8)
ARCH=arm64
MXE_TARGET=aarch64
;;
*x64)
ARCH=x64
MXE_TARGET=x86_64
;;
esac

FILENAME="vips-dev-${ARCH}-web-${VERSION_VIPS}-static.zip"
URL="https://github.com/libvips/build-win64-mxe/releases/download/v${VERSION_VIPS}/${FILENAME}"
echo "Downloading $URL"
$CURL -O $URL
unzip $FILENAME

# Clean and zip
cd /vips/vips-dev-${VERSION_VIPS_SHORT}
rm bin/libvips-cpp-42.dll
cp bin/*.dll lib/
if [ ! -d "build-win64-mxe" ]; then
git clone https://github.com/libvips/build-win64-mxe.git
fi

# Add third-party notices
$CURL -O https://raw.githubusercontent.com/lovell/sharp-libvips/main/THIRD-PARTY-NOTICES.md
echo "Building libvips ${VERSION_VIPS} for ${MXE_TARGET}"
cd build-win64-mxe
git checkout master
git pull
./build.sh vips-web --target $MXE_TARGET-w64-mingw32.static --ref v${VERSION_VIPS}

echo "Creating tarball"
tar czf /packaging/sharp-libvips-${PLATFORM}.tar.gz \
COMMIT_SHA=$(git ls-remote --heads --tags --refs https://github.com/libvips/libvips.git v${VERSION_VIPS} | cut -c1-7)
mkdir -p "output"
unzip -oq "packaging/vips-dev-${ARCH}-web-${COMMIT_SHA}-static.zip" -d "output"
cd "output/vips-dev-${COMMIT_SHA}"
rm bin/libvips-cpp-42.dll
cp bin/*.dll lib/
cp ../../../THIRD-PARTY-NOTICES.md .
sed -i "s/${COMMIT_SHA}/${VERSION_VIPS}/g" versions.json
tar czf "../../../sharp-libvips-${PLATFORM}.tar.gz" \
include \
lib/glib-2.0 \
lib/libvips.lib \
lib/*.dll \
*.json \
THIRD-PARTY-NOTICES.md

# Allow tarballs to be read outside container
chmod 644 /packaging/sharp-libvips-${PLATFORM}.tar.*

# Remove working directories
rm -rf lib include *.json THIRD-PARTY-NOTICES.md
9 changes: 0 additions & 9 deletions platforms/win32/Dockerfile

This file was deleted.

Loading