Add mingw subpackages

This commit is contained in:
Sandro Mani 2022-02-24 11:13:44 +01:00
parent 27c8374e5e
commit 67748c83bc
2 changed files with 217 additions and 27 deletions

View File

@ -1,13 +1,39 @@
Name: libgeotiff
Version: 1.7.0
Release: 3%{?dist}
Summary: GeoTIFF format library
License: MIT
URL: http://trac.osgeo.org/geotiff/
Source: http://download.osgeo.org/geotiff/%{name}/%{name}-%{version}.tar.gz
BuildRequires: gcc-c++
BuildRequires: libtiff-devel libjpeg-devel proj-devel >= 6.2.0 zlib-devel
BuildRequires: make
Name: libgeotiff
Version: 1.7.0
Release: 5%{?dist}
Summary: GeoTIFF format library
License: MIT
URL: http://trac.osgeo.org/geotiff/
Source: http://download.osgeo.org/geotiff/%{name}/%{name}-%{version}.tar.gz
# Honour LIB_SUFFIX
# Honour GEOTIFF_INCLUDE_SUBDIR
# Add version suffix to mingw library
# Fix cmake module install dir
# Don't install docs
Patch0: libgeotiff_cmake.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: libtiff-devel
BuildRequires: libjpeg-devel
BuildRequires: proj-devel
BuildRequires: zlib-devel
BuildRequires: mingw32-filesystem >= 95
BuildRequires: mingw32-gcc
BuildRequires: mingw32-libtiff
BuildRequires: mingw32-libjpeg
BuildRequires: mingw32-proj
BuildRequires: mingw32-zlib
BuildRequires: mingw64-filesystem >= 95
BuildRequires: mingw64-gcc
BuildRequires: mingw64-libtiff
BuildRequires: mingw64-libjpeg
BuildRequires: mingw64-proj
BuildRequires: mingw64-zlib
%description
GeoTIFF represents an effort by over 160 different remote sensing,
@ -23,28 +49,63 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The GeoTIFF library provides support for development of geotiff image format.
%package -n mingw32-%{name}
Summary: MinGW Windows %{name} library
Obsoletes: mingw32-%{name}-static
%description -n mingw32-%{name}
%{summary}.
%package -n mingw32-%{name}-tools
Summary: Tools for the MinGW Windows %{name} library
Requires: mingw32-%{name} = %{version}-%{release}
%description -n mingw32-%{name}-tools
%{summary}.
%package -n mingw64-%{name}
Summary: MinGW Windows %{name} library
Obsoletes: mingw64-%{name}-static
%description -n mingw64-%{name}
%{summary}.
%package -n mingw64-%{name}-tools
Summary: Tools for the MinGW Windows %{name} library
Requires: mingw64-%{name} = %{version}-%{release}
%description -n mingw64-%{name}-tools
%{summary}.
%{?mingw_debug_package}
%prep
%setup -q
%autosetup -p1 -n %{name}-%{version}
%build
%configure \
--prefix=%{_prefix} \
--includedir=%{_includedir}/%{name}/ \
--with-proj \
--with-jpeg \
--with-zip \
--disable-static
# Native build
%cmake -DGEOTIFF_BIN_SUBDIR=bin -DGEOTIFF_INCLUDE_SUBDIR=include/%{name}
%cmake_build
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
# MinGW build
%mingw_cmake -DGEOTIFF_BIN_SUBDIR=bin -DGEOTIFF_INCLUDE_SUBDIR=include/%{name}
%mingw_make_build
%make_build %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot} INSTALL="install -p"
%cmake_install
%mingw_make_install
# install pkgconfig file
cat > %{name}.pc <<EOF
mkdir -p %{buildroot}%{_libdir}/pkgconfig/
cat > %{buildroot}%{_libdir}/pkgconfig/%{name}.pc <<EOF
prefix=%{_prefix}
exec_prefix=%{_prefix}
libdir=%{_libdir}
@ -57,11 +118,41 @@ Libs: -L\${libdir} -lgeotiff
Cflags: -I\${includedir}
EOF
%{__mkdir} -p %{buildroot}%{_libdir}/pkgconfig/
%{__install} -p -m 644 %{name}.pc %{buildroot}%{_libdir}/pkgconfig/
mkdir -p %{buildroot}%{mingw32_libdir}/pkgconfig/
cat > %{buildroot}%{mingw32_libdir}/pkgconfig/%{name}.pc <<EOF
prefix=%{mingw32_prefix}
exec_prefix=%{mingw32_prefix}
libdir=%{mingw32_libdir}
includedir=%{mingw32_includedir}/%{name}
Name: %{name}
Description: GeoTIFF file format library
Version: %{version}
Libs: -L${libdir} -lgeotiff
Cflags: -I${includedir}
EOF
mkdir -p %{buildroot}%{mingw64_libdir}/pkgconfig/
cat > %{buildroot}%{mingw64_libdir}/pkgconfig/%{name}.pc <<EOF
prefix=%{mingw64_prefix}
exec_prefix=%{mingw64_prefix}
libdir=%{mingw64_libdir}
includedir=%{mingw64_includedir}/%{name}
Name: %{name}
Description: GeoTIFF file format library
Version: %{version}
Libs: -L${libdir} -lgeotiff
Cflags: -I${includedir}
EOF
%mingw_debug_install_post
%check
%ctest
#clean up junks
%{__rm} -fv %{buildroot}%{_libdir}/lib*.la
%files
%license LICENSE
@ -69,6 +160,7 @@ EOF
%{_bindir}/applygeo
%{_bindir}/geotifcp
%{_bindir}/listgeo
%{_bindir}/makegeo
%{_libdir}/%{name}.so.5*
%{_mandir}/man1/*.1*
@ -76,8 +168,39 @@ EOF
%{_includedir}/%{name}
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/cmake/GeoTIFF/
%files -n mingw32-%{name}
%doc ChangeLog README
%license COPYING
%{mingw32_bindir}/libgeotiff-5.dll
%{mingw32_includedir}/*
%{mingw32_datadir}/*
%{mingw32_libdir}/libgeotiff.dll.a
%{mingw32_libdir}/pkgconfig/libgeotiff.pc
%{mingw32_libdir}/cmake/GeoTIFF/
%files -n mingw32-%{name}-tools
%{mingw32_bindir}/*.exe
%files -n mingw64-%{name}
%doc ChangeLog README
%license COPYING
%{mingw64_bindir}/libgeotiff-5.dll
%{mingw64_includedir}/*
%{mingw64_datadir}/*
%{mingw64_libdir}/libgeotiff.dll.a
%{mingw64_libdir}/pkgconfig/libgeotiff.pc
%{mingw64_libdir}/cmake/GeoTIFF/
%files -n mingw64-%{name}-tools
%{mingw64_bindir}/*.exe
%changelog
* Thu Feb 24 2022 Sandro Mani <manisandro@gmail.com> - 1.7.0-5
- Add mingw subpackage
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

67
libgeotiff_cmake.patch Normal file
View File

@ -0,0 +1,67 @@
diff -rupN libgeotiff-1.7.0/cmake/CMakeLists.txt libgeotiff-1.7.0-new/cmake/CMakeLists.txt
--- libgeotiff-1.7.0/cmake/CMakeLists.txt 2021-03-06 18:47:06.000000000 +0100
+++ libgeotiff-1.7.0-new/cmake/CMakeLists.txt 2022-02-20 01:14:12.921648760 +0100
@@ -6,13 +6,8 @@
# ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative
# path to the root from there. (Note that the whole install tree can
# be relocated.)
-if (NOT WIN32)
- set (INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}")
- set (PROJECT_ROOT_DIR "../../..")
-else ()
- set (INSTALL_CMAKE_DIR "cmake")
- set (PROJECT_ROOT_DIR "..")
-endif ()
+set (INSTALL_CMAKE_DIR "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}")
+set (PROJECT_ROOT_DIR "../../..")
configure_file (project-config.cmake.in project-config.cmake @ONLY)
configure_file (project-config-version.cmake.in
diff -rupN libgeotiff-1.7.0/CMakeLists.txt libgeotiff-1.7.0-new/CMakeLists.txt
--- libgeotiff-1.7.0/CMakeLists.txt 2021-06-30 10:51:17.000000000 +0200
+++ libgeotiff-1.7.0-new/CMakeLists.txt 2022-02-20 01:12:42.518986798 +0100
@@ -285,9 +285,9 @@ SET(GEOTIFF_INCLUDE_DIR ${GEOTIFF_INCLUD
SET(GEOTIFF_DATA_DIR ${GEOTIFF_DATA_SUBDIR})
# Install doc files
-INSTALL(FILES
- AUTHORS ChangeLog COPYING INSTALL LICENSE README README_BIN README.WIN
- DESTINATION doc)
+#INSTALL(FILES
+ #AUTHORS ChangeLog COPYING INSTALL LICENSE README README_BIN README.WIN
+ #DESTINATION doc)
# DESTINATION ${GEOTIFF_DATA_DIR}/doc)
# Install man pages
@@ -295,8 +295,8 @@ INSTALL(FILES ${GEOTIFF_MAN_PAGES} DESTI
# Install header files for development distribution
-# INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION ${GEOTIFF_INCLUDE_DIR})
-INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION include)
+INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION ${GEOTIFF_INCLUDE_DIR})
+#INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION include)
###############################################################################
# Build libxtiff library
@@ -358,6 +358,9 @@ ELSE(UNIX)
SET_TARGET_PROPERTIES(${GEOTIFF_LIBRARY_TARGET} PROPERTIES
OUTPUT_NAME ${GEOTIFF_LIB_NAME})
ENDIF(UNIX)
+IF(MINGW)
+ SET_TARGET_PROPERTIES(${GEOTIFF_LIBRARY_TARGET} PROPERTIES SUFFIX "-${LINK_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ENDIF(MINGW)
SET_TARGET_PROPERTIES(${GEOTIFF_LIBRARY_TARGET} PROPERTIES
OUTPUT_NAME ${GEOTIFF_LIB_NAME})
@@ -376,8 +379,8 @@ TARGET_LINK_LIBRARIES(${GEOTIFF_LIBRARY_
INSTALL( TARGETS ${GEOTIFF_LIBRARY_TARGET}
EXPORT depends
RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib )
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} )
# Define grouping of source files in PROJECT file (e.g. Visual Studio)
SOURCE_GROUP("CMake Files" FILES CMakeLists.txt)