Ping.

Ashton Fagg <ash...@fagg.id.au> writes:

> The attached diff updates databases/leveldb to the latest version
> (1.22).
>
> The changelog can be viewed here:
>
> https://github.com/google/leveldb/releases/tag/1.22
>
> It seems the previous version (1.21) introduced a CMake build. But the
> OpenBSD port had not yet adopted it. Here, I've updated the port to the
> latest version and converted it to use the CMake build - which
> drastically simplifies the port Makefile. More to the point, it seems
> that the "old way" of building has been ripped out of this version.
>
> The port contains the following changes:
>
> - Conversion to use the new CMake build
>
> - A convenience patch to the CMakeLists.txt to make sure the
>   documentation ends up in the right place on install.
>
> - Removal of some old stuff related to the old way of building the library.
>
> - General formatting stuff in the Makefile - there was an over-length
>   line, detected by portcheck.
>
> - Add myself as maintainer.
>
> The port has been tested on amd64. configure, build, fake, package,
> install and uninstall all work. The test suite passes 100%.
>
> A quick grep turns up no dependent ports.
>
> Suggestions and comments welcome.
>
> Cheers,
>
> Ash

diff --git a/databases/leveldb/Makefile b/databases/leveldb/Makefile
index cf6320ce74b..8831f06deb6 100644
--- a/databases/leveldb/Makefile
+++ b/databases/leveldb/Makefile
@@ -1,40 +1,30 @@
 # $OpenBSD: Makefile,v 1.20 2019/07/12 20:43:53 sthen Exp $
 
-#'atomic_pointer.h: error Please implement AtomicPointer for this platform' on other archs
-ONLY_FOR_ARCHS =	i386 amd64
+#'atomic_pointer.h: error Please implement AtomicPointer for this
+# platform' on other archs
+ONLY_FOR_ARCHS=		i386 amd64
 
-COMMENT =	fast key-value storage library
+COMMENT=		fast key-value storage library
+CATEGORIES=		databases devel
+GH_ACCOUNT=		google
+GH_PROJECT=		leveldb
+GH_TAGNAME=		1.22
 
-GH_ACCOUNT =	google
-GH_PROJECT =	leveldb
-GH_TAGNAME =	v1.20
+SHARED_LIBS=	  	leveldb	3.0 # 0.0
 
-SHARED_LIBS +=  leveldb                   2.0 # 0.0
-
-CATEGORIES =	databases devel
+MAINTAINER=		Ashton Fagg <ash...@fagg.id.au>
 
 # BSD3
-PERMIT_PACKAGE =	Yes
-
-MAKE_ENV =		CC="${CC}" CXX="${CXX}" OPT="${CXXFLAGS}" \
-			SHARED_VERSION_MAJOR=${LIBleveldb_VERSION:R} \
-			SHARED_VERSION_MINOR=${LIBleveldb_VERSION:E}
-
-USE_GMAKE =		Yes
+PERMIT_PACKAGE=		Yes
 
-TEST_TARGET =		check
+WANTLIB=		${COMPILER_LIBCXX} m pthread
 
-DOC =			${PREFIX}/share/doc/leveldb/
+# C++11
+COMPILER= 		base-clang ports-gcc
+MODULES=  		devel/cmake
 
-do-install:
-	${INSTALL_DATA_DIR} ${PREFIX}/include/leveldb
-	${INSTALL_DATA} ${WRKSRC}/include/leveldb/* ${PREFIX}/include/leveldb
-	${INSTALL_DATA} ${WRKSRC}/out-static/*.a \
-		${PREFIX}/lib
-	${INSTALL_DATA} ${WRKSRC}/out-shared/libleveldb.so.${LIBleveldb_VERSION} \
-		${PREFIX}/lib/libleveldb.so.${LIBleveldb_VERSION}
-	${INSTALL_DATA_DIR} ${DOC}
-	${INSTALL_DATA} ${WRKSRC}/doc/*.md ${DOC}
-	${INSTALL_DATA} ${WRKSRC}/LICENSE ${DOC}
+CONFIGURE_ARGS+=	-DBUILD_SHARED_LIBS=on \
+			-DLEVELDB_INSTALL=on \
+			-DLEVELDB_BUILD_BENCHMARKS=off
 
 .include <bsd.port.mk>
diff --git a/databases/leveldb/distinfo b/databases/leveldb/distinfo
index abd336a865d..ae4cf1d8f0c 100644
--- a/databases/leveldb/distinfo
+++ b/databases/leveldb/distinfo
@@ -1,2 +1,2 @@
-SHA256 (leveldb-1.20.tar.gz) = 9avotbIJwvNlYLdfMs5hQS85opIvcEWudkosIzNbZmQ=
-SIZE (leveldb-1.20.tar.gz) = 223141
+SHA256 (leveldb-1.22.tar.gz) = VUI8rJ4zBvSpUCxzigAeSjOdGjj/vudXLUoH1dY5SbI=
+SIZE (leveldb-1.22.tar.gz) = 239365
diff --git a/databases/leveldb/patches/patch-CMakeLists_txt b/databases/leveldb/patches/patch-CMakeLists_txt
new file mode 100644
index 00000000000..06c01609581
--- /dev/null
+++ b/databases/leveldb/patches/patch-CMakeLists_txt
@@ -0,0 +1,22 @@
+$OpenBSD$
+
+This adds the install logic for the documentation. Keeps the Makefile nice and tidy.
+
+Index: CMakeLists.txt
+--- CMakeLists.txt.orig
++++ CMakeLists.txt
+@@ -448,4 +448,14 @@ if(LEVELDB_INSTALL)
+       "${PROJECT_BINARY_DIR}/leveldbConfigVersion.cmake"
+     DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/leveldb"
+   )
++  install(
++    FILES
++      "${PROJECT_SOURCE_DIR}/doc/impl.md"
++      "${PROJECT_SOURCE_DIR}/doc/index.md"
++      "${PROJECT_SOURCE_DIR}/doc/log_format.md"
++      "${PROJECT_SOURCE_DIR}/doc/table_format.md"
++      "${PROJECT_SOURCE_DIR}/LICENSE"
++   DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/leveldb"
++  )
++    
+ endif(LEVELDB_INSTALL)
diff --git a/databases/leveldb/patches/patch-Makefile b/databases/leveldb/patches/patch-Makefile
deleted file mode 100644
index 292fb04cba0..00000000000
--- a/databases/leveldb/patches/patch-Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-$OpenBSD: patch-Makefile,v 1.5 2018/01/03 20:25:25 rsadowski Exp $
-
-Allow SHARED_MAJOR and SHARED_MINOR to be overridden.
-This doesn't affect kMajorVersion and kMinorVersion in db.h,
-but nothing uses them anyway.
-
-Index: Makefile
---- Makefile.orig
-+++ Makefile
-@@ -121,8 +121,8 @@ SHARED_LIBS = $(SHARED_LIB1)
- SHARED_MEMENVLIB = $(SHARED_OUTDIR)/libmemenv.a
- else
- # Update db.h if you change these.
--SHARED_VERSION_MAJOR = 1
--SHARED_VERSION_MINOR = 20
-+SHARED_VERSION_MAJOR ?= 1
-+SHARED_VERSION_MINOR ?= 20
- SHARED_LIB1 = libleveldb.$(PLATFORM_SHARED_EXT)
- SHARED_LIB2 = $(SHARED_LIB1).$(SHARED_VERSION_MAJOR)
- SHARED_LIB3 = $(SHARED_LIB1).$(SHARED_VERSION_MAJOR).$(SHARED_VERSION_MINOR)
-@@ -135,7 +135,7 @@ SHARED_MEMENVLIB = $(SHARED_OUTDIR)/libmemenv.a
- endif
- 
- $(SHARED_OUTDIR)/$(SHARED_LIB3): $(SHARED_LIBOBJECTS)
--	$(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED_LIB2) $(SHARED_LIBOBJECTS) -o $(SHARED_OUTDIR)/$(SHARED_LIB3) $(LIBS)
-+	$(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS) $(SHARED_LIBOBJECTS) -o $(SHARED_OUTDIR)/$(SHARED_LIB3) $(LIBS)
- 
- endif  # PLATFORM_SHARED_EXT
- 
diff --git a/databases/leveldb/patches/patch-build_detect_platform b/databases/leveldb/patches/patch-build_detect_platform
deleted file mode 100644
index 076a666a2f7..00000000000
--- a/databases/leveldb/patches/patch-build_detect_platform
+++ /dev/null
@@ -1,69 +0,0 @@
-$OpenBSD: patch-build_detect_platform,v 1.7 2018/01/03 20:25:25 rsadowski Exp $
-
-Don't use SONAME.
-Skip checks for optional features.
-
-Index: build_detect_platform
---- build_detect_platform.orig
-+++ build_detect_platform
-@@ -123,6 +123,7 @@ case "$TARGET_OS" in
-         PLATFORM_LDFLAGS="-pthread"
-         PORT_FILE=port/port_posix.cc
-         PORT_SSE_FILE=port/port_posix_sse.cc
-+        PLATFORM_SHARED_LDFLAGS="-shared"
-         ;;
-     DragonFly)
-         PLATFORM=OS_DRAGONFLYBSD
-@@ -187,51 +188,7 @@ if [ "$CROSS_COMPILE" = "true" ]; then
-     # Cross-compiling; do not try any compilation tests.
-     true
- else
--    CXXOUTPUT="${TMPDIR}/leveldb_build_detect_platform-cxx.$$"
--
--    # If -std=c++0x works, use <atomic> as fallback for when memory barriers
--    # are not available.
--    $CXX $CXXFLAGS -std=c++0x -x c++ - -o $CXXOUTPUT 2>/dev/null  <<EOF
--      #include <atomic>
--      int main() {}
--EOF
--    if [ "$?" = 0 ]; then
--        COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX -DLEVELDB_ATOMIC_PRESENT"
--        PLATFORM_CXXFLAGS="-std=c++0x"
--    else
--        COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX"
--    fi
--
--    # Test whether Snappy library is installed
--    # http://code.google.com/p/snappy/
--    $CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT 2>/dev/null  <<EOF
--      #include <snappy.h>
--      int main() {}
--EOF
--    if [ "$?" = 0 ]; then
--        COMMON_FLAGS="$COMMON_FLAGS -DSNAPPY"
--        PLATFORM_LIBS="$PLATFORM_LIBS -lsnappy"
--    fi
--
--    # Test whether tcmalloc is available
--    $CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT -ltcmalloc 2>/dev/null  <<EOF
--      int main() {}
--EOF
--    if [ "$?" = 0 ]; then
--        PLATFORM_LIBS="$PLATFORM_LIBS -ltcmalloc"
--    fi
--
--    rm -f $CXXOUTPUT 2>/dev/null
--
--    # Test if gcc SSE 4.2 is supported
--    $CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT -msse4.2 2>/dev/null  <<EOF
--      int main() {}
--EOF
--    if [ "$?" = 0 ]; then
--        PLATFORM_SSEFLAGS="-msse4.2"
--    fi
--
--    rm -f $CXXOUTPUT 2>/dev/null
-+    COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX"
- fi
- 
- # Use the SSE 4.2 CRC32C intrinsics iff runtime checks indicate compiler supports them.
diff --git a/databases/leveldb/pkg/PLIST b/databases/leveldb/pkg/PLIST
index 7b312528148..56d4fbea8bc 100644
--- a/databases/leveldb/pkg/PLIST
+++ b/databases/leveldb/pkg/PLIST
@@ -6,6 +6,7 @@ include/leveldb/comparator.h
 include/leveldb/db.h
 include/leveldb/dumpfile.h
 include/leveldb/env.h
+include/leveldb/export.h
 include/leveldb/filter_policy.h
 include/leveldb/iterator.h
 include/leveldb/options.h
@@ -14,9 +15,13 @@ include/leveldb/status.h
 include/leveldb/table.h
 include/leveldb/table_builder.h
 include/leveldb/write_batch.h
-lib/libleveldb.a
+lib/cmake/
+lib/cmake/leveldb/
+lib/cmake/leveldb/leveldbConfig.cmake
+lib/cmake/leveldb/leveldbConfigVersion.cmake
+lib/cmake/leveldb/leveldbTargets${MODCMAKE_BUILD_SUFFIX}
+lib/cmake/leveldb/leveldbTargets.cmake
 @lib lib/libleveldb.so.${LIBleveldb_VERSION}
-lib/libmemenv.a
 share/doc/leveldb/
 share/doc/leveldb/LICENSE
 share/doc/leveldb/impl.md

Reply via email to