diff options
-rw-r--r-- | lib/jxl.cmake | 13 | ||||
-rw-r--r-- | packaging/libjxl.manifest | 5 | ||||
-rw-r--r-- | packaging/libjxl.spec | 115 | ||||
-rw-r--r-- | third_party/CMakeLists.txt | 51 | ||||
-rw-r--r-- | third_party/highway/CMakeLists.txt | 10 |
5 files changed, 177 insertions, 17 deletions
diff --git a/lib/jxl.cmake b/lib/jxl.cmake index c0290ab..3a98030 100644 --- a/lib/jxl.cmake +++ b/lib/jxl.cmake @@ -393,9 +393,16 @@ if (JPEGXL_ENABLE_SKCMS) $<TARGET_PROPERTY:skcms,INCLUDE_DIRECTORIES> ) else () - target_include_directories(jxl_enc-obj PRIVATE - $<TARGET_PROPERTY:lcms2,INCLUDE_DIRECTORIES> - ) + # .cmake is not supported in Tizen, it is modified to use basic. + if (__TIZEN__) + target_include_directories(jxl_enc-obj PRIVATE + ${LCMS2_INCLUDE_DIR} + ) + else () + target_include_directories(jxl_enc-obj PRIVATE + $<TARGET_PROPERTY:lcms2,INCLUDE_DIRECTORIES> + ) + endif () endif () # Headers for exporting/importing public headers diff --git a/packaging/libjxl.manifest b/packaging/libjxl.manifest new file mode 100644 index 0000000..c00c25b --- /dev/null +++ b/packaging/libjxl.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_" /> + </request> +</manifest> diff --git a/packaging/libjxl.spec b/packaging/libjxl.spec new file mode 100644 index 0000000..c88b861 --- /dev/null +++ b/packaging/libjxl.spec @@ -0,0 +1,115 @@ +## if you want to build tools, please enable after lodepng is added +%define enable_tools 0 + +Name: libjxl +Summary: JPEG XL encoder and decoder library +Version: 0.6.1 +Release: 0 +Group: Multimedia/Libraries +URL: https://github.com/libjxl/libjxl/ +License: BSD-3-Clause and Apache-2.0 +Source0: %{name}-%{version}.tar.gz +SOURCE1: %{name}.manifest + +BuildRequires: cmake +BuildRequires: pkgconfig(libbrotlicommon) +BuildRequires: pkgconfig(libbrotlidec) +BuildRequires: pkgconfig(libbrotlienc) +BuildRequires: pkgconfig(lcms2) + +%description +Description: JPEG XL encoder and decoder library + + +%package devel +Summary: JPEG XL encoder and decoder (development) +Requires: %{name} = %{version}-%{release} +Group: Multimedia/Development + +%description devel +Description: JPEG XL encoder and decoder library (development) + +%if %{enable_tools} +%package tools +Summary: JPEG XL encoder and decoder (tools) +Requires: %{name} = %{version}-%{release} +Group: Multimedia/Development + +%description tools +Description: JPEG XL encoder and decoder library (tools) +%endif + +%prep +%setup -q +cp %{SOURCE1} . + +# add defines for highway(libhwy) in libjxl +%ifarch armv7l +CFLAGS+=" -D__arm__" +CXXFLAGS+=" -D__arm__" +%endif +%ifarch aarch64 +CFLAGS+=" -D__aarch64__" +CXXFLAGS+=" -D__aarch64__" +%endif +%ifarch %{ix86} +CFLAGS+=" -D__i386__" +CXXFLAGS+=" -D__i386__" +%endif +%ifarch x86_64 +CFLAGS+=" -D__x86_64__" +CXXFLAGS+=" -D__x86_64__" +%endif + +# add S/W coder define for highway(libhwy) +# if H/W accelerator can be used, below options should be removed +CFLAGS+=" -DHWY_COMPILE_ONLY_SCALAR" +CXXFLAGS+=" -DHWY_COMPILE_ONLY_SCALAR" + +%build +%cmake . -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=OFF \ +%if %{enable_tools} + -DJPEGXL_ENABLE_TOOLS=ON \ +%else + -DJPEGXL_ENABLE_TOOLS=OFF \ +%endif + -DJPEGXL_ENABLE_MANPAGES=OFF \ + -DJPEGXL_ENABLE_BENCHMARK=OFF \ + -DJPEGXL_ENABLE_EXAMPLES=OFF \ + -DJPEGXL_ENABLE_JNI=OFF \ + -DJPEGXL_ENABLE_SJPEG=OFF \ + -DJPEGXL_ENABLE_OPENEXR=OFF \ + -DJPEGXL_ENABLE_SKCMS=OFF \ + -DJPEGXL_BUNDLE_SKCMS=OFF \ + -DJPEGXL_STATIC=OFF \ + -DJPEGXL_FORCE_SYSTEM_BROTLI=ON \ + -DJPEGXL_FORCE_SYSTEM_LCMS2=ON \ + -D__TIZEN__=ON +make %{?jobs:-j%jobs} + +%install +%make_install + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%manifest %{name}.manifest +%defattr(-,root,root,-) +%{_libdir}/*.so.* +%license LICENSE PATENTS LICENSE.APLv2.0 + +%files devel +%manifest %{name}.manifest +%defattr(-,root,root,-) +%{_libdir}/*.so +%{_libdir}/pkgconfig/%{name}*.pc +%{_includedir}/jxl/*.h + +%if %{enable_tools} +%files tools +%manifest %{name}.manifest +%defattr(-,root,root,-) +%{_bindir}/* +%endif diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index b5e1899..45fb4d8 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -85,8 +85,13 @@ set(HWY_SYSTEM_GTEST ON CACHE INTERNAL "") if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/highway/CMakeLists.txt" AND NOT JPEGXL_FORCE_SYSTEM_HWY) add_subdirectory(highway) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/highway/LICENSE" - ${PROJECT_BINARY_DIR}/LICENSE.highway COPYONLY) + if(__TIZEN__) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/highway/LICENSE" + ${PROJECT_BINARY_DIR}/LICENSE.APLv2.0 COPYONLY) + else() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/highway/LICENSE" + ${PROJECT_BINARY_DIR}/LICENSE.highway COPYONLY) + endif() # __TIZEN__ else() pkg_check_modules(HWY libhwy) if (NOT HWY_FOUND) @@ -114,13 +119,19 @@ else() endif() # lodepng -if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lodepng/lodepng.h" ) - message(FATAL_ERROR "Please run ${PROJECT_SOURCE_DIR}/deps.sh to fetch the " - "build dependencies.") +if(JPEGXL_ENABLE_TOOLS OR + NOT __TIZEN__) + if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lodepng/lodepng.h" ) + message(FATAL_ERROR "Please run ${PROJECT_SOURCE_DIR}/deps.sh to fetch the " + "build dependencies.") + endif() + include(lodepng.cmake) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lodepng/LICENSE" + ${PROJECT_BINARY_DIR}/LICENSE.lodepng COPYONLY) +else() + # remove the dependency of 'lodepng' in Tizen + message(STATUS "lodepng is no need in Tizen") endif() -include(lodepng.cmake) -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lodepng/LICENSE" - ${PROJECT_BINARY_DIR}/LICENSE.lodepng COPYONLY) # brotli if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/brotli/c/include/brotli/decode.h" OR @@ -202,12 +213,26 @@ if (JPEGXL_ENABLE_SKCMS OR JPEGXL_ENABLE_PLUGINS) ${PROJECT_BINARY_DIR}/LICENSE.skcms COPYONLY) endif () if (JPEGXL_ENABLE_VIEWERS OR NOT JPEGXL_ENABLE_SKCMS) - if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lcms/.git" ) - message(SEND_ERROR "Please run git submodule update --init") + # lcms2 of tizen does not support include(.cmake) function + # so include(.cmake) is modified to pkg_check_modules(.pc) + if (__TIZEN__) + set(LCMS2 "lcms2") + string(TOUPPER ${LCMS2} LCMS2PREFIX) + pkg_check_modules(${LCMS2PREFIX} ${LCMS2}) + if (${LCMS2PREFIX}_FOUND) + message(STATUS "Use ${LCMS2} of Tizen") + else () + message(FATAL_ERROR "Not exist ${LCMS2} in Tizen") + endif () + unset(LCMS2PREFIX) + else() + if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lcms/.git" ) + message(SEND_ERROR "Please run git submodule update --init") + endif () + include(lcms2.cmake) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lcms/COPYING" + ${PROJECT_BINARY_DIR}/LICENSE.lcms COPYONLY) endif() - include(lcms2.cmake) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lcms/COPYING" - ${PROJECT_BINARY_DIR}/LICENSE.lcms COPYONLY) endif() # sjpeg diff --git a/third_party/highway/CMakeLists.txt b/third_party/highway/CMakeLists.txt index b1d360f..4593a03 100644 --- a/third_party/highway/CMakeLists.txt +++ b/third_party/highway/CMakeLists.txt @@ -233,6 +233,15 @@ add_custom_command(TARGET hwy_list_targets POST_BUILD if (HWY_EXAMPLES_TESTS_INSTALL) # -------------------------------------------------------- install library +if (__TIZEN__) +install(TARGETS hwy + DESTINATION "${CMAKE_INSTALL_LIBDIR}") +install(TARGETS hwy_contrib + DESTINATION "${CMAKE_INSTALL_LIBDIR}") +install(TARGETS hwy_test + DESTINATION "${CMAKE_INSTALL_LIBDIR}") +set(HWY_LIBRARY_VERSION "${CMAKE_PROJECT_VERSION}") +else() install(TARGETS hwy DESTINATION "${CMAKE_INSTALL_LIBDIR}") # Install all the headers keeping the relative path to the current directory @@ -271,7 +280,6 @@ endforeach() # Add a pkg-config file for libhwy and the contrib/test libraries. set(HWY_LIBRARY_VERSION "${CMAKE_PROJECT_VERSION}") -if (NOT __TIZEN__) foreach (pc libhwy.pc libhwy-contrib.pc libhwy-test.pc) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${pc}.in" "${pc}" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${pc}" |