Skip to content

Commit

Permalink
lepton-1.2.1+git20230214
Browse files Browse the repository at this point in the history
  • Loading branch information
fd00 committed Feb 7, 2025
1 parent 3378eb0 commit 9935781
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 61 deletions.
46 changes: 27 additions & 19 deletions lepton/README
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,64 @@ Lepton is a tool and file format for losslessly compressing JPEGs by an average
of 22%.

Runtime requirements:
cygwin-2.11.2-1
libgcc1-7.3.0-3
libstdc++6-7.3.0-3
zlib0-1.2.11-1
cygwin-3.5.7-1
libbrotlidec1-1.1.0-1
libbrotlienc1-1.1.0-1
libgcc1-12.4.0-3
libssl3-3.0.15-1
zlib0-1.3.1-1

Build requirements:
(besides corresponding -devel packages)
autoconf-13-1
automake-10-1
binutils-2.29-1
cmake-3.6.2-1
cygport-0.31.1-1
gcc-core-7.3.0-3
gcc-g++-7.3.0-3
make-4.2.1-2
binutils-2.44-1
cmake-3.28.3-1
cygport-0.36.9-1
gcc-core-12.4.0-3
gcc-g++-12.4.0-3
libbrotli-devel-1.1.0-1
libssl-devel-3.0.15-1
ninja-1.12.1-1
zlib-devel-1.3.1-1

Canonical website:
https://github.com/dropbox/lepton

Canonical download:
https://github.com/dropbox/lepton/archive/1.2.1.tar.gz
https://github.com/dropbox/lepton.git

-------------------------------------------

Build instructions:
1. unpack lepton-1.2.1-X-src.tar.xz
1. unpack lepton-1.2.1+git20230214-X-src.tar.xz
2. if you use setup to install this src package,
it will be unpacked under /usr/src automatically
% cd /usr/src
% cygport ./lepton-1.2.1-X.cygport all
% cygport ./lepton-1.2.1+git20230214-X.cygport all

This will create:
/usr/src/lepton-1.2.1-X-src.tar.xz
/usr/src/lepton-1.2.1-X.tar.xz
/usr/src/lepton-1.2.1+git20230214-X-src.tar.xz
/usr/src/lepton-1.2.1+git20230214-X.tar.xz

-------------------------------------------

Files included in the binary package:

(lepton)
/usr/bin/lepton-avx.exe
/usr/bin/lepton-scalar.exe
/usr/bin/lepton-slow-best-ratio.exe
/usr/bin/lepton.exe
/usr/bin/test_invariants.exe
/usr/share/doc/Cygwin/lepton.README
/usr/share/doc/lepton/AUTHORS
/usr/share/doc/lepton/LICENSE.txt
/usr/share/doc/lepton/LICENSE
/usr/share/doc/lepton/README.md

------------------

Port Notes:

----- version 1.2.1+git20230214-1bl1 -----
Version bump.

----- version 1.2.1-1bl1 -----
Initial release by fd0 <https://github.com/fd00/>
29 changes: 29 additions & 0 deletions lepton/lepton-1.2.1+git20230214-1bl1.cygport
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
HOMEPAGE="https://github.com/dropbox/${PN}"
GIT_URI="https://github.com/dropbox/${PN}.git"
GIT_REV="f34c7f42d2e0d688239cb880648dc152713c4eae"

CATEGORY="Archive"
SUMMARY="tool and file format for losslessly compressing JPEGs by an average of 22%"
DESCRIPTION="Lepton is a tool and file format for losslessly compressing JPEGs by an
average of 22%."

LICENSE="Apache-2.0"
LICENSE_SPDX="SPDX-License-Identifier: Apache-2.0"
LICENSE_URI="LICENSE"

BUILD_REQUIRES="libbrotli-devel libssl-devel zlib-devel"

export CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE"

inherit cmake
inherit git

CYGCMAKE_ARGS="
-DUSE_SYSTEM_DEPENDENCIES:BOOL=ON
"

src_test()
{
cd ${B}
./test_invariants.exe
}
129 changes: 129 additions & 0 deletions lepton/lepton-1.2.1+git20230214-1bl1.src.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
--- origsrc/lepton/CMakeLists.txt 2025-02-07 16:13:59.000000000 +0900
+++ src/lepton/CMakeLists.txt 2025-02-07 17:23:25.078233600 +0900
@@ -60,22 +60,18 @@ else()
set(VECTOR_FLAGS "")
endif()
if(EMSCRIPTEN)
- set(CMAKE_CXX_FLAGS "-std=c++11 -fno-exceptions -fno-rtti -s DEMANGLE_SUPPORT=1 -s TOTAL_MEMORY=184549376 --pre-js pre.js --post-js post.js -O2")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti -s DEMANGLE_SUPPORT=1 -s TOTAL_MEMORY=184549376 --pre-js pre.js --post-js post.js -O2")
else()
- set(CMAKE_CXX_FLAGS "-std=c++11 -fno-exceptions -fno-rtti")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
endif()
-set(CMAKE_C_FLAGS "-std=c99 -DHAVE_CONFIG_H")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_CONFIG_H")

if(WIN32)
-SET(CMAKE_CXX_FLAGS "-D_HAS_EXCEPTIONS=0 -GR-")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_HAS_EXCEPTIONS=0 -GR-")
else()
-SET(CMAKE_CXX_FLAGS "-std=c++11 -fno-exceptions -fno-rtti")
-endif()
-if(WIN32)
-SET(CMAKE_C_FLAGS "-DHAVE_CONFIG_H")
-else()
-SET(CMAKE_C_FLAGS "-std=c99 -DHAVE_CONFIG_H ")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
endif()
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_CONFIG_H")
if(NOT USE_SYSTEM_DEPENDENCIES)
add_library(localmd5 dependencies/md5/md5.c)
add_library(localzlib
@@ -102,7 +98,6 @@ if(NOT USE_SYSTEM_DEPENDENCIES)
dependencies/zlib/inffast.c
dependencies/zlib/uncompr.c
dependencies/zlib/deflate.h)
-endif()
add_library(localbrotli
dependencies/brotli/c/include/brotli/encode.h
dependencies/brotli/c/include/brotli/types.h
@@ -180,15 +175,19 @@ add_library(localbrotli
dependencies/brotli/c/dec/prefix.h
dependencies/brotli/c/dec/port.h
dependencies/brotli/c/dec/decode.c)
+endif()

include_directories(
${CMAKE_BINARY_DIR}
${PROJECT_SOURCE_DIR}/src/vp8/util
- ${PROJECT_SOURCE_DIR}/dependencies/brotli/c/include
${PROJECT_SOURCE_DIR}/src/vp8/model
${PROJECT_SOURCE_DIR}/src/vp8/encoder
${PROJECT_SOURCE_DIR}/src/vp8/decoder)

+if (NOT USE_SYSTEM_DEPENDENCIES)
+ include_directories(${PROJECT_SOURCE_DIR}/dependencies/brotli/c/include)
+endif()
+
set(LEPTON_SOURCES
src/lepton/base_coders.hh
src/lepton/simple_encoder.hh
@@ -371,12 +370,14 @@ if(USE_SYSTEM_DEPENDENCIES)
include_directories(${ZLIB_INCLUDE_DIRS})
find_package(OpenSSL)
include_directories(${OPENSSL_INCLUDE_DIRS})
+ find_package(pkgconfig)
+ pkg_check_modules(BROTLI REQUIRED libbrotlicommon libbrotlidec libbrotlienc)
if(SSE_VECTORIZATION)
- target_link_libraries(lepton localbrotli ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${ADDITIONAL_FLAGS})
- target_link_libraries(lepton-slow-best-ratio localbrotli ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${ADDITIONAL_FLAGS})
- target_link_libraries(lepton-avx localbrotli ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${ADDITIONAL_FLAGS})
+ target_link_libraries(lepton ${BROTLI_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${ADDITIONAL_FLAGS})
+ target_link_libraries(lepton-slow-best-ratio ${BROTLI_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${ADDITIONAL_FLAGS})
+ target_link_libraries(lepton-avx ${BROTLI_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${ADDITIONAL_FLAGS})
endif()
- target_link_libraries(lepton-scalar localbrotli ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${ADDITIONAL_FLAGS})
+ target_link_libraries(lepton-scalar ${BROTLI_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${ADDITIONAL_FLAGS})
else()
if(SSE_VECTORIZATION)
target_link_libraries(lepton localzlib localbrotli localmd5 ${ADDITIONAL_FLAGS})
@@ -399,7 +400,9 @@ set_target_properties(lepton-avx PROPERT
endif()
set_target_properties(lepton-scalar PROPERTIES COMPILE_FLAGS "${ADDITIONAL_COMPILE_FLAGS} ${ADDITIONAL_DEFINES} ${ALLOCATOR_FLAGS} ${ANS_FLAGS} ${BILLING_FLAGS} -DUSE_SCALAR")

+if (NOT USE_SYSTEM_DEPENDENCIES)
set_target_properties(localzlib PROPERTIES COMPILE_FLAGS "${ARCH_SSE2_FLAGS} ${ZLIB_EXTRA_INCLUDE_DIRS} ${ADDITIONAL_COMPILE_FLAGS} ${ADDITIONAL_DEFINES} ${ALLOCATOR_FLAGS} ${ANS_FLAGS} ${BILLING_FLAGS}")
+endif()

#add_executable(print-model
# src/vp8/util/debug.cc
--- origsrc/lepton/src/lepton/bitops.hh 2025-02-07 16:13:59.000000000 +0900
+++ src/lepton/src/lepton/bitops.hh 2025-02-07 17:05:01.381447100 +0900
@@ -51,6 +51,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
#define BTST_BUFF 1024 * 1024

#include <stdio.h>
+#include <sys/endian.h>
#include <functional>
#include "../io/Reader.hh"
#include "../io/ioutil.hh"
--- origsrc/lepton/src/vp8/decoder/boolreader.hh 2025-02-07 16:13:59.000000000 +0900
+++ src/lepton/src/vp8/decoder/boolreader.hh 2025-02-07 17:04:01.171107200 +0900
@@ -28,6 +28,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIG
#include <assert.h>
#include <limits.h>
#include <stdint.h>
+#include <sys/endian.h>
#include "vpx_config.hh"
#include "billing.hh"
#include "../model/numeric.hh"
--- origsrc/lepton/src/vp8/util/memory.cc 2025-02-07 16:13:59.000000000 +0900
+++ src/lepton/src/vp8/util/memory.cc 2025-02-07 17:17:02.676488100 +0900
@@ -169,7 +169,7 @@ bool g_use_seccomp =
true
#endif
;
-void* operator new (size_t size) throw(std::bad_alloc){
+void* operator new (size_t size) {
void* ptr = custom_malloc(size);
if (ptr == 0) {// did malloc succeed?
if (!g_use_seccomp) {
@@ -180,7 +180,7 @@ void* operator new (size_t size) throw(s
return ptr;
}

-void* operator new[] (size_t size) throw(std::bad_alloc){
+void* operator new[] (size_t size) {
void* ptr = custom_malloc(size);
if (ptr == 0) {// did malloc succeed?
if (!g_use_seccomp) {
13 changes: 0 additions & 13 deletions lepton/lepton-1.2.1-1bl1.cygport

This file was deleted.

29 changes: 0 additions & 29 deletions lepton/lepton-1.2.1-1bl1.src.patch

This file was deleted.

0 comments on commit 9935781

Please sign in to comment.