Skip to content

Add brunsli #11913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions recipes/brunsli/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
setlocal EnableDelayedExpansion
echo on

mkdir build_conda
if errorlevel 1 exit 1

cd build_conda
if errorlevel 1 exit 1

cmake -LAH -G "Ninja" ^
-DCMAKE_BUILD_TYPE:STRING=Release ^
-DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
..
if errorlevel 1 exit 1

ninja install
if errorlevel 1 exit 1
11 changes: 11 additions & 0 deletions recipes/brunsli/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
mkdir build_conda
cd build_conda

cmake -LAH \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_INSTALL_LIBDIR=lib \
..

make -j${CPU_COUNT}
make install
69 changes: 69 additions & 0 deletions recipes/brunsli/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{% set name = "brunsli" %}
{% set version = "0.1" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://github.com/google/brunsli/archive/v{{ version }}.tar.gz
sha256: 62762dc740f9fcc9706449c078f12c2a366416486d2882be50a9f201f99ac0bc
patches:
# https://github.com/google/brunsli/issues/91
- use_conda_forge_shared_libraries.patch

build:
number: 0
# Windows builds seem too experimental upstream
# https://github.com/google/brunsli/issues/51
# https://github.com/google/brunsli/issues/62
# https://github.com/google/brunsli/issues/93
skip: true # [win]
run_exports:
# New package by google, keep defaults
- {{ pin_subpackage( name | lower ) }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- cmake
- make # [unix]
- ninja # [win]
host:
- brotli

test:
commands:
- test -f $PREFIX/include/brunsli/encode.h # [unix]
- test -f $PREFIX/include/brunsli/decode.h # [unix]
- test -f $PREFIX/lib/libbrunslienc-c${SHLIB_EXT} # [unix]
- test -f $PREFIX/lib/libbrunslidec-c${SHLIB_EXT} # [unix]
# Executable aways returns 1
- which cbrunsli # [unix]
- which dbrunsli # [unix]
- if not exist %LIBRARY_INC%\brunsli\encode.h exit 1 # [win]
- if not exist %LIBRARY_INC%\brunsli\decode.h exit 1 # [win]
- if not exist %LIBRARY_LIB%\brunslienc-c.lib exit 1 # [win]
- if not exist %LIBRARY_LIB%\brunslidec-c.lib exit 1 # [win]
- if not exist %LIBRARY_BIN%\brunslienc-c.dll exit 1 # [win]
- if not exist %LIBRARY_BIN%\brunslidec-c.dll exit 1 # [win]
- where cbrunsli # [win]
- where dbrunsli # [win]

about:
home: https://github.com/google/brunsli
license: MIT
license_family: MIT
license_file: LICENSE
summary: Practical JPEG Repacker

description: |
Brunsli is a lossless JPEG repacking library.

Brunsli allows for a 22% decrease in file size while
allowing the original JPEG to be recovered byte-by-byte.

extra:
recipe-maintainers:
- hmaarrfk
52 changes: 52 additions & 0 deletions recipes/brunsli/use_conda_forge_shared_libraries.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d785be..edcf192 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED YES)

-add_subdirectory(third_party)
+# add_subdirectory(third_party)

# The Brunsli library definition.
include(brunsli.cmake)
diff --git a/brunsli.cmake b/brunsli.cmake
index 1e87527..48add4c 100644
--- a/brunsli.cmake
+++ b/brunsli.cmake
@@ -57,7 +57,7 @@ add_library(brunslidec-static STATIC
${BRUNSLI_DEC_HEADERS}
)
target_link_libraries(brunslidec-static PRIVATE
- brotlidec-static
+ brotlidec
brunslicommon-static
)

@@ -66,7 +66,7 @@ add_library(brunslienc-static STATIC
${BRUNSLI_ENC_HEADERS}
)
target_link_libraries(brunslienc-static PRIVATE
- brotlienc-static
+ brotlienc
brunslicommon-static
)

@@ -134,10 +134,16 @@ endif() # BRUNSLI_EMSCRIPTEN
if(NOT BRUNSLI_EMSCRIPTEN)
install(
TARGETS brunslidec-c brunslienc-c
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)

+ install(
+ TARGETS cbrunsli dbrunsli
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ )
+
install(
DIRECTORY ${BRUNSLI_INCLUDE_DIRS}/brunsli
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"