From 617db2df96a75f7808d544b57aa97d9859377e84 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Fri, 20 Apr 2018 06:35:35 -0500 Subject: foundationdb: init at 5.1.7 Signed-off-by: Austin Seipp --- pkgs/servers/foundationdb/default.nix | 99 +++++++++++++++++++++++++ pkgs/servers/foundationdb/fix-scm-version.patch | 42 +++++++++++ pkgs/servers/foundationdb/ldflags.patch | 90 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 4 files changed, 233 insertions(+) create mode 100644 pkgs/servers/foundationdb/default.nix create mode 100644 pkgs/servers/foundationdb/fix-scm-version.patch create mode 100644 pkgs/servers/foundationdb/ldflags.patch (limited to 'pkgs') diff --git a/pkgs/servers/foundationdb/default.nix b/pkgs/servers/foundationdb/default.nix new file mode 100644 index 000000000000..95326b4c1c6c --- /dev/null +++ b/pkgs/servers/foundationdb/default.nix @@ -0,0 +1,99 @@ +{ stdenv, fetchurl, fetchFromGitHub +, which, findutils, m4, gawk, python, openjdk, mono58, libressl_2_6 +}: + +let + version = "5.1.7"; + branch = "release-5.1"; + rev = "9ad8d02386d4a6a5efecf898df80f2747695c627"; + sha256 = "1rc472ih24f9s5g3xmnlp3v62w206ny0pvvw02bzpix2sdrpbp06"; + + # hysterical raisins dictate a version of boost this old. however, + # we luckily do not need to build anything, we just need the header + # files. + boost152 = stdenv.mkDerivation rec { + name = "boost-headers-1.52.0"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_52_0.tar.bz2"; + sha256 = "14mc7gsnnahdjaxbbslzk79rc0d12h1i681cd3srdwr3fzynlar2"; + }; + + buildPhase = ":"; + configurePhase = ":"; + installPhase = '' + mkdir -p $out/include/ + cp -R boost $out/include/ + ''; + }; + +in stdenv.mkDerivation rec { + name = "foundationdb-${version}"; + inherit version; + + src = fetchFromGitHub { + owner = "apple"; + repo = "foundationdb"; + inherit rev sha256; + }; + + nativeBuildInputs = [ gawk which m4 findutils boost152 mono58 ]; + buildInputs = [ python openjdk libressl_2_6 ]; + + patches = + [ ./fix-scm-version.patch + ./ldflags.patch + ]; + + postPatch = '' + substituteInPlace ./build/scver.mk \ + --subst-var-by NIXOS_FDB_VERSION_ID "${rev}" \ + --subst-var-by NIXOS_FDB_SCBRANCH "${branch}" + + substituteInPlace ./Makefile \ + --replace 'shell which ccache' 'shell true' \ + --replace -Werror "" + + substituteInPlace ./Makefile \ + --replace libstdc++_pic libstdc++ + + substituteInPlace ./build/link-validate.sh \ + --replace 'exit 1' '#exit 1' + + patchShebangs . + ''; + + enableParallelBuilding = true; + makeFlags = [ "all" "fdb_c" "KVRELEASE=1" ]; + + configurePhase = ":"; + installPhase = '' + mkdir -vp $out/{bin,libexec/plugins} $lib/lib $dev/include/foundationdb + + cp -v ./lib/libfdb_c.so $lib/lib + cp -v ./lib/libFDBLibTLS.so $out/libexec/plugins/FDBLibTLS.so + + cp -v ./bindings/c/foundationdb/fdb_c.h $dev/include/foundationdb + cp -v ./bindings/c/foundationdb/fdb_c_options.g.h $dev/include/foundationdb + + for x in fdbbackup fdbcli fdbserver fdbmonitor; do + cp -v "./bin/$x" $out/bin; + done + + ln -sfv $out/bin/fdbbackup $out/bin/dr_agent + ln -sfv $out/bin/fdbbackup $out/bin/fdbrestore + ln -sfv $out/bin/fdbbackup $out/bin/fdbdr + + ln -sfv $out/bin/fdbbackup $out/libexec/backup_agent + ''; + + outputs = [ "out" "lib" "dev" ]; + + meta = with stdenv.lib; { + description = "Open source, distributed, transactional key-value store"; + homepage = https://www.foundationdb.org; + license = licenses.asl20; + platforms = platforms.linux; + maintainers = with maintainers; [ thoughtpolice ]; + }; +} diff --git a/pkgs/servers/foundationdb/fix-scm-version.patch b/pkgs/servers/foundationdb/fix-scm-version.patch new file mode 100644 index 000000000000..0e0df7ade82b --- /dev/null +++ b/pkgs/servers/foundationdb/fix-scm-version.patch @@ -0,0 +1,42 @@ +diff --git a/build/scver.mk b/build/scver.mk +index bdae8be..7539864 100644 +--- a/build/scver.mk ++++ b/build/scver.mk +@@ -98,33 +98,10 @@ endif + GITPRESENT := $(wildcard $(FDBDIR)/.git) + HGPRESENT := $(wildcard $(FDBDIR)/.hg) + +-# Use Git, if not missing +-ifneq ($(GITPRESENT),) +- SCVER := $(shell cd "$(FDBDIR)" && git --version 2>/dev/null) +- ifneq ($(SCVER),) +- VERSION_ID := $(shell cd "$(FDBDIR)" && git rev-parse --verify HEAD) +- SOURCE_CONTROL := GIT +- SCBRANCH := $(shell cd "$(FDBDIR)" && git rev-parse --abbrev-ref HEAD) +- else +-$(error Missing git executable on $(PLATFORM) ) +- endif +-# Otherwise, use Mercurial +-else +- # Otherwise, use Mercurial, if not missing +- ifneq ($(HGPRESENT),) +- SCVER := $(shell cd "$(FDBDIR)" && hg --version 2>/dev/null) +- ifdef SCVER +- VERSION_ID := $(shell cd "$(FDBDIR)" && hg id -n) +- SOURCE_CONTROL := MERCURIAL +- SCBRANCH := $(shell cd "$(FDBDIR)" && hg branch) +- else +-$(error Missing hg executable on $(PLATFORM)) +- endif +- else +- FDBFILES := (shell ls -la $(FDBDIR)) +-$(error Missing source control information for source on $(PLATFORM) in directory: $(FDBDIR) with files: $(FDBFILES)) +- endif +-endif ++# NixOS-specific non-VCS packaging, filled out by the nix build ++SOURCE_CONTROL := GIT ++VERSION_ID := @NIXOS_FDB_VERSION_ID@ ++SCBRANCH := @NIXOS_FDB_SCBRANCH@ + + # Set the RELEASE variable based on the KVRELEASE variable. + ifeq ($(KVRELEASE),1) diff --git a/pkgs/servers/foundationdb/ldflags.patch b/pkgs/servers/foundationdb/ldflags.patch new file mode 100644 index 000000000000..4d523a7ecdd3 --- /dev/null +++ b/pkgs/servers/foundationdb/ldflags.patch @@ -0,0 +1,90 @@ +diff --git a/FDBLibTLS/local.mk b/FDBLibTLS/local.mk +index 0b6eac8..b1891ca 100644 +--- a/FDBLibTLS/local.mk ++++ b/FDBLibTLS/local.mk +@@ -1,6 +1,5 @@ + FDBLibTLS_CFLAGS := -fPIC -I/usr/local/include -I$(BOOSTDIR) +-FDBLibTLS_STATIC_LIBS := -ltls -lssl -lcrypto +-FDBLibTLS_LDFLAGS := -L/usr/local/lib -static-libstdc++ -static-libgcc -lrt ++FDBLibTLS_LDFLAGS := -L/usr/local/lib -static-libstdc++ -static-libgcc -lrt -ltls -lssl -lcrypto + FDBLibTLS_LDFLAGS += -Wl,-soname,FDBLibTLS.so -Wl,--version-script=FDBLibTLS/FDBLibTLS.map + + # The plugin isn't a typical library, so it feels more sensible to have a copy +diff --git a/bindings/c/local.mk b/bindings/c/local.mk +index 44f0c31..7aea5a4 100644 +--- a/bindings/c/local.mk ++++ b/bindings/c/local.mk +@@ -29,8 +29,8 @@ fdb_c_tests_HEADERS := -Ibindings/c + CLEAN_TARGETS += fdb_c_tests_clean + + ifeq ($(PLATFORM),linux) +- fdb_c_LIBS += lib/libstdc++.a -lm -lpthread -lrt -ldl +- fdb_c_LDFLAGS += -Wl,--version-script=bindings/c/fdb_c.map -static-libgcc -Wl,-z,nodelete ++ fdb_c_LIBS += lib/libstdc++.a ++ fdb_c_LDFLAGS += -Wl,--version-script=bindings/c/fdb_c.map -static-libgcc -Wl,-z,nodelete -lm -lpthread -lrt -ldl + fdb_c_tests_LIBS += -lpthread + endif + +diff --git a/bindings/flow/tester/local.mk b/bindings/flow/tester/local.mk +index 2ef4fcb..6e59625 100644 +--- a/bindings/flow/tester/local.mk ++++ b/bindings/flow/tester/local.mk +@@ -35,8 +35,7 @@ _fdb_flow_tester_clean: + @rm -rf bindings/flow/bin + + ifeq ($(PLATFORM),linux) +- fdb_flow_tester_LIBS += -ldl -lpthread -lrt +- fdb_flow_tester_LDFLAGS += -static-libstdc++ -static-libgcc ++ fdb_flow_tester_LDFLAGS += -static-libstdc++ -static-libgcc -ldl -lpthread -lrt + else ifeq ($(PLATFORM),osx) + fdb_flow_tester_LDFLAGS += -lc++ + endif +diff --git a/fdbbackup/local.mk b/fdbbackup/local.mk +index 033fe7d..865fc92 100644 +--- a/fdbbackup/local.mk ++++ b/fdbbackup/local.mk +@@ -25,8 +25,7 @@ fdbbackup_LDFLAGS := $(fdbrpc_LDFLAGS) + fdbbackup_LIBS := lib/libfdbclient.a lib/libfdbrpc.a lib/libflow.a + + ifeq ($(PLATFORM),linux) +- fdbbackup_LIBS += -ldl -lpthread -lrt +- fdbbackup_LDFLAGS += -static-libstdc++ -static-libgcc ++ fdbbackup_LDFLAGS += -static-libstdc++ -static-libgcc -ldl -lpthread -lrt + + # GPerfTools profiler (uncomment to use) + # fdbbackup_CFLAGS += -I/opt/gperftools/include -DUSE_GPERFTOOLS=1 +diff --git a/fdbcli/local.mk b/fdbcli/local.mk +index 81a4a42..892c079 100644 +--- a/fdbcli/local.mk ++++ b/fdbcli/local.mk +@@ -22,14 +22,13 @@ + + fdbcli_CFLAGS := $(fdbclient_CFLAGS) + fdbcli_LDFLAGS := $(fdbrpc_LDFLAGS) +-fdbcli_LIBS := lib/libfdbclient.a lib/libfdbrpc.a lib/libflow.a -ldl ++fdbcli_LIBS := lib/libfdbclient.a lib/libfdbrpc.a lib/libflow.a + fdbcli_STATIC_LIBS := + + fdbcli_GENERATED_SOURCES += versions.h + + ifeq ($(PLATFORM),linux) +- fdbcli_LDFLAGS += -static-libstdc++ -static-libgcc +- fdbcli_LIBS += -lpthread -lrt ++ fdbcli_LDFLAGS += -static-libstdc++ -static-libgcc -lpthread -lrt -ldl + else ifeq ($(PLATFORM),osx) + fdbcli_LDFLAGS += -lc++ + endif +diff --git a/fdbserver/local.mk b/fdbserver/local.mk +index 78cad1b..36f2c0f 100644 +--- a/fdbserver/local.mk ++++ b/fdbserver/local.mk +@@ -25,8 +25,7 @@ fdbserver_LDFLAGS := $(fdbrpc_LDFLAGS) + fdbserver_LIBS := lib/libfdbclient.a lib/libfdbrpc.a lib/libflow.a + + ifeq ($(PLATFORM),linux) +- fdbserver_LIBS += -ldl -lpthread -lrt +- fdbserver_LDFLAGS += -static-libstdc++ -static-libgcc ++ fdbserver_LDFLAGS += -static-libstdc++ -static-libgcc -ldl -lpthread -lrt + + # GPerfTools profiler (uncomment to use) + # fdbserver_CFLAGS += -I/opt/gperftools/include -DUSE_GPERFTOOLS=1 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 578ff7f2cc5e..67a5390aa6aa 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2409,6 +2409,8 @@ with pkgs; fuseiso = callPackage ../tools/filesystems/fuseiso { }; + foundationdb = callPackage ../servers/foundationdb { stdenv = overrideCC stdenv gcc49; }; + fuse-7z-ng = callPackage ../tools/filesystems/fuse-7z-ng { }; fwknop = callPackage ../tools/security/fwknop { }; -- cgit 1.4.1