From ce3dce5b07880a55dd615500b9c143ad8a0ca185 Mon Sep 17 00:00:00 2001 From: simon987 Date: Sat, 13 Nov 2021 21:23:21 -0500 Subject: [PATCH] arm64 fix --- Dockerfile | 14 +++++++++----- patches/glib-meson-fix.patch | 18 ++++++++++-------- patches/mupdf-curl-dep.patch | 28 ++++++++++++++++++---------- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index bcc0bae..e448687 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM --platform="linux/arm64/v8" ubuntu:20.04 MAINTAINER simon987 @@ -8,12 +8,11 @@ RUN DEBIAN_FRONTEND="noninteractive" apt install -y pkg-config python3 python3-p yasm ragel automake autotools-dev wget libtool libssl-dev \ curl zip unzip tar xorg-dev libglu1-mesa-dev libxcursor-dev \ libxml2-dev libxinerama-dev libcurl4-openssl-dev gettext \ - gcc g++ git make \ + gcc g++ git make bison \ && apt clean # cmake -RUN wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz && \ - tar -xzf cmake-*.tar.gz && cd cmake-* && ./bootstrap && make -j4 && make install && rm -rf /cmake-* +RUN curl -L https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4-linux-aarch64.tar.gz | tar -xzf - --strip-components=1 -C /usr/ # Ninja RUN git clone git://github.com/ninja-build/ninja.git && \ @@ -31,7 +30,7 @@ RUN cd vcpkg && ./bootstrap-vcpkg.sh ADD patches/* / RUN patch -p0 < mupdf-curl-dep.patch RUN patch -p0 < mongoose-master.patch -RUN patch -p0 < glib-meson-fix.patch +RUN cd /vcpkg/ && patch -p1 < ../glib-meson-fix.patch RUN VCPKG_FORCE_SYSTEM_BINARIES=true ./vcpkg/vcpkg install \ curl[core,openssl] \ @@ -40,3 +39,8 @@ RUN VCPKG_FORCE_SYSTEM_BINARIES=true ./vcpkg/vcpkg install \ RUN mkdir /vcpkg/downloads; VCPKG_FORCE_SYSTEM_BINARIES=true ./vcpkg/vcpkg install \ lmdb cjson glib brotli libarchive[core,bzip2,libxml2,lz4,lzma,lzo] pthread tesseract libxml2 libmupdf gtest mongoose libuuid libmagic libraw jasper lcms gumbo \ && rm -rf /root/.cache/vcpkg /vcpkg/downloads /vcpkg/buildtrees /vcpkg/downloads + +RUN mkdir -p /debug/lib/ && mkdir -p /include && \ + cp -r /vcpkg/installed/arm64-linux/include/cjson/ /include/ && \ + cp /vcpkg/installed/arm64-linux/debug/lib/libcjson.a /debug/lib/ && \ + cp /vcpkg/installed/arm64-linux/lib/libcjson.a /lib/ diff --git a/patches/glib-meson-fix.patch b/patches/glib-meson-fix.patch index 0e6be18..97d0b59 100644 --- a/patches/glib-meson-fix.patch +++ b/patches/glib-meson-fix.patch @@ -1,11 +1,13 @@ ---- /vcpkg/scripts/cmake/vcpkg_configure_meson.cmake -+++ /vcpkg/scripts/cmake/vcpkg_configure_meson.cmake -@@ -220,7 +220,7 @@ function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https:/ - OUTPUT_VARIABLE MACHINE - COMMAND_ERROR_IS_FATAL ANY) - +diff --git a/scripts/cmake/vcpkg_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake +index e0eab20..4c5d7be 100644 +--- a/scripts/cmake/vcpkg_configure_meson.cmake ++++ b/scripts/cmake/vcpkg_configure_meson.cmake +@@ -241,7 +241,7 @@ function(z_vcpkg_meson_generate_cross_file additional_binaries) #https://mesonbu + # Show real machine architecture to visually understand whether we are in a native Apple Silicon terminal or running under Rosetta emulation + debug_message("Machine: ${MACHINE}") + - if(MACHINE MATCHES "arm64") + if(MACHINE MATCHES "arm64|aarch64") - set(BUILD_CPU_FAM aarch64) - set(BUILD_CPU armv8) + set(build_cpu_fam aarch64) + set(build_cpu armv8) elseif(MACHINE MATCHES "x86_64|amd64") diff --git a/patches/mupdf-curl-dep.patch b/patches/mupdf-curl-dep.patch index 4a2eef8..8ff9114 100644 --- a/patches/mupdf-curl-dep.patch +++ b/patches/mupdf-curl-dep.patch @@ -1,10 +1,18 @@ ---- /vcpkg/ports/libmupdf/CONTROL 2021-04-13 00:31:01.000000000 +0000 -+++ /vcpkg/ports/libmupdf/CONTROL_ 2021-04-13 00:42:40.805239545 +0000 -@@ -1,6 +1,6 @@ - Source: libmupdf - Version: 1.18.0 --Build-Depends: freetype, libjpeg-turbo, harfbuzz, zlib, curl, glfw3, openjpeg, jbig2dec, gumbo -+Build-Depends: freetype, libjpeg-turbo, harfbuzz, zlib, curl[core,openssl], glfw3, openjpeg, jbig2dec, gumbo - Homepage: https://github.com/ArtifexSoftware/mupdf - Description: a lightweight PDF, XPS, and E-book library - Supports: !osx +--- /vcpkg/ports/libmupdf/vcpkg.json 2021-09-22 09:11:22.598136284 -0400 ++++ /vcpkg/ports/libmupdf/vcpkg.json_ 2021-11-07 10:14:38.039574071 -0500 +@@ -5,7 +5,13 @@ + "homepage": "https://github.com/ArtifexSoftware/mupdf", + "supports": "!osx", + "dependencies": [ +- "curl", ++ { ++ "name": "curl", ++ "default-features": false, ++ "features": [ ++ "openssl" ++ ] ++ }, + "freetype", + "glfw3", + "gumbo", +