From c0d6fc23c1caf83a4e293096da11f2f3d449e4d4 Mon Sep 17 00:00:00 2001 From: simon987 Date: Fri, 24 Apr 2020 05:58:24 -0400 Subject: [PATCH] [libmupdf] fix build error on Linux (#10708) * minimum to compile on linux * Update as reviewed * Update baseline and add the condition to execuate script * Move find_program and make it REQUIRED * always execute generate command * only use make in find_program Co-authored-by: Nancy Li (Beyondsoft Corporation) --- ports/libmupdf/CMakeLists.txt | 21 +++++++++++++++++---- ports/libmupdf/CONTROL | 3 ++- ports/libmupdf/portfile.cmake | 4 +++- scripts/ci.baseline.txt | 1 - 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ports/libmupdf/CMakeLists.txt b/ports/libmupdf/CMakeLists.txt index daafef74c..6800bea9a 100644 --- a/ports/libmupdf/CMakeLists.txt +++ b/ports/libmupdf/CMakeLists.txt @@ -3,26 +3,39 @@ project(libmupdf C) set(CMAKE_DEBUG_POSTFIX d) -if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/mupdf/pdf/name-table.h") +if(WIN32) execute_process( COMMAND "cmd.exe" "/c" "platform\\win32\\generate.bat" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) -endif() +else() + find_program(MAKE_EXE NAMES make REQUIRED) + execute_process( + COMMAND ${MAKE_EXE} "generate" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + ) +endif() + find_package(freetype NO_MODULE REQUIRED) find_package(JPEG REQUIRED) find_path(HARFBUZZ_INCLUDE hb.h PATH_SUFFIXES harfbuzz) find_library(HARFBUZZ_LIBRARIES harfbuzz) find_package(ZLIB REQUIRED) -find_package(openjpeg REQUIRED) +find_package(OpenJPEG CONFIG REQUIRED) find_library(JBIG2DEC_LIB NAMES jbig2decd jbig2dec) file(GLOB_RECURSE SOURCES "source/*.c" "generated/*.c") list(FILTER SOURCES EXCLUDE REGEX "source/tools/[a-z]*\\.c$") +list(FILTER SOURCES EXCLUDE REGEX "source/tests/.*.c$") + add_library(libmupdf ${SOURCES}) -target_compile_definitions(libmupdf PRIVATE -DSHARE_JPEG -DFZ_ENABLE_JS=0 -DFZ_ENABLE_ICC=0) +if(WIN32) + target_compile_definitions(libmupdf PRIVATE -DSHARE_JPEG -DFZ_ENABLE_JS=0 -DFZ_ENABLE_ICC=0) +else() + target_compile_definitions(libmupdf PRIVATE -DSHARE_JPEG -DFZ_ENABLE_JS=0 -DFZ_ENABLE_ICC=0 -DHAVE_PTHREAD=1) +endif() target_include_directories(libmupdf PUBLIC include diff --git a/ports/libmupdf/CONTROL b/ports/libmupdf/CONTROL index bf3348ced..bcf4172e4 100644 --- a/ports/libmupdf/CONTROL +++ b/ports/libmupdf/CONTROL @@ -1,5 +1,6 @@ Source: libmupdf -Version: 1.16.1 +Version: 1.16.1-1 Build-Depends: freetype, libjpeg-turbo, harfbuzz, zlib, curl, glfw3, openjpeg, jbig2dec Homepage: https://github.com/ArtifexSoftware/mupdf Description: a lightweight PDF, XPS, and E-book library +Supports: !osx diff --git a/ports/libmupdf/portfile.cmake b/ports/libmupdf/portfile.cmake index eafef522b..0722fc679 100644 --- a/ports/libmupdf/portfile.cmake +++ b/ports/libmupdf/portfile.cmake @@ -1,4 +1,4 @@ -include(vcpkg_common_functions) +vcpkg_fail_port_install(ON_TARGET "osx") vcpkg_check_linkage(ONLY_STATIC_LIBRARY) @@ -18,6 +18,8 @@ vcpkg_configure_cmake( SOURCE_PATH "${SOURCE_PATH}" DISABLE_PARALLEL_CONFIGURE PREFER_NINJA + OPTIONS + -DBUILD_EXAMPLES=OFF ) vcpkg_install_cmake() diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 4863339fd..490e2a0ff 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -820,7 +820,6 @@ libmodman:x64-uwp=fail libmodman:x64-windows-static=fail libmodplug:arm-uwp=fail libmodplug:x64-uwp=fail -libmupdf:x64-linux=fail libmupdf:x64-osx=fail libmysql:x86-windows=fail libnice:x64-linux=fail