Use BUILD_STATIC_LIBS=OFF instead of deleting the static library after build

This commit is contained in:
Sandro Mani 2017-12-25 14:17:47 +01:00
parent 79e5fa6ab6
commit 4d9d9e074c
2 changed files with 19 additions and 4 deletions

View File

@ -5,7 +5,7 @@
Name: openjpeg2
Version: 2.3.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: C-Library for JPEG 2000
# windirent.h is MIT, the rest is BSD
@ -19,6 +19,8 @@ Source1: data.tar.xz
# Remove bundled libraries
Patch0: openjpeg2_remove-thirdparty.patch
# Fix shared libraries not getting installed if static libraries are disabled
Patch1: openjpeg2_install.patch
BuildRequires: cmake
BuildRequires: zlib-devel
@ -207,6 +209,8 @@ pushd %{_target_platform}
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENJPEG_INSTALL_LIB_DIR=%{_lib} \
%{?optional_components:-DBUILD_MJ2=ON -DBUILD_JPWL=ON -DBUILD_JPIP=ON -DBUILD_JP3D=ON} \
-DBUILD_DOC=ON \
-DBUILD_STATIC_LIBS=OFF \
-DBUILD_SHARED_LIBS=ON \
%{?runcheck:-DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT=$PWD/../data} \
..
popd
@ -217,9 +221,6 @@ popd
%install
%make_install -C %{_target_platform}
# Remove static library
rm -f %{buildroot}%{_libdir}/libopenjp2.a
# Rename to avoid conflicts with openjpeg-1.x
for file in %{buildroot}%{_bindir}/opj_*; do
mv $file ${file/opj_/opj2_}
@ -326,6 +327,9 @@ make test -C %{_target_platform}
%changelog
* Mon Dec 25 2017 Sandro Mani <manisandro@gmail.com> - 2.3.0-2
- Use BUILD_STATIC_LIBS=OFF instead of deleting the static library after build
* Thu Oct 05 2017 Sandro Mani <manisandro@gmail.com> - 2.3.0-1
- Update to 2.3.0

11
openjpeg2_install.patch Normal file
View File

@ -0,0 +1,11 @@
diff -rupN openjpeg-2.3.0/src/lib/openjp2/CMakeLists.txt openjpeg-2.3.0-new/src/lib/openjp2/CMakeLists.txt
--- openjpeg-2.3.0/src/lib/openjp2/CMakeLists.txt 2017-10-05 00:23:14.000000000 +0200
+++ openjpeg-2.3.0-new/src/lib/openjp2/CMakeLists.txt 2017-12-25 13:53:07.000000000 +0100
@@ -99,6 +99,7 @@ else()
set(INSTALL_LIBS ${OPENJPEG_LIBRARY_NAME} openjp2_static)
else()
add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
+ set(INSTALL_LIBS ${OPENJPEG_LIBRARY_NAME})
endif()
endif()