lol

efficient-compression-tool: 0.9.1 -> 0.9.5 (#412472)

authored by

Peder Bergebakken Sundt and committed by
GitHub
f7cbcfd0 168a5100

+38 -123
+38 -15
pkgs/by-name/ef/efficient-compression-tool/package.nix
··· 6 6 cmake, 7 7 nasm, 8 8 libpng, 9 + nix-update-script, 10 + versionCheckHook, 9 11 }: 10 12 11 - stdenv.mkDerivation rec { 13 + stdenv.mkDerivation (finalAttrs: { 12 14 pname = "efficient-compression-tool"; 13 - version = "0.9.1"; 15 + version = "0.9.5"; 14 16 15 17 src = fetchFromGitHub { 16 18 owner = "fhanau"; 17 19 repo = "Efficient-Compression-Tool"; 18 - rev = "v${version}"; 19 - hash = "sha256-TSV5QXf6GuHAwQrde3Zo9MA1rtpAhtRg0UTzMkBnHB8="; 20 + tag = "v${finalAttrs.version}"; 21 + hash = "sha256-mlqRDYwgLiB/mRaXkkPTCLiDGxTXqEgu5Nz5jhr1Hsg="; 20 22 fetchSubmodules = true; 21 23 }; 22 24 25 + # devendor libpng 26 + postPatch = '' 27 + substituteInPlace src/CMakeLists.txt \ 28 + --replace-fail 'if(EXISTS "''${CMAKE_SOURCE_DIR}/../.git" AND NOT EXISTS "''${CMAKE_SOURCE_DIR}/../src/libpng/README")' 'if(False)' \ 29 + --replace-fail 'file(COPY ''${CMAKE_SOURCE_DIR}/pngusr.h DESTINATION ''${CMAKE_SOURCE_DIR}/libpng/)' "" 30 + substituteInPlace src/optipng/CMakeLists.txt \ 31 + --replace-fail 'set(PNG_BUILD_ZLIB ON CACHE BOOL "use custom zlib within libpng" FORCE)' "" \ 32 + --replace-fail 'add_subdirectory(../libpng libpng EXCLUDE_FROM_ALL)' "" \ 33 + --replace-fail 'png_static)' 'png)' 34 + substituteInPlace src/optipng/image.h src/optipng/trans.h \ 35 + --replace-fail '#include "../libpng/png.h"' '#include <png.h>' 36 + substituteInPlace src/optipng/opngreduc/opngreduc.h \ 37 + --replace-fail '#include "../../libpng/png.h"' '#include <png.h>' 38 + ''; 39 + 23 40 nativeBuildInputs = [ 24 41 cmake 25 42 nasm 26 43 ]; 27 - 28 - patches = [ ./use-nixpkgs-libpng.patch ]; 29 44 30 45 buildInputs = [ 31 46 boost ··· 36 51 37 52 cmakeFlags = [ "-DECT_FOLDER_SUPPORT=ON" ]; 38 53 39 - CXXFLAGS = [ 40 - # GCC 13: error: 'uint32_t' does not name a type 41 - "-include cstdint" 42 - ]; 54 + doInstallCheck = true; 55 + nativeInstallCheckInputs = [ versionCheckHook ]; 56 + versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}"; 57 + versionCheckProgramArg = "-help"; 58 + 59 + passthru = { 60 + updateScript = nix-update-script { }; 61 + }; 43 62 44 - meta = with lib; { 63 + meta = { 45 64 description = "Fast and effective C++ file optimizer"; 46 65 homepage = "https://github.com/fhanau/Efficient-Compression-Tool"; 47 - license = licenses.asl20; 48 - maintainers = [ maintainers.lunik1 ]; 49 - platforms = platforms.linux; 66 + changelog = "https://github.com/fhanau/Efficient-Compression-Tool/releases/tag/${finalAttrs.version}"; 67 + license = lib.licenses.asl20; 68 + maintainers = with lib.maintainers; [ 69 + jwillikers 70 + lunik1 71 + ]; 72 + platforms = lib.platforms.all; 50 73 mainProgram = "ect"; 51 74 }; 52 - } 75 + })
-108
pkgs/by-name/ef/efficient-compression-tool/use-nixpkgs-libpng.patch
··· 1 - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt 2 - index d18843c..a9df1fb 100644 3 - --- a/src/CMakeLists.txt 4 - +++ b/src/CMakeLists.txt 5 - @@ -8,11 +8,6 @@ if(NOT CMAKE_BUILD_TYPE) 6 - set(CMAKE_BUILD_TYPE Release) 7 - endif() 8 - 9 - -# Check that submodules are present only if source was downloaded with git 10 - -if(EXISTS "${CMAKE_SOURCE_DIR}/../.git" AND NOT EXISTS "${CMAKE_SOURCE_DIR}/../src/libpng/README") 11 - - message (FATAL_ERROR "Submodules are not initialized. Run \n\tgit submodule update --init --recursive\n within the repository") 12 - -endif() 13 - - 14 - add_executable(ect 15 - main.cpp 16 - gztools.cpp 17 - @@ -56,7 +51,6 @@ add_subdirectory(lodepng EXCLUDE_FROM_ALL) 18 - add_subdirectory(miniz EXCLUDE_FROM_ALL) 19 - add_subdirectory(zlib EXCLUDE_FROM_ALL) 20 - add_subdirectory(zopfli EXCLUDE_FROM_ALL) 21 - -file(COPY ${CMAKE_SOURCE_DIR}/pngusr.h DESTINATION ${CMAKE_SOURCE_DIR}/libpng/) 22 - add_subdirectory(optipng EXCLUDE_FROM_ALL) 23 - # Mozjpeg changes the install prefix if it thinks the current is defaulted 24 - set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE) 25 - diff --git a/src/Makefile b/src/Makefile 26 - index cc24367..7aa9f0a 100755 27 - --- a/src/Makefile 28 - +++ b/src/Makefile 29 - @@ -18,7 +18,7 @@ CXXSRC = support.cpp zopflipng.cpp zopfli/deflate.cpp zopfli/zopfli_gzip.cpp zop 30 - lodepng/lodepng.cpp lodepng/lodepng_util.cpp optipng/codec.cpp optipng/optipng.cpp jpegtran.cpp gztools.cpp \ 31 - leanify/zip.cpp leanify/leanify.cpp 32 - 33 - -.PHONY: libpng mozjpeg deps bin all install 34 - +.PHONY: mozjpeg deps bin all install 35 - all: deps bin 36 - 37 - bin: deps 38 - @@ -33,9 +33,6 @@ libz.a: 39 - cd zlib/; \ 40 - $(CC) $(UCFLAGS) -c adler32.c crc32.c deflate.c inffast.c inflate.c inftrees.c trees.c zutil.c gzlib.c gzread.c; \ 41 - ar rcs ../libz.a adler32.o crc32.o deflate.o inffast.o inflate.o inftrees.o trees.o zutil.o gzlib.o gzread.o 42 - -libpng: 43 - - cp pngusr.h libpng/pngusr.h 44 - - make -C libpng/ -f scripts/makefile.linux-opt CC="$(CC)" CFLAGS="$(UCFLAGS) -DPNG_USER_CONFIG -Wno-macro-redefined" libpng.a 45 - mozjpeg: 46 - cd mozjpeg/; \ 47 - export CC="$(CC)"; \ 48 - diff --git a/src/optipng/CMakeLists.txt b/src/optipng/CMakeLists.txt 49 - index 1037a20..3c751e9 100644 50 - --- a/src/optipng/CMakeLists.txt 51 - +++ b/src/optipng/CMakeLists.txt 52 - @@ -16,16 +16,14 @@ add_library(optipng 53 - add_library(optipng::optipng ALIAS optipng) 54 - 55 - #make sure that we are using custom zlib and custom libpng options 56 - -set(PNG_BUILD_ZLIB ON CACHE BOOL "use custom zlib within libpng" FORCE) 57 - set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../zlib/ CACHE FILEPATH "custom zlib directory" FORCE) 58 - if(NOT WIN32) 59 - add_compile_options(-Wno-macro-redefined) 60 - endif() 61 - add_compile_definitions(PNG_USER_CONFIG) 62 - 63 - -add_subdirectory(../libpng libpng EXCLUDE_FROM_ALL) 64 - target_link_libraries(optipng 65 - - png_static) 66 - + png) 67 - 68 - # libpng generates some header files that we need to be able to include 69 - target_include_directories(optipng 70 - diff --git a/src/optipng/image.h b/src/optipng/image.h 71 - index c439f84..8255fa0 100755 72 - --- a/src/optipng/image.h 73 - +++ b/src/optipng/image.h 74 - @@ -13,7 +13,7 @@ 75 - #ifndef OPNGCORE_IMAGE_H 76 - #define OPNGCORE_IMAGE_H 77 - 78 - -#include "../libpng/png.h" 79 - +#include <png.h> 80 - 81 - #ifdef __cplusplus 82 - extern "C" { 83 - diff --git a/src/optipng/opngreduc/opngreduc.h b/src/optipng/opngreduc/opngreduc.h 84 - index a7e6553..06ef956 100755 85 - --- a/src/optipng/opngreduc/opngreduc.h 86 - +++ b/src/optipng/opngreduc/opngreduc.h 87 - @@ -13,7 +13,7 @@ 88 - 89 - #include <stdbool.h> 90 - 91 - -#include "../../libpng/png.h" 92 - +#include <png.h> 93 - 94 - 95 - #ifdef __cplusplus 96 - diff --git a/src/optipng/trans.h b/src/optipng/trans.h 97 - index a2f7f3e..c0e8dc4 100755 98 - --- a/src/optipng/trans.h 99 - +++ b/src/optipng/trans.h 100 - @@ -13,7 +13,7 @@ 101 - #ifndef OPNGTRANS_TRANS_H 102 - #define OPNGTRANS_TRANS_H 103 - 104 - -#include "../libpng/png.h" 105 - +#include <png.h> 106 - 107 - #ifdef __cplusplus 108 - extern "C" {