Ticket #56288: leveldb.diff

File leveldb.diff, 9.7 KB (added by RJVB (René Bertin), 7 years ago)
  • databases/leveldb/Portfile

    diff --git a/databases/leveldb/Portfile b/databases/leveldb/Portfile
    index 75ae19ceee..3c7515e63a 100644
    a b  
    22
    33PortSystem          1.0
    44PortGroup           github 1.0
    5 
    6 # When trying to build a universal variant, build_detect_platform script mistakenly can't find library snappy
    7 # The following test fails for multiple archs (see https://llvm.org/bugs/show_bug.cgi?id=15403)
    8 #    # Test whether Snappy library is installed
    9 #    # https://code.google.com/p/snappy/
    10 #    $CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT 2>/dev/null  <<EOF
    11 #    #include <snappy.h>
    12 #    int main() {}
    13 #    EOF
    14 # We therefore use muniversal PortGroup
     5PortGroup           cmake 1.1
     6platform darwin {
     7    if {${os.major} < 13} {
     8        PortGroup   cxx11 1.1
     9    }
     10}
    1511PortGroup           muniversal 1.0
    1612
    17 github.setup        google leveldb 1.20 v
     13github.setup        google leveldb 09217fd0677a4fd9713c7a4d774c494a7d3c1f15
     14# v1.20-46-g09217fd
     15version             1.20.46
     16
    1817categories          databases
    1918platforms           darwin
    2019license             BSD
    maintainers nomaintainer 
    2221description         A fast and lightweight key/value database library by Google
    2322long_description    A fast and lightweight key/value database library by Google
    2423
    25 checksums           rmd160  dd72b89d356031709df9a41da2c31ea2e093361d \
    26                     sha256  154d804980d92b08d08dafff8e937ad79a45ef0fe87c9f5d69ea74690f85a933 \
    27                     size    223200
    28 
    29 depends_lib         port:snappy \
    30                     port:gperftools
     24worksrcdir          leveldb-git
     25distname            leveldb-git
    3126
    32 patchfiles          install_name.patch
     27checksums           rmd160  3c85f9e3721ba5b35fa0c69e7cffaa987f4c40c8 \
     28                    sha256  23a342ba2fdaf8f97e238f4a4257e7291ed1cde97dd6ebe302040dea672d3b00 \
     29                    size    226821
    3330
    34 use_configure       no
     31variant tcmalloc description {leveldb uses tcmalloc (but also all applications using leveldb)} {}
    3532
    36 if {[string match *clang* ${configure.cxx}]} {
    37     configure.cxxflags-append -stdlib=${configure.cxx_stdlib}
    38     configure.ldflags-append -stdlib=${configure.cxx_stdlib}
    39 }
     33depends_lib         port:snappy
     34depends_build-append \
     35                    port:sqlite3
    4036
    41 if { [variant_isset universal] } {
    42     foreach arch ${configure.universal_archs} {
    43         lappend merger_build_env(${arch}) \
    44             CFLAGS="${configure.cflags} -arch ${arch}" \
    45             CXXFLAGS="${configure.cxxflags} -arch ${arch}" \
    46             LDFLAGS="${configure.ldflags} -arch ${arch}"
    47     }
     37if {[variant_isset tcmalloc]} {
     38    depends_lib-append \
     39                    port:gperftools
    4840} else {
    49     build.env-append \
    50             CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
    51             CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx]" \
    52             LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]"
     41    patchfiles-append \
     42                    patch-disable-tcmalloc.diff
    5343}
    5444
    55 build.env-append                          \
    56     INSTALL_PATH=${prefix}/lib            \
    57     CC="${configure.cc}"                  \
    58     CXX="${configure.cxx}"                \
    59     OPT="-DNDEBUG"
    60 
    61 # muniversal build requires Makefile
    62 post-extract {
    63     set makefile [open ${worksrcpath}/Makefile-Install "w"]
    64     puts ${makefile} {install:}
    65     puts ${makefile} "\t/usr/bin/install -d -m 0755 \$(DESTDIR)${prefix}/include/leveldb"
    66     puts ${makefile} "\t/usr/bin/install -d -m 0755 \$(DESTDIR)${prefix}/include/helpers/memenv"
    67     puts ${makefile} "\t/usr/bin/install -m 0644 include/leveldb/*.h \$(DESTDIR)${prefix}/include/leveldb"
    68     puts ${makefile} "\t/usr/bin/install -m 0644 helpers/memenv/memenv.h \$(DESTDIR)${prefix}/include/helpers/memenv"
    69     puts ${makefile} "\t/bin/cp -R out-shared/libleveldb* \$(DESTDIR)${prefix}/lib"
    70     puts ${makefile} "\t/usr/bin/install -m 0644 out-static/lib*.a \$(DESTDIR)${prefix}/lib"
    71     close ${makefile}
     45configure.args-append \
     46                    -DBUILD_SHARED_LIBS=ON \
     47                    -DLEVELDB_BUILD_TESTS=OFF
     48
     49post-destroot {
     50    xinstall -m 755 ${build.dir}/leveldbutil ${destroot}${prefix}/bin
     51    if {${os.platform} eq "darwin"} {
     52        system "install_name_tool -change @rpath/libleveldb.dylib ${prefix}/lib/libleveldb.dylib ${destroot}${prefix}/bin/leveldbutil"
     53        ln -s libleveldb.dylib ${destroot}${prefix}/lib/libleveldb.1.dylib
     54    } else {
     55        ln -s libleveldb.so ${destroot}${prefix}/lib/libleveldb.so.1
     56    }
    7257}
    73 
    74 destroot.args-append -f Makefile-Install
  • deleted file databases/leveldb/files/install_name.patch

    diff --git a/databases/leveldb/files/install_name.patch b/databases/leveldb/files/install_name.patch
    deleted file mode 100644
    index 142df6cf92..0000000000
    + -  
    1 https://github.com/google/leveldb/issues/412
    2 https://github.com/google/leveldb/pull/413
    3 --- build_detect_platform.orig  2017-03-01 18:08:02.000000000 -0600
    4 +++ build_detect_platform       2018-03-09 17:08:26.000000000 -0600
    5 @@ -8,7 +8,10 @@
    6  #   CXX                         C++ Compiler path
    7  #   PLATFORM_LDFLAGS            Linker flags
    8  #   PLATFORM_LIBS               Libraries flags
    9 -#   PLATFORM_SHARED_EXT         Extension for shared libraries
    10 +#   PLATFORM_SHARED             Set to 'true' if shared libraries shoull be
    11 +#                               built, empty otherwise.
    12 +#   PLATFORM_SHARED_BASE        Base filename for shared libraries (before version)
    13 +#   PLATFORM_SHARED_EXT         Extension for shared libraries (after version)
    14  #   PLATFORM_SHARED_LDFLAGS     Flags for building shared library
    15  #                               This flag is embedded just before the name
    16  #                               of the shared library without intervening spaces
    17 @@ -59,7 +62,9 @@
    18  PLATFORM_CXXFLAGS=
    19  PLATFORM_LDFLAGS=
    20  PLATFORM_LIBS=
    21 -PLATFORM_SHARED_EXT="so"
    22 +PLATFORM_SHARED=true
    23 +PLATFORM_SHARED_BASE="libleveldb.so"
    24 +PLATFORM_SHARED_EXT=
    25  PLATFORM_SHARED_LDFLAGS="-shared -Wl,-soname -Wl,"
    26  PLATFORM_SHARED_CFLAGS="-fPIC"
    27  PLATFORM_SHARED_VERSIONED=true
    28 @@ -83,7 +88,8 @@
    29      Darwin)
    30          PLATFORM=OS_MACOSX
    31          COMMON_FLAGS="$MEMCMP_FLAG -DOS_MACOSX"
    32 -        PLATFORM_SHARED_EXT=dylib
    33 +        PLATFORM_SHARED_BASE=libleveldb
    34 +        PLATFORM_SHARED_EXT=.dylib
    35          [ -z "$INSTALL_PATH" ] && INSTALL_PATH=`pwd`
    36          PLATFORM_SHARED_LDFLAGS="-dynamiclib -install_name $INSTALL_PATH/"
    37          PORT_FILE=port/port_posix.cc
    38 @@ -154,7 +160,7 @@
    39          [ -z "$INSTALL_PATH" ] && INSTALL_PATH=`pwd`
    40          PORT_FILE=port/port_posix.cc
    41          PORT_SSE_FILE=port/port_posix_sse.cc
    42 -        PLATFORM_SHARED_EXT=
    43 +        PLATFORM_SHARED=false
    44          PLATFORM_SHARED_LDFLAGS=
    45          PLATFORM_SHARED_CFLAGS=
    46          PLATFORM_SHARED_VERSIONED=
    47 @@ -250,6 +256,8 @@
    48  echo "PLATFORM_CCFLAGS=$PLATFORM_CCFLAGS" >> $OUTPUT
    49  echo "PLATFORM_CXXFLAGS=$PLATFORM_CXXFLAGS" >> $OUTPUT
    50  echo "PLATFORM_SSEFLAGS=$PLATFORM_SSEFLAGS" >> $OUTPUT
    51 +echo "PLATFORM_SHARED=$PLATFORM_SHARED" >> $OUTPUT
    52 +echo "PLATFORM_SHARED_BASE=$PLATFORM_SHARED_BASE" >> $OUTPUT
    53  echo "PLATFORM_SHARED_CFLAGS=$PLATFORM_SHARED_CFLAGS" >> $OUTPUT
    54  echo "PLATFORM_SHARED_EXT=$PLATFORM_SHARED_EXT" >> $OUTPUT
    55  echo "PLATFORM_SHARED_LDFLAGS=$PLATFORM_SHARED_LDFLAGS" >> $OUTPUT
    56 --- Makefile.orig       2017-03-01 18:08:02.000000000 -0600
    57 +++ Makefile    2018-03-09 17:14:53.000000000 -0600
    58 @@ -108,13 +108,13 @@
    59  default: all
    60  
    61  # Should we build shared libraries?
    62 -ifneq ($(PLATFORM_SHARED_EXT),)
    63 +ifeq ($(PLATFORM_SHARED),true)
    64  
    65  # Many leveldb test apps use non-exported API's. Only build a subset for testing.
    66  SHARED_ALLOBJS := $(SHARED_LIBOBJECTS) $(SHARED_MEMENVOBJECTS) $(TESTHARNESS)
    67  
    68 +SHARED_LIB1 = $(PLATFORM_SHARED_BASE)$(PLATFORM_SHARED_EXT)
    69  ifneq ($(PLATFORM_SHARED_VERSIONED),true)
    70 -SHARED_LIB1 = libleveldb.$(PLATFORM_SHARED_EXT)
    71  SHARED_LIB2 = $(SHARED_LIB1)
    72  SHARED_LIB3 = $(SHARED_LIB1)
    73  SHARED_LIBS = $(SHARED_LIB1)
    74 @@ -123,9 +123,8 @@
    75  # Update db.h if you change these.
    76  SHARED_VERSION_MAJOR = 1
    77  SHARED_VERSION_MINOR = 20
    78 -SHARED_LIB1 = libleveldb.$(PLATFORM_SHARED_EXT)
    79 -SHARED_LIB2 = $(SHARED_LIB1).$(SHARED_VERSION_MAJOR)
    80 -SHARED_LIB3 = $(SHARED_LIB1).$(SHARED_VERSION_MAJOR).$(SHARED_VERSION_MINOR)
    81 +SHARED_LIB2 = $(PLATFORM_SHARED_BASE).$(SHARED_VERSION_MAJOR)$(PLATFORM_SHARED_EXT)
    82 +SHARED_LIB3 = $(PLATFORM_SHARED_BASE).$(SHARED_VERSION_MAJOR).$(SHARED_VERSION_MINOR)$(PLATFORM_SHARED_EXT)
    83  SHARED_LIBS = $(SHARED_OUTDIR)/$(SHARED_LIB1) $(SHARED_OUTDIR)/$(SHARED_LIB2) $(SHARED_OUTDIR)/$(SHARED_LIB3)
    84  $(SHARED_OUTDIR)/$(SHARED_LIB1): $(SHARED_OUTDIR)/$(SHARED_LIB3)
    85         ln -fs $(SHARED_LIB3) $(SHARED_OUTDIR)/$(SHARED_LIB1)
    86 @@ -137,7 +136,7 @@
    87  $(SHARED_OUTDIR)/$(SHARED_LIB3): $(SHARED_LIBOBJECTS)
    88         $(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED_LIB2) $(SHARED_LIBOBJECTS) -o $(SHARED_OUTDIR)/$(SHARED_LIB3) $(LIBS)
    89  
    90 -endif  # PLATFORM_SHARED_EXT
    91 +endif  # PLATFORM_SHARED
    92  
    93  all: $(SHARED_LIBS) $(SHARED_PROGRAMS) $(STATIC_OUTDIR)/libleveldb.a $(STATIC_OUTDIR)/libmemenv.a $(STATIC_PROGRAMS)
    94  
  • new file databases/leveldb/files/patch-disable-tcmalloc.diff

    diff --git a/databases/leveldb/files/patch-disable-tcmalloc.diff b/databases/leveldb/files/patch-disable-tcmalloc.diff
    new file mode 100644
    index 0000000000..b2934ca0aa
    - +  
     1diff --git CMakeLists.txt CMakeLists.txt
     2index cc1022f..543f72e 100644
     3--- CMakeLists.txt
     4+++ CMakeLists.txt
     5@@ -28,7 +28,7 @@ check_include_file("unistd.h" HAVE_UNISTD_H)
     6 include(CheckLibraryExists)
     7 check_library_exists(crc32c crc32c_value "" HAVE_CRC32C)
     8 check_library_exists(snappy snappy_compress "" HAVE_SNAPPY)
     9-check_library_exists(tcmalloc malloc "" HAVE_TCMALLOC)
     10+# check_library_exists(tcmalloc malloc "" HAVE_TCMALLOC)
     11 
     12 include(CheckSymbolExists)
     13 check_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC)