Skip to content

Commit

Permalink
foundationdb: new port
Browse files Browse the repository at this point in the history
* new port for foundationdb starting at version 6.3.12
  • Loading branch information
brianwells authored and herbygillot committed Apr 26, 2021
1 parent 67ce75e commit a5c104b
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions databases/foundationdb/Portfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0
PortGroup github 1.0
PortGroup cmake 1.1

github.setup apple foundationdb 6.3.12
revision 0

categories databases
license Apache-2
maintainers {me.com:spam_brian @brianwells} openmaintainer
platforms darwin
description FoundationDB is a distributed database providing ACID transactions.
long_description \
FoundationDB is a scalable, fault-tolerant, ordered \
key-value store with full ACID transactions. This port \
will install version ${version} of the FoundationDB \
binaries suitable for development on macOS.

homepage https://www.foundationdb.org/

checksums rmd160 2bf9a258d5db140d232fb6355fc810010824c014 \
sha256 034f69d4ddf7faccd7cae2a6438d64643ac98a3a9c7b3e6ed2a03105c480df95 \
size 9694306

depends_lib-append port:mono

# The FoundationDB build can easily run out of memory and crash,
# so the recommendation is to use "ninja -j1" when building.
use_parallel_build no
cmake.generator Ninja

destroot {
# install compiled binaries

xinstall -d -m 755 ${destroot}${prefix}/bin
xinstall -m 755 ${workpath}/build/packages/bin/fdbcli \
${workpath}/build/packages/bin/fdbbackup \
${destroot}${prefix}/bin
foreach x {backup_agent dr_agent fastrestore_tool fdbdr fdbrestore} {
ln -f -s fdbbackup ${destroot}${prefix}/bin/${x}
}

xinstall -d -m 755 ${destroot}${prefix}/lib
xinstall -m 755 ${workpath}/build/packages/lib/libfdb_c.dylib \
${destroot}${prefix}/lib

xinstall -d -m 755 ${destroot}${prefix}/libexec
xinstall -m 755 ${workpath}/build/packages/bin/fdbmonitor \
${destroot}${prefix}/libexec

xinstall -d -m 755 ${destroot}${prefix}/sbin
xinstall -m 755 ${workpath}/build/packages/bin/fdbserver \
${destroot}${prefix}/sbin

# install header files

xinstall -d -m 755 ${destroot}${prefix}/include/foundationdb
xinstall -m 755 ${worksrcpath}/bindings/c/foundationdb/fdb_c.h \
${workpath}/build/bindings/c/foundationdb/fdb_c_options.g.h \
${worksrcpath}/fdbclient/vexillographer/fdb.options \
${destroot}${prefix}/include/foundationdb

# install sample config files and adjust paths

xinstall -d -m 755 ${destroot}${prefix}/etc/foundationdb
xinstall -m 755 ${worksrcpath}/packaging/osx/foundationdb.conf.new \
${destroot}${prefix}/etc/foundationdb

reinplace "s|/usr/local/etc/|${prefix}/etc/|g" ${destroot}${prefix}/etc/foundationdb/foundationdb.conf.new
reinplace "s|/usr/local/libexec/|${prefix}/sbin/|g" ${destroot}${prefix}/etc/foundationdb/foundationdb.conf.new
reinplace "s|/usr/local/foundationdb/backup_agent/backup_agent|${prefix}/bin/backup_agent|g" ${destroot}${prefix}/etc/foundationdb/foundationdb.conf.new
reinplace "s|/usr/local/foundationdb/|${prefix}/foundationdb/|g" ${destroot}${prefix}/etc/foundationdb/foundationdb.conf.new
}

8 comments on commit a5c104b

@herbygillot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianwells FoundationDB is failing to build on the MacPorts Build infrastructure: https://build.macports.org/builders/ports-10.14_x86_64-builder/builds/85107/steps/install-port/logs/stdio

Looks like a case of missing build dependencies, specifically a recent version of Python. The following would add Python 3 as a build dependency:

depends_build-append port:python3

@brianwells
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the port was happy building for macOS 10.15 and 11.x since these ship with /usr/bin/python3 installed. This morning I'll setup a 10.14 machine here and make sure there is nothing else that needs to be added to the Portfile for successful building. Is macOS 10.14 the oldest I should test with?

@herbygillot
Copy link
Member

@herbygillot herbygillot commented on a5c104b Apr 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is macOS 10.14 the oldest I should test with?

I would say that sounds reasonable. And yes, you're right; it only built on 10.15 and 11 x86_64: https://ports.macports.org/port/foundationdb/summary

Basically you should use Python 3 and as many other dependencies as possible directly provided by MacPorts, and not those that ship with macOS. You would declare those dependencies using depends_build-append and depends_lib-append as appropriate.

@brianwells
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I tried building on 10.14 and it worked fine because the Xcode command line tools include the required python3. Will need to better replicate the build environment that the infrastructure is using before I can repeat the problem locally.

@herbygillot
Copy link
Member

@herbygillot herbygillot commented on a5c104b Apr 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to make a PR adding Python 3 as a dependency since we already know that the port is missing this.

Adding the line as I specified in my first comment will have foundationdb using MacPorts Python 3 on all macOS versions, so we can at least see if that solves the problem, or at least gets us to the next hurdle.

@brianwells
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there is no port python3 so I tested with depends_build-append port:python39 and it works on 10.14 after removing the Xcode-provide python to make sure it is using the one from MacPorts.

@herbygillot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My fault, you're 100% correct, I misspoke, I did indeed mean python39. 🤦🏾‍♂️ You can open a new pull request with that change and the revision incremented and we can commit.

@brianwells
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help. Tested the change and opened a new PR.

Please sign in to comment.