Skip to content

Commit 376e8e2

Browse files
committed
Custom build
1 parent 2a3134d commit 376e8e2

File tree

4 files changed

+112
-7
lines changed

4 files changed

+112
-7
lines changed

.github/workflows/build-release.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Build Release
22
on:
3-
- push
4-
- pull_request
3+
- workflow_dispatch
4+
# - push
5+
# - pull_request
56
permissions: {}
67
jobs:
78
create-release:

.github/workflows/custom.yml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
on:
2+
workflow_dispatch:
3+
push: # Push a tag to build and create a draft release
4+
tags:
5+
- "*"
6+
7+
name: custom
8+
jobs:
9+
linux:
10+
name: Create vips binary (Linux)
11+
runs-on: ${{ matrix.os }}
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-24.04, ubuntu-24.04-arm]
17+
include:
18+
- os: ubuntu-24.04
19+
arch: x64
20+
- os: ubuntu-24.04-arm
21+
arch: arm64
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Build
28+
run: |
29+
set -e
30+
docker build -t vips-dev-linux platforms/linux-${{ matrix.arch }}
31+
docker run --rm -e VERSION_VIPS=8.16.0 -e VERSION_LATEST_REQUIRED=false -v $(pwd):/packaging vips-dev-linux /packaging/build/lin.sh
32+
cp vips vips-${{ matrix.arch }}
33+
34+
- name: Upload artifacts
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: vips-${{ matrix.arch }}
38+
path: vips-${{ matrix.arch }}
39+
40+
- name: Create a draft GitHub release
41+
uses: ncipollo/release-action@v1
42+
with:
43+
artifacts: vips-${{ matrix.arch }}
44+
draft: true
45+
allowUpdates: true
46+
updateOnlyUnreleased: true
47+
48+
windows:
49+
name: Create vips binary (Windows)
50+
runs-on: ubuntu-24.04
51+
52+
strategy:
53+
# This build takes LOOONG. Currently there is no binary release for mxe
54+
# that works with build-win64-mxe, and building the complier itself takes
55+
# multiple hours on a decent machine, so whether on not they'll work on a
56+
# GitHub action is iffy. Even upstream build-win64-mxe doesn't use GitHub
57+
# actions, they seem to run the build elsewhere and then upload binaries.
58+
#
59+
# 1. Instead of instead of running them in the same container sequentially
60+
# and risk a timeout, run them in parallel runners.
61+
# 2. Use a custom fork with trimmed deps.
62+
# 3. Pray I didn't make a typo in the artifact paths.
63+
#
64+
fail-fast: false
65+
matrix:
66+
arch: [x86_64, aarch64]
67+
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
72+
- name: Build
73+
run: |
74+
set -e
75+
git clone --depth 1 https://github.com/ente-io/build-win64-mxe
76+
cd build-win64-mxe
77+
docker build -t libvips-build-win-mxe container
78+
docker run --rm -v $(pwd)/build:/data --entrypoint /bin/bash libvips-build-win-mxe /data/custom.sh ${{ matrix.arch }}
79+
cp build/vips.exe vips-${{ matrix.arch }}.exe
80+
81+
- name: Upload artifacts
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: vips-${{ matrix.arch }}.exe
85+
path: vips-${{ matrix.arch }}.exe
86+
87+
- name: Create a draft GitHub release
88+
uses: ncipollo/release-action@v1
89+
with:
90+
artifacts: vips-${{ matrix.arch }}.exe
91+
draft: true
92+
allowUpdates: true
93+
updateOnlyUnreleased: true

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
libvips*
2+
vips-*
23
*.log
34
deps/
45
target/

build/lin.sh

+15-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ case ${PLATFORM} in
99
TARGET=/target
1010
PACKAGE=/packaging
1111
ROOT=/root
12-
VIPS_CPP_DEP=libvips-cpp.so.42
12+
VIPS_CPP_DEP=libvips.a
1313
;;
1414
osx*)
1515
DARWIN=true
@@ -271,14 +271,22 @@ AOM_AS_FLAGS="${FLAGS}" cmake -G"Unix Makefiles" \
271271
..
272272
make install/strip
273273

274+
cd ${DEPS}
275+
git clone --depth 1 https://github.com/strukturag/libde265.git
276+
cd ${DEPS}/libde265
277+
CFLAGS="${CFLAGS} -O3" CXXFLAGS="${CXXFLAGS} -O3" cmake -G"Unix Makefiles" \
278+
-DCMAKE_TOOLCHAIN_FILE=${ROOT}/Toolchain.cmake -DCMAKE_INSTALL_PREFIX=${TARGET} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release \
279+
-DBUILD_SHARED_LIBS=FALSE
280+
make install
281+
274282
mkdir ${DEPS}/heif
275283
$CURL https://github.com/strukturag/libheif/releases/download/v${VERSION_HEIF}/libheif-${VERSION_HEIF}.tar.gz | tar xzC ${DEPS}/heif --strip-components=1
276284
cd ${DEPS}/heif
277285
# Downgrade minimum required CMake version to 3.12 - https://github.com/strukturag/libheif/issues/975
278286
sed -i'.bak' "/^cmake_minimum_required/s/3.16.3/3.12/" CMakeLists.txt
279287
CFLAGS="${CFLAGS} -O3" CXXFLAGS="${CXXFLAGS} -O3" cmake -G"Unix Makefiles" \
280288
-DCMAKE_TOOLCHAIN_FILE=${ROOT}/Toolchain.cmake -DCMAKE_INSTALL_PREFIX=${TARGET} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release \
281-
-DBUILD_SHARED_LIBS=FALSE -DBUILD_TESTING=0 -DENABLE_PLUGIN_LOADING=0 -DWITH_EXAMPLES=0 -DWITH_LIBDE265=0 -DWITH_X265=0
289+
-DBUILD_SHARED_LIBS=FALSE -DBUILD_TESTING=0 -DENABLE_PLUGIN_LOADING=0 -DWITH_EXAMPLES=0 -DWITH_LIBDE265=1 -DWITH_X265=0
282290
make install/strip
283291
if [ "$PLATFORM" == "linux-arm" ]; then
284292
# Remove -lstdc++ from Libs.private, it won't work with -static-libstdc++
@@ -468,8 +476,8 @@ if [ "$LINUX" = true ]; then
468476
printf "{local:g_param_spec_types;};" > vips.map
469477
fi
470478
# Disable building man pages, gettext po files, tools, and (fuzz-)tests
471-
sed -i'.bak' "/subdir('man')/{N;N;N;N;d;}" meson.build
472-
CFLAGS="${CFLAGS} -O3" CXXFLAGS="${CXXFLAGS} -O3" meson setup _build --default-library=shared --buildtype=release --strip --prefix=${TARGET} ${MESON} \
479+
# sed -i'.bak' "/subdir('man')/{N;N;N;N;d;}" meson.build
480+
CFLAGS="${CFLAGS} -O3" CXXFLAGS="${CXXFLAGS} -O3" meson setup _build --default-library=static --buildtype=release --strip --prefix=${TARGET} ${MESON} \
473481
-Ddeprecated=false -Dexamples=false -Dintrospection=disabled -Dmodules=disabled -Dcfitsio=disabled -Dfftw=disabled -Djpeg-xl=disabled \
474482
-Dmagick=disabled -Dmatio=disabled -Dnifti=disabled -Dopenexr=disabled -Dopenjpeg=disabled -Dopenslide=disabled \
475483
-Dpdfium=disabled -Dpoppler=disabled -Dquantizr=disabled \
@@ -525,7 +533,7 @@ function copydeps {
525533
}
526534

527535
cd ${TARGET}/lib
528-
if [ "$LINUX" = true ]; then
536+
if [ "disable-$LINUX" = true ]; then
529537
# Check that we really linked with -z nodelete
530538
readelf -Wd libvips.so.42 | grep -qF NODELETE || (echo "libvips.so.42 was not linked with -z nodelete" && exit 1)
531539
fi
@@ -588,3 +596,5 @@ tar chzf ${PACKAGE}/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz \
588596

589597
# Allow tarballs to be read outside container
590598
chmod 644 ${PACKAGE}/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz
599+
600+
cp bin/vips ${PACKAGE}

0 commit comments

Comments
 (0)