diff --git a/libspatialite.spec b/libspatialite.spec index 6775f4f..ece0745 100644 --- a/libspatialite.spec +++ b/libspatialite.spec @@ -1,68 +1,56 @@ -# Warning to ELGIS: -# 1 of the 41 tests is known to fail on EL6 (32 bit and 64 bit Intel) -# Tests pass though on PPC and PPC64 -# The author is informed about that. -# The problem seems to stem from Geos. - -#EPSG data in libspatialite should be in sync with our current GDAL version - -# A new feature available in PostGIS 2.0 -#%%global _lwgeom "--enable-lwgeom=yes" -# Disabled due to a circular dependency issue with PostGIS -# https://bugzilla.redhat.com/show_bug.cgi?id=979179 -%global _lwgeom "--disable-lwgeom" - -# Geocallbacks work with SQLite 3.7.3 and up, available in Fedora and EL 7 -%if (0%{?fedora} || 0%{?rhel} > 6) - %global _geocallback "--enable-geocallbacks" -%endif - -%if 0%{?rhel} == 6 -# Checks are known to fail if libspatialite is built without geosadvanced -#TODO: Fails to build, reported by mail. If geosadvanced is disabled, linker flags miss geos_c -#TODO: Check if that's still true anywhere - %global _geosadvanced "--disable-geosadvanced" - %global _no_checks 1 -%endif - -%if 0%{?fedora} >= 34 -# librttopo available in F34+ -%global _topo --enable-rttopo -%endif - -%global _gcp --enable-gcp - -# check_bufovflw test fails on gcc 4.9 -# https://groups.google.com/forum/#!msg/spatialite-users/zkGP-gPByXk/EAZ-schWn1MJ -%if (0%{?fedora} >= 21 || 0%{?rhel} > 7) - %global _no_checks 1 -%endif - -Name: libspatialite -Version: 5.0.1 -Release: 10%{?dist} -Summary: Enables SQLite to support spatial data -License: MPLv1.1 or GPLv2+ or LGPLv2+ -URL: https://www.gaia-gis.it/fossil/libspatialite -Source0: http://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-%{version}.tar.gz +Name: libspatialite +Version: 5.0.1 +Release: 11%{?dist} +Summary: Enables SQLite to support spatial data -# Move private libs to Libs.private in pkg-config file (#1926868) -Patch0: libspatialite_pkgconfig.patch +License: MPLv1.1 or GPLv2+ or LGPLv2+ +URL: https://www.gaia-gis.it/fossil/libspatialite +Source0: http://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-%{version}.tar.gz -BuildRequires: make -BuildRequires: autoconf +# Move private libs to Libs.private in pkg-config file (#1926868) +Patch0: libspatialite_pkgconfig.patch +# Fix mingw detection in configure.ac +Patch1: libspatialite_mingw.patch +# Fix obsolete macros +Patch2: libspatialite_macros.patch +# Use pkgconfig to find geos +Patch3: libspatialite_geos.patch + +BuildRequires: autoconf automake libtool BuildRequires: freexl-devel BuildRequires: gcc BuildRequires: geos-devel >= 3.7.1 BuildRequires: librttopo-devel +BuildRequires: libxml2-devel +BuildRequires: make BuildRequires: minizip-devel BuildRequires: proj-devel >= 6.2.0 BuildRequires: sqlite-devel BuildRequires: zlib-devel -%if (0%{?fedora} || 0%{?rhel} > 6) -BuildRequires: libxml2-devel -%endif +BuildRequires: mingw32-filesystem >= 95 +BuildRequires: mingw32-freexl +BuildRequires: mingw32-gcc +BuildRequires: mingw32-geos +BuildRequires: mingw32-libcharset +BuildRequires: mingw32-librttopo +BuildRequires: mingw32-libxml2 +BuildRequires: mingw32-minizip +BuildRequires: mingw32-proj +BuildRequires: mingw32-sqlite +BuildRequires: mingw32-zlib + +BuildRequires: mingw64-filesystem >= 95 +BuildRequires: mingw64-freexl +BuildRequires: mingw64-gcc +BuildRequires: mingw64-geos +BuildRequires: mingw64-libcharset +BuildRequires: mingw64-librttopo +BuildRequires: mingw64-libxml2 +BuildRequires: mingw64-minizip +BuildRequires: mingw64-proj +BuildRequires: mingw64-sqlite +BuildRequires: mingw64-zlib %description @@ -70,6 +58,7 @@ SpatiaLite is a a library extending the basic SQLite core in order to get a full fledged Spatial DBMS, really simple and lightweight, but mostly OGC-SFS compliant. + %package devel Summary: Development libraries and headers for SpatiaLite Requires: %{name}%{?_isa} = %{version}-%{release} @@ -80,46 +69,66 @@ The %{name}-devel package contains libraries and header files for developing applications that use %{name}. +%package -n mingw32-%{name} +Summary: MinGW Windows libspatialite library + +%description -n mingw32-%{name} +MinGW Windows libspatialite library. + + +%package -n mingw64-%{name} +Summary: MinGW Windows libspatialite library + +%description -n mingw64-%{name} +MinGW Windows libspatialite library. + + +%{?mingw_debug_package} + + %prep %autosetup -p1 -n %{name}-%{version} -autoconf +autoreconf -ifv + +# Need to copy testdata into builddir +mkdir build_native +cp -a test build_native + %build +# Native build +pushd build_native +%global _configure ../configure %configure \ - --disable-static \ - %{?_lwgeom} \ - %{?_libxml2} \ - %{?_geos} \ - %{?_geocallback} \ - %{?_geosadvanced} \ - %{?_topo} \ - %{?_gcp} + --disable-static \ + --enable-geocallbacks \ + --enable-rttopo \ + --enable-gcp +%make_build +popd -%{__make} %{?_smp_mflags} +# MinGW build +%mingw_configure --disable-static +%mingw_make_build -%install -%{__rm} -rf %{buildroot} -%{__make} install DESTDIR=%{buildroot} +%install +%make_install -C build_native +%mingw_make_install -# Delete undesired libtool archives find %{buildroot} -type f -name "*.la" -delete -%check -%if 0%{?_no_checks} -# Run check but don't fail build -#%%{__make} check V=1 ||: -#%%else -#%%{__make} check V=1 -%endif -%ldconfig_scriptlets +%mingw_debug_install_post + + +%check +make check -C build_native %{?_smp_mflags} || : -%clean -%{__rm} -rf %{buildroot} %files -%doc COPYING AUTHORS +%doc AUTHORS +%license COPYING %{_libdir}/%{name}.so.7* %{_libdir}/mod_spatialite.so.7* # The symlink must be present to allow loading the extension @@ -133,8 +142,28 @@ find %{buildroot} -type f -name "*.la" -delete %{_libdir}/%{name}.so %{_libdir}/pkgconfig/spatialite.pc +%files -n mingw32-%{name} +%license COPYING +%{mingw32_bindir}/libspatialite-4.dll +%{mingw32_includedir}/spatialite.h +%{mingw32_includedir}/spatialite/ +%{mingw32_libdir}/libspatialite.dll.a +%{mingw32_libdir}/mod_spatialite.dll* +%{mingw32_libdir}/pkgconfig/spatialite.pc + +%files -n mingw64-%{name} +%license COPYING +%{mingw64_bindir}/libspatialite-4.dll +%{mingw64_includedir}/spatialite.h +%{mingw64_includedir}/spatialite/ +%{mingw64_libdir}/libspatialite.dll.a +%{mingw64_libdir}/mod_spatialite.dll* +%{mingw64_libdir}/pkgconfig/spatialite.pc %changelog +* Thu Feb 24 2022 Sandro Mani - 5.0.1-11 +- Add mingw subpackage + * Thu Jan 20 2022 Fedora Release Engineering - 5.0.1-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/libspatialite_geos.patch b/libspatialite_geos.patch new file mode 100644 index 0000000..7d8d2c2 --- /dev/null +++ b/libspatialite_geos.patch @@ -0,0 +1,43 @@ +diff -rupN --no-dereference libspatialite-5.0.1/configure.ac libspatialite-5.0.1-new/configure.ac +--- libspatialite-5.0.1/configure.ac 2021-03-08 08:57:19.015858195 +0100 ++++ libspatialite-5.0.1-new/configure.ac 2021-03-08 08:57:19.017858195 +0100 +@@ -312,35 +312,10 @@ AC_ARG_ENABLE(geos, [AS_HELP_STRING( + [], [enable_geos=yes]) + if test x"$enable_geos" != "xno"; then + #----------------------------------------------------------------------- +- # --with-geosconfig +- # +- AC_ARG_WITH([geosconfig], +- [AS_HELP_STRING([--with-geosconfig=FILE], [specify an alternative geos-config file])], +- [GEOSCONFIG="$withval"], [GEOSCONFIG=""]) +- if test "x$GEOSCONFIG" = "x"; then +- # GEOSCONFIG was not specified, so search within the current path +- AC_PATH_PROG([GEOSCONFIG], [geos-config]) +- # If we couldn't find geos-config, display an error +- if test "x$GEOSCONFIG" = "x"; then +- AC_MSG_ERROR([could not find geos-config within the current path. You may need to try re-running configure with a --with-geosconfig parameter.]) +- fi +- else +- # GEOSCONFIG was specified; display a message to the user +- if test "x$GEOSCONFIG" = "xyes"; then +- AC_MSG_ERROR([you must specify a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config]) +- else +- if test -f $GEOSCONFIG; then +- AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG]) +- else +- AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist]) +- fi +- fi +- fi +- # Extract the linker and include flags +- GEOS_LDFLAGS=`$GEOSCONFIG --ldflags` +- GEOS_CFLAGS=-I`$GEOSCONFIG --includes` +- AC_SUBST([GEOS_LDFLAGS]) +- AC_SUBST([GEOS_CFLAGS]) ++ PKG_CHECK_MODULES([GEOS], [geos], , AC_MSG_ERROR(['geos' is required but it doesn't seem to be installed on this system.])) ++ GEOS_LDFLAGS="$GEOS_LIBS" ++ AC_SUBST(GEOS_CFLAGS) ++ AC_SUBST(GEOS_LDFLAGS) + # Ensure that we can parse geos_c.h + CPPFLAGS_SAVE="$CPPFLAGS" + CPPFLAGS="$GEOS_CFLAGS" diff --git a/libspatialite_macros.patch b/libspatialite_macros.patch new file mode 100644 index 0000000..9b71ab7 --- /dev/null +++ b/libspatialite_macros.patch @@ -0,0 +1,12 @@ +diff -rupN --no-dereference libspatialite-5.0.1/configure.ac libspatialite-5.0.1-new/configure.ac +--- libspatialite-5.0.1/configure.ac 2021-03-08 08:57:18.748858216 +0100 ++++ libspatialite-5.0.1-new/configure.ac 2021-03-08 08:57:18.751858215 +0100 +@@ -96,7 +96,7 @@ AC_PROG_INSTALL + AC_PROG_LN_S + AC_PROG_MAKE_SET + AC_LIBTOOL_WIN32_DLL +-AC_PROG_LIBTOOL ++LT_INIT + + # Checks for typedefs, structures, and compiler characteristics. + AC_C_CONST diff --git a/libspatialite_mingw.patch b/libspatialite_mingw.patch new file mode 100644 index 0000000..47b1d05 --- /dev/null +++ b/libspatialite_mingw.patch @@ -0,0 +1,36 @@ +diff -rupN --no-dereference libspatialite-5.0.1/configure.ac libspatialite-5.0.1-new/configure.ac +--- libspatialite-5.0.1/configure.ac 2021-02-07 16:53:46.000000000 +0100 ++++ libspatialite-5.0.1-new/configure.ac 2021-03-08 08:57:18.484858236 +0100 +@@ -489,7 +489,7 @@ AM_CONDITIONAL(MODULE_ONLY, [test x"$ena + #----------------------------------------------------------------------- + + # Checking for MinGW +-AM_CONDITIONAL([MINGW], [test "$target_alias" = "mingw32"]) ++AM_CONDITIONAL([MINGW], [[[[ "$target_alias" = *"mingw32" ]]]]) + # Checking for Mac OsX + AM_CONDITIONAL([MACOSX], [test "$target_alias" = "macosx"]) + # Checking for Android +diff -rupN --no-dereference libspatialite-5.0.1/src/gaiageo/gg_shape.c libspatialite-5.0.1-new/src/gaiageo/gg_shape.c +--- libspatialite-5.0.1/src/gaiageo/gg_shape.c 2021-02-07 16:53:46.000000000 +0100 ++++ libspatialite-5.0.1-new/src/gaiageo/gg_shape.c 2021-03-08 08:57:18.485858236 +0100 +@@ -58,7 +58,7 @@ the terms of any one of the MPL, the GPL + #endif + + #ifdef _WIN32 +-#include ++#include + #endif + + #if OMIT_ICONV == 0 /* if ICONV is disabled no SHP support is available */ +diff -rupN --no-dereference libspatialite-5.0.1/test/scandir4win.h libspatialite-5.0.1-new/test/scandir4win.h +--- libspatialite-5.0.1/test/scandir4win.h 2021-02-07 16:53:47.000000000 +0100 ++++ libspatialite-5.0.1-new/test/scandir4win.h 2021-03-08 08:57:18.485858236 +0100 +@@ -11,7 +11,7 @@ even implied + + #ifdef _WIN32 + +-#include ++#include + #include + #include +