summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--libyuv-0001-Move-Linux-variables-to-the-top.patch28
-rw-r--r--libyuv-0002-Use-a-proper-so-version.patch18
-rw-r--r--libyuv-0003-Link-against-shared-library.patch38
-rw-r--r--libyuv-0004-Disable-static-library.patch38
-rw-r--r--libyuv-0005-Use-library-suffix-during-installation.patch17
-rw-r--r--libyuv-0006-Link-against-math-library-for-roundf.patch24
-rw-r--r--libyuv.spec76
-rw-r--r--sources1
9 files changed, 241 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..c37806b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/libyuv-20240704.tar.gz
diff --git a/libyuv-0001-Move-Linux-variables-to-the-top.patch b/libyuv-0001-Move-Linux-variables-to-the-top.patch
new file mode 100644
index 0000000..aa737f5
--- /dev/null
+++ b/libyuv-0001-Move-Linux-variables-to-the-top.patch
@@ -0,0 +1,28 @@
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Wed, 5 Jun 2024 20:51:34 +0200
+Subject: [PATCH] Move Linux variables to the top
+
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6dfc93ce..aae18296 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,9 @@ PROJECT ( YUV C CXX ) # "C" is required even for C++ projects
+ CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 )
+ OPTION( UNIT_TEST "Built unit tests" OFF )
+
++# create the .deb and .rpm packages using cpack
++INCLUDE ( CM_linux_packages.cmake )
++
+ SET ( ly_base_dir ${PROJECT_SOURCE_DIR} )
+ SET ( ly_src_dir ${ly_base_dir}/source )
+ SET ( ly_inc_dir ${ly_base_dir}/include )
+@@ -190,7 +193,3 @@ INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin )
+ INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib )
+ INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
+ INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include )
+-
+-# create the .deb and .rpm packages using cpack
+-INCLUDE ( CM_linux_packages.cmake )
+-
diff --git a/libyuv-0002-Use-a-proper-so-version.patch b/libyuv-0002-Use-a-proper-so-version.patch
new file mode 100644
index 0000000..0c8d2c1
--- /dev/null
+++ b/libyuv-0002-Use-a-proper-so-version.patch
@@ -0,0 +1,18 @@
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Fri, 21 Sep 2018 12:45:55 +0200
+Subject: [PATCH] Use a proper so-version
+
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index aae18296..408032c6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -123,6 +123,7 @@ ADD_LIBRARY( ${ly_lib_static} STATIC ${ly_lib_parts})
+ ADD_LIBRARY( ${ly_lib_shared} SHARED ${ly_lib_parts})
+ SET_TARGET_PROPERTIES( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" )
+ SET_TARGET_PROPERTIES( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
++SET_TARGET_PROPERTIES( ${ly_lib_shared} PROPERTIES VERSION "${YUV_VERSION}" SOVERSION "${YUV_VER_MAJOR}" )
+ if(WIN32)
+ SET_TARGET_PROPERTIES( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" )
+ endif()
diff --git a/libyuv-0003-Link-against-shared-library.patch b/libyuv-0003-Link-against-shared-library.patch
new file mode 100644
index 0000000..c64c32d
--- /dev/null
+++ b/libyuv-0003-Link-against-shared-library.patch
@@ -0,0 +1,38 @@
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Fri, 21 Sep 2018 12:47:42 +0200
+Subject: [PATCH] Link against shared library
+
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 408032c6..a8368af4 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -130,15 +130,15 @@ endif()
+
+ # this creates the cpuid tool
+ ADD_EXECUTABLE ( cpuid ${ly_base_dir}/util/cpuid.c )
+-TARGET_LINK_LIBRARIES ( cpuid ${ly_lib_static} )
++TARGET_LINK_LIBRARIES ( cpuid ${ly_lib_shared} )
+
+ # this creates the conversion tool
+ ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
+-TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
++TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_shared} )
+
+ # this creates the yuvconstants tool
+ ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c )
+-TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_static} )
++TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_shared} )
+
+ find_package ( JPEG )
+ if (JPEG_FOUND)
+@@ -168,7 +168,7 @@ if(UNIT_TEST)
+ endif()
+
+ add_executable(libyuv_unittest ${ly_unittest_sources})
+- target_link_libraries(libyuv_unittest ${ly_lib_name} ${GTEST_LIBRARY})
++ target_link_libraries(libyuv_unittest ${ly_lib_shared} ${GTEST_LIBRARY})
+ find_library(PTHREAD_LIBRARY pthread)
+ if(NOT PTHREAD_LIBRARY STREQUAL "PTHREAD_LIBRARY-NOTFOUND")
+ target_link_libraries(libyuv_unittest pthread)
diff --git a/libyuv-0004-Disable-static-library.patch b/libyuv-0004-Disable-static-library.patch
new file mode 100644
index 0000000..d7389e3
--- /dev/null
+++ b/libyuv-0004-Disable-static-library.patch
@@ -0,0 +1,38 @@
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Mon, 24 Sep 2018 15:08:45 +0200
+Subject: [PATCH] Disable static library
+
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a8368af4..b3b22c47 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -14,7 +14,6 @@ SET ( ly_src_dir ${ly_base_dir}/source )
+ SET ( ly_inc_dir ${ly_base_dir}/include )
+ SET ( ly_tst_dir ${ly_base_dir}/unit_test )
+ SET ( ly_lib_name yuv )
+-SET ( ly_lib_static ${ly_lib_name} )
+ SET ( ly_lib_shared ${ly_lib_name}_shared )
+
+ # We cannot use GLOB here since we want to be able to separate out files that
+@@ -116,9 +115,6 @@ if(NOT MSVC)
+ endif()
+ endif()
+
+-# this creates the static library (.a)
+-ADD_LIBRARY( ${ly_lib_static} STATIC ${ly_lib_parts})
+-
+ # this creates the shared library (.so)
+ ADD_LIBRARY( ${ly_lib_shared} SHARED ${ly_lib_parts})
+ SET_TARGET_PROPERTIES( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" )
+@@ -189,8 +185,7 @@ if(UNIT_TEST)
+ endif()
+
+
+-# install the conversion tool, .so, .a, and all the header files
++# install the conversion tool, .so, and all the header files
+ INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin )
+-INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib )
+ INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
+ INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include )
diff --git a/libyuv-0005-Use-library-suffix-during-installation.patch b/libyuv-0005-Use-library-suffix-during-installation.patch
new file mode 100644
index 0000000..4a5e5fa
--- /dev/null
+++ b/libyuv-0005-Use-library-suffix-during-installation.patch
@@ -0,0 +1,17 @@
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Mon, 24 Sep 2018 15:15:09 +0200
+Subject: [PATCH] Use library suffix during installation
+
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b3b22c47..0e4c79db 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -187,5 +187,5 @@ endif()
+
+ # install the conversion tool, .so, and all the header files
+ INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin )
+-INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
++INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib${LIB_SUFFIX} )
+ INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include )
diff --git a/libyuv-0006-Link-against-math-library-for-roundf.patch b/libyuv-0006-Link-against-math-library-for-roundf.patch
new file mode 100644
index 0000000..0f12d37
--- /dev/null
+++ b/libyuv-0006-Link-against-math-library-for-roundf.patch
@@ -0,0 +1,24 @@
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Wed, 5 Jun 2024 20:52:19 +0200
+Subject: [PATCH] Link against math library for roundf
+
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0e4c79db..b6a19a09 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -130,11 +130,11 @@ TARGET_LINK_LIBRARIES ( cpuid ${ly_lib_shared} )
+
+ # this creates the conversion tool
+ ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
+-TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_shared} )
++TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_shared} m )
+
+ # this creates the yuvconstants tool
+ ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c )
+-TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_shared} )
++TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_shared} m )
+
+ find_package ( JPEG )
+ if (JPEG_FOUND)
diff --git a/libyuv.spec b/libyuv.spec
new file mode 100644
index 0000000..8f3b427
--- /dev/null
+++ b/libyuv.spec
@@ -0,0 +1,76 @@
+Name: libyuv
+Summary: YUV conversion and scaling functionality library
+Version: 20240704
+Release: 1
+License: BSD-3-Clause
+Url: https://chromium.googlesource.com/libyuv/libyuv
+Source0: %{name}-%{version}.tar.gz
+Patch1: libyuv-0001-Move-Linux-variables-to-the-top.patch
+Patch2: libyuv-0002-Use-a-proper-so-version.patch
+Patch3: libyuv-0003-Link-against-shared-library.patch
+Patch4: libyuv-0004-Disable-static-library.patch
+Patch5: libyuv-0005-Use-library-suffix-during-installation.patch
+Patch6: libyuv-0006-Link-against-math-library-for-roundf.patch
+BuildRequires: cmake
+BuildRequires: gcc-c++
+BuildRequires: gtest-devel
+BuildRequires: libjpeg-devel
+
+%description
+This is an open source project that includes YUV conversion and scaling
+functionality. Converts all webcam formats to YUV (I420). Convert YUV to
+formats for rendering/effects. Rotate by 90 degrees to adjust for mobile
+devices in portrait mode. Scale YUV to prepare content for compression,
+with point, bilinear or box filter.
+
+%package devel
+Summary: The development files for %{name}
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+Additional header files for development with %{name}.
+
+%prep
+%autosetup -p1 -c %{name}-%{version}
+
+cat > %{name}.pc << EOF
+prefix=%{_prefix}
+exec_prefix=${prefix}
+libdir=%{_libdir}
+includedir=%{_includedir}
+
+Name: %{name}
+Description: %{summary}
+Version: %{version}
+Libs: -lyuv
+EOF
+
+%build
+%{cmake} -DUNIT_TEST=TRUE
+cmake --build . --target all -- -j$(nproc)
+
+%install
+make install/fast DESTDIR=%{buildroot}
+
+mkdir -p %{buildroot}%{_libdir}/pkgconfig
+cp -a %{name}.pc %{buildroot}%{_libdir}/pkgconfig/
+
+rm -f %{buildroot}%{_bindir}/yuvconvert
+
+%check
+./libyuv_unittest || true
+
+%files
+%license LICENSE
+%doc AUTHORS PATENTS README.md
+%{_libdir}/%{name}.so.*
+
+%files devel
+%{_includedir}/%{name}
+%{_includedir}/%{name}.h
+%{_libdir}/%{name}.so
+%{_libdir}/pkgconfig/%{name}.pc
+
+%changelog
+* Wed Nov 27 2024 Yangfan Ruan <yangfan.oerv@isrc.iscas.ac.cn> - 20240704-1
+- Init package
diff --git a/sources b/sources
new file mode 100644
index 0000000..213e898
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+32c46460af60973775c1d2489563c39a libyuv-20240704.tar.gz