diff --git a/ports/librttopo/CONTROL b/ports/librttopo/CONTROL new file mode 100644 index 00000000000..fd8e85fbbcd --- /dev/null +++ b/ports/librttopo/CONTROL @@ -0,0 +1,5 @@ +Source: librttopo +Version: 1.1.0-2 +Homepage: https://git.osgeo.org/gitea/rttopo/librttopo +Description: The RT Topology Library exposes an API to create and manage standard (ISO 13249 aka SQL/MM) topologies using user-provided [data stores] (doc/DATASTORES.md) and released under the GNU GPL license (version 2 or later). +Build-Depends: geos diff --git a/ports/librttopo/fix-geoconfig.patch b/ports/librttopo/fix-geoconfig.patch new file mode 100644 index 00000000000..db6910c8835 --- /dev/null +++ b/ports/librttopo/fix-geoconfig.patch @@ -0,0 +1,37 @@ +diff --git a/configure.ac b/configure.ac +index a9561069c..7adef1bf5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -87,6 +87,7 @@ AC_CONFIG_FILES([Makefile \ + #----------------------------------------------------------------------- + # --with-geosconfig + # ++if 0; then + AC_ARG_WITH([geosconfig], + [AS_HELP_STRING([--with-geosconfig=FILE], [specify an alternative geos-config file])], + [GEOSCONFIG="$withval"], [GEOSCONFIG=""]) +@@ -112,6 +113,7 @@ fi + # Extract the linker and include flags + GEOS_LDFLAGS=`$GEOSCONFIG --ldflags` + GEOS_CFLAGS=-I`$GEOSCONFIG --includes` ++fi + AC_SUBST([GEOS_LDFLAGS]) + AC_SUBST([GEOS_CFLAGS]) + # Ensure that we can parse geos_c.h +@@ -120,6 +122,7 @@ CPPFLAGS="$GEOS_CFLAGS" + AC_CHECK_HEADERS([geos_c.h],, [AC_MSG_ERROR([could not find geos_c.h - you may need to specify the directory of a geos-config file using --with-geosconfig])]) + CPPFLAGS="$CPPFLAGS_SAVE" + # Ensure we can link against libgeos_c ++if 0; then + LIBS_SAVE="$LIBS" + LIBS="$GEOS_LDFLAGS" + AC_SEARCH_LIBS(GEOSContext_setErrorMessageHandler_r,geos_c,,AC_MSG_ERROR([could not find libgeos_c (or obsolete 'libgeos_c' < v.3.5.0 found) - you may need to specify the directory of a geos-config file using --with-geosconfig])) +@@ -127,6 +130,8 @@ LIBS="$LIBS_SAVE" + LIBS="$LIBS $GEOS_LDFLAGS -lgeos_c" + GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'` + GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'` ++fi ++LIBS="$LIBS $GEOS_LDFLAGS" + RTGEOM_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION" + AC_DEFINE_UNQUOTED([RTGEOM_GEOS_VERSION], [$RTGEOM_GEOS_VERSION], [GEOS library version]) + AC_SUBST([RTGEOM_GEOS_VERSION]) diff --git a/ports/librttopo/fix-makefiles.patch b/ports/librttopo/fix-makefiles.patch new file mode 100644 index 00000000000..41c6c8f9268 --- /dev/null +++ b/ports/librttopo/fix-makefiles.patch @@ -0,0 +1,35 @@ +diff --git a/makefile.vc b/makefile.vc +index 1f790f0de..2f7e00f7b 100644 +--- a/makefile.vc ++++ b/makefile.vc +@@ -17,11 +17,11 @@ LIBOBJ = src\box2d.obj src\bytebuffer.obj src\g_box.obj \ + src\rtout_kml.obj src\rtout_svg.obj src\rtout_twkb.obj src\rtout_wkb.obj \ + src\rtout_wkt.obj src\rtout_x3d.obj src\rtpoint.obj src\rtpoly.obj src\rtprint.obj \ + src\rtpsurface.obj src\rtspheroid.obj src\rtstroke.obj src\rttin.obj src\rttree.obj \ +- src\rttriangle.obj src\rtutil.obj src\stringbuffer.obj src\varint.obj ++ src\rttriangle.obj src\rtutil.obj src\stringbuffer.obj src\varint.obj src\rtt_tpsnap.obj + + LIBRTTOPO_DLL = librttopo$(VERSION).dll + +-CFLAGS = /nologo -IC:\OSGeo4W\include -I. -Iheaders $(OPTFLAGS) ++CFLAGS = /nologo -I. -Iheaders $(OPTFLAGS) + + default: all + + +diff --git a/nmake.opt b/nmake.opt +index 938979df1..ea80dab00 100644 +--- a/nmake.opt ++++ b/nmake.opt +@@ -1,9 +1,8 @@ + # Directory tree where RTTOPO will be installed. +-INSTDIR=C:\OSGeo4W ++INSTDIR=$(INSTALLDIR) + + # Uncomment the first for an optimized build, or the second for debug. +-OPTFLAGS= /nologo /Ox /fp:precise /W4 /MD /D_CRT_SECURE_NO_WARNINGS \ +- /DDLL_EXPORT ++OPTFLAGS= /nologo /fp:precise /W4 $(CL_FLAGS) /D_CRT_SECURE_NO_WARNINGS + #OPTFLAGS= /nologo /Zi /MD /Fdlibrttopo.pdb /DDLL_EXPORT + + # Set the version number for the DLL. Normally we leave this blank since diff --git a/ports/librttopo/portfile.cmake b/ports/librttopo/portfile.cmake new file mode 100644 index 00000000000..77d7b5932b3 --- /dev/null +++ b/ports/librttopo/portfile.cmake @@ -0,0 +1,54 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +# NOTE: update the version and checksum for new LIBRTTOPO release +set(LIBRTTOPO_VERSION_STR "1.1.0-2") +set(LIBRTTOPO_PACKAGE_SUM "cc2f646dd9ac3099c77e621984cdd2baa676ed1d8e6aaa9642afe2855e6fdef585603cc052ca09084204a1325e38bb626133072fbb5080e8adc369cc4854c40e") + +vcpkg_download_distfile(ARCHIVE + URLS "https://salsa.debian.org/debian-gis-team/librttopo/-/archive/debian/${LIBRTTOPO_VERSION_STR}/librttopo-debian-${LIBRTTOPO_VERSION_STR}.tar.gz" + FILENAME "librttopo${LIBRTTOPO_VERSION_STR}.zip" + SHA512 ${LIBRTTOPO_PACKAGE_SUM} +) + +vcpkg_extract_source_archive_ex( + ARCHIVE ${ARCHIVE} + OUT_SOURCE_PATH SOURCE_PATH + PATCHES + fix-makefiles.patch + fix-geoconfig.patch +) + +if (VCPKG_TARGET_IS_WINDOWS) + set(SRID_MAX 999999) + set(SRID_USR_MAX 998999) + configure_file(${CMAKE_CURRENT_LIST_DIR}/rttopo_config.h.in ${SOURCE_PATH}/src/rttopo_config.h @ONLY) + configure_file(${SOURCE_PATH}/headers/librttopo_geom.h.in ${SOURCE_PATH}/headers/librttopo_geom.h @ONLY) + + vcpkg_build_nmake( + SOURCE_PATH ${SOURCE_PATH} + TARGET librttopo.lib + ) + + file(GLOB LIBRTTOPO_INCLUDE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/headers/*.h) + file(COPY ${LIBRTTOPO_INCLUDE} DESTINATION ${CURRENT_PACKAGES_DIR}/include) + + file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/librttopo.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) + file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/librttopo.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) +elseif (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX) # Build in UNIX + vcpkg_configure_make( + SOURCE_PATH ${SOURCE_PATH} + AUTOCONFIG + OPTIONS + "GEOS_MAJOR_VERSION=3" + "GEOS_MINOR_VERSION=8" + OPTIONS_DEBUG + "GEOS_LDFLAGS=-lgeos_cd -lgeosd -lm" + OPTIONS_RELEASE + "GEOS_LDFLAGS=-lgeos_c -lgeos -lm" + ) + + vcpkg_install_make() +endif() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/librttopo/rttopo_config.h.in b/ports/librttopo/rttopo_config.h.in new file mode 100644 index 00000000000..b4b1a39299f --- /dev/null +++ b/ports/librttopo/rttopo_config.h.in @@ -0,0 +1,168 @@ +/* src/rttopo_config.h. Generated from rttopo_config.h.in by configure. */ +/* src/rttopo_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the `fdatasync' function. */ +#define HAVE_FDATASYNC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GEOS_C_H 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if `lstat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_LSTAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MATH_H 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the `sqrt' function. */ +/* #undef HAVE_SQRT */ + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_STAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncasecmp' function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* rtgeom version */ +#define LIBRTGEOM_VERSION "1.1.0" + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Must be defined in order to disable debug mode. */ +#undef NDEBUG + +/* Name of package */ +#define PACKAGE "librttopo" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "strk@kbt.io" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "librttopo" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "librttopo 1.1.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "librttopo" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.1.0" + +/* RTGEOM Debug level */ +#define RTGEOM_DEBUG_LEVEL 0 + +/* GEOS library version */ +#define RTGEOM_GEOS_VERSION 38 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Version number of package */ +#define VERSION "1.1.0" + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to empty if the keyword `volatile' does not work. Warning: valid + code using `volatile' can become incorrect without. Disable with care. */ +/* #undef volatile */