Skip to content

mksb.jxl

mksb.jxl #3

Workflow file for this run

name: mksb.jxl
on:
workflow_dispatch:
jobs:
linux-x64:
runs-on: ubuntu-22.04
steps:
- name: Build
shell: sudo bash -e {0}
run: |
printf 'APT::Install-Recommends "false";\nAPT::Install-Suggests "false";\n' > /etc/apt/apt.conf.d/no-recommends-suggests
apt update
apt install -y g++ cmake ninja-build pkg-config libbrotli-dev libgif-dev libjpeg-dev libopenexr-dev libpng-dev
git init
git remote add origin https://github.com/libjxl/libjxl
git fetch origin --depth=1 b2fb216cd7e3e690544c53d1ae8fba3b9f97eab6
git reset --hard FETCH_HEAD
git submodule update --init --recursive --depth 1 --recommend-shallow
rm -rf .git
cat <<EOF >tools/multicall.cc
#include <stddef.h>
#include <string.h>
#include "jxlinfo.c"
#include "cjxl_main.cc"
#include "djxl_main.cc"
#include "cjpegli.cc"
#include "djpegli.cc"
int main(int argc, const char *argv[]) {
if (argc <= 0) {
return 1;
}
const char *argv0 = strrchr(argv[0], '/');
if (argv0 == NULL) {
argv0 = argv[0];
} else {
argv0++;
}
before:
if (argc <= 0) {
return 1;
} else if (strcmp(argv0, "jxlinfo") == 0) {
return cmd_jxlinfo_main(argc, argv);
} else if (strcmp(argv0, "cjxl") == 0) {
return cmd_cjxl_main(argc, argv);
} else if (strcmp(argv0, "djxl") == 0) {
return cmd_djxl_main(argc, argv);
} else if (strcmp(argv0, "cjpegli") == 0) {
return cmd_cjpegli_main(argc, argv);
} else if (strcmp(argv0, "djpegli") == 0) {
return cmd_djpegli_main(argc, argv);
} else {
argv++;
argc--;
if (argc <= 0) {
return 1;
}
argv0 = strrchr(argv[0], '/');
if (argv0 == NULL) {
argv0 = argv[0];
} else {
argv0++;
}
goto before;
}
return 0;
}
EOF
sed -i tools/jxlinfo.c -e 's|name = malloc|name = (char*)malloc|g'
sed -i tools/jxlinfo.c -e 's|int main(|int cmd_jxlinfo_main(int argc, const char** argv){//|'
sed -i tools/cjxl_main.cc -e 's|int main(|int cmd_cjxl_main(int argc, const char** argv){//|'
sed -i tools/djxl_main.cc -e 's|int main(|int cmd_djxl_main(int argc, const char** argv){//|'
sed -i tools/cjpegli.cc -e 's|int main(|int cmd_cjpegli_main(|'
sed -i tools/cjpegli.cc -e 's|namespace {|namespace cjpegli{|'
sed -i tools/cjpegli.cc -e 's|jpegxl::tools::CJpegliMain|jpegxl::tools::cjpegli::CJpegliMain|'
sed -i tools/djpegli.cc -e 's|int main(|int cmd_djpegli_main(|'
sed -i tools/djpegli.cc -e 's|namespace {|namespace djpegli{|'
sed -i tools/djpegli.cc -e 's|jpegxl::tools::DJpegliMain|jpegxl::tools::djpegli::DJpegliMain|'
sed -i tools/CMakeLists.txt -e 's|# Main compressor.|add_executable\(multicall multicall.cc\)\ntarget_link_libraries\(multicall jxl jxl_extras_codec jxl_extras-internal jxl_threads jxl_tool\)\nendif\(\)\nif\(0\)|'
# curl https://ziglang.org/builds/zig-linux-x86_64-0.13.0-dev.46+3648d7df1.tar.xz | tar -Jx
# mv zig-* zig
# export CC="$(realpath zig/zig) cc -target x86_64-linux-musl -I $(realpath debdeps/usr/include) -L $(realpath debdeps/usr/lib)"
# export CXX="$(realpath zig/zig) c++ -target x86_64-linux-musl -I $(realpath debdeps/usr/include) -L $(realpath debdeps/usr/lib)"
# https://github.com/ziglang/zig/issues/18074
# mkdir -p debdeps
# curl -o debdeps/zlib1g-dev_amd64.deb -L http://ftp.debian.org/debian/pool/main/z/zlib/zlib1g-dev_1.3.dfsg-3.1_amd64.deb
# dpkg -x debdeps/zlib1g-dev_amd64.deb debdeps
# curl -o debdeps/libjpeg62-turbo-dev_amd64.deb -L http://ftp.us.debian.org/debian/pool/main/libj/libjpeg-turbo/libjpeg62-turbo-dev_2.1.5-3_amd64.deb
# dpkg -x debdeps/libjpeg62-turbo-dev_amd64.deb debdeps
# apt install -y g++-mingw-w64-x86-64-win32
# export CC="x86_64-w64-mingw32-gcc"
# export CXX="x86_64-w64-mingw32-g++"
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_FIND_LIBRARY_SUFFIXES=".a" -DJPEGXL_STATIC=ON -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=OFF -DJPEGXL_ENABLE_VIEWERS=OFF -DJPEGXL_ENABLE_PLUGINS=OFF -DJPEGXL_ENABLE_OPENEXR=OFF -DJPEGXL_ENABLE_DEVTOOLS=ON
cmake --build build
mv build/tools/multicall ./jxl
strip ./jxl
zip -9 linux-x64.zip jxl
- name: Verify
run: |
ldd ./jxl || true
./jxl cjxl -V
- name: Release
uses: softprops/action-gh-release@v2
with:
body: "_"
tag_name: "${{ 'mksb.jxl_b2fb216_' }}${{ github.run_id }}"
files: linux-x64.zip