From 13a225c6ab4c20e7f62c3463be64b3075ffb9c50 Mon Sep 17 00:00:00 2001 From: glachancecmaisonneuve Date: Thu, 5 Oct 2017 12:15:42 -0400 Subject: mozjpeg initial port --- ports/mozjpeg/CONTROL | 3 +++ ports/mozjpeg/portfile.cmake | 49 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 ports/mozjpeg/CONTROL create mode 100644 ports/mozjpeg/portfile.cmake diff --git a/ports/mozjpeg/CONTROL b/ports/mozjpeg/CONTROL new file mode 100644 index 000000000..8afc065b3 --- /dev/null +++ b/ports/mozjpeg/CONTROL @@ -0,0 +1,3 @@ +Source: mozjpeg +Version: 3.2 +Description: MozJPEG reduces file sizes of JPEG images while retaining quality and compatibility with the vast majority of the world's deployed decoders. It's compatible with libjpeg API and ABI, and can be used as a drop-in replacement for libjpeg. diff --git a/ports/mozjpeg/portfile.cmake b/ports/mozjpeg/portfile.cmake new file mode 100644 index 000000000..d95f83ff8 --- /dev/null +++ b/ports/mozjpeg/portfile.cmake @@ -0,0 +1,49 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mozjpeg-3.2) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/mozilla/mozjpeg/archive/v3.2.zip" + FILENAME "mozjpeg.zip" + SHA512 a1ba53dea3e04add46616918b5e96f2c8102ef65856596f1794df29c8be27db3d9fb13e7ffc864d23626f98dff5a6b47315903cae9ae41f9905aef2cc91af0c5 +) + +vcpkg_find_acquire_program(NASM) +get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY) +set(ENV{PATH} "$ENV{PATH};${NASM_EXE_PATH}") + +vcpkg_extract_source_archive(${ARCHIVE}) + +if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static) + set(OPTIONS "-DENABLE_SHARED=FALSE") +else() + set(OPTIONS "-DENABLE_STATIC=FALSE") +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS ${OPTIONS} +) + +vcpkg_install_cmake() + +#remove extra debug files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/doc) +file(GLOB DEBUGEXES ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe) +file(REMOVE ${DEBUGEXES}) + +#move exes to tools +file(GLOB EXES ${CURRENT_PACKAGES_DIR}/bin/*.exe) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools) +file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +file(REMOVE ${EXES}) + +#remove empty fodlers after static build +if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/mozjpeg RENAME copyright) +vcpkg_copy_pdbs() \ No newline at end of file -- cgit v1.2.3 From 049ad42779176fba38a79ec4c1344fcd2d058dbc Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 6 Oct 2017 14:06:43 -0700 Subject: [mozjpeg] Use vcpkg_from_github and vcpkg_copy_tool_dependencies --- ports/mozjpeg/CONTROL | 2 +- ports/mozjpeg/portfile.cmake | 33 +++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ports/mozjpeg/CONTROL b/ports/mozjpeg/CONTROL index 8afc065b3..9e3f19b4c 100644 --- a/ports/mozjpeg/CONTROL +++ b/ports/mozjpeg/CONTROL @@ -1,3 +1,3 @@ Source: mozjpeg -Version: 3.2 +Version: 3.2-1 Description: MozJPEG reduces file sizes of JPEG images while retaining quality and compatibility with the vast majority of the world's deployed decoders. It's compatible with libjpeg API and ABI, and can be used as a drop-in replacement for libjpeg. diff --git a/ports/mozjpeg/portfile.cmake b/ports/mozjpeg/portfile.cmake index d95f83ff8..52011d394 100644 --- a/ports/mozjpeg/portfile.cmake +++ b/ports/mozjpeg/portfile.cmake @@ -1,27 +1,30 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mozjpeg-3.2) -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/mozilla/mozjpeg/archive/v3.2.zip" - FILENAME "mozjpeg.zip" - SHA512 a1ba53dea3e04add46616918b5e96f2c8102ef65856596f1794df29c8be27db3d9fb13e7ffc864d23626f98dff5a6b47315903cae9ae41f9905aef2cc91af0c5 + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mozilla/mozjpeg + REF v3.2 + SHA512 d14789827a9f4f78139a3945d3169d37eb891758b5ab40ef19e99ebebb2fb6d7c3a05495de245bba54cfd913b153af352159aa9fc0218127f97819137e0f1ab8 + HEAD_REF master ) vcpkg_find_acquire_program(NASM) get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY) set(ENV{PATH} "$ENV{PATH};${NASM_EXE_PATH}") -vcpkg_extract_source_archive(${ARCHIVE}) - -if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) set(OPTIONS "-DENABLE_SHARED=FALSE") else() set(OPTIONS "-DENABLE_STATIC=FALSE") endif() +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" WITH_CRT_DLL) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA - OPTIONS ${OPTIONS} + OPTIONS + ${OPTIONS} + -DWITH_CRT_DLL=${WITH_CRT_DLL} ) vcpkg_install_cmake() @@ -34,12 +37,14 @@ file(REMOVE ${DEBUGEXES}) #move exes to tools file(GLOB EXES ${CURRENT_PACKAGES_DIR}/bin/*.exe) -file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools) -file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/mozjpeg) +file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/mozjpeg) file(REMOVE ${EXES}) -#remove empty fodlers after static build -if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static) +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/mozjpeg) + +#remove empty folders after static build +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) endif() -- cgit v1.2.3