felt/tippecanoe

Does not build on FreeBSD

Opened this issue · 4 comments

  • on Freebsd make is not GNU make, need to use gmake in its place
  • FreeBSD does not have bash by default, and when it does it's installed in /usr/local/bin not /bin
  • FreeBSD, like Apple/Darwin does not have statfs, but instead expects the use of the underlying headers
    sys/types.h
    sys/sysctl.h
    sys/param.h
    sys/mount.h

Let me just state this here as a quick reference prior to creating a PR, siple 2 line change will allow it to build on FreeBSD

@@ -0,0 +1,11 @@
+--- Makefile.orig      2022-10-01 05:32:53.792152000 -0700
++++ Makefile   2022-10-01 05:12:27.694746000 -0700
+@@ -1,7 +1,7 @@
+ PREFIX ?= /usr/local
+ MANDIR ?= $(PREFIX)/share/man/man1/
+ BUILDTYPE ?= Release
+-SHELL = /bin/bash
++SHELL = /bin/sh
+
+ # inherit from env if set
+ CC := $(CC)
diff --git a/graphics/tippecanoe/files/patch--main.cpp b/graphics/tippecanoe/files/patch--main.cpp
new file mode 100644
index 000000000000..c368d938feb5
--- /dev/null
+++ b/graphics/tippecanoe/files/patch--main.cpp
@@ -0,0 +1,11 @@
+--- main.cpp.orig      2022-10-01 05:33:25.984494000 -0700
++++ main.cpp   2022-10-01 05:14:45.679349000 -0700
+@@ -34,7 +34,7 @@
+ #include <map>
+ #include <cmath>
+
+-#ifdef __APPLE__
++#if defined(__APPLE__) || defined(__FreeBSD__)
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ #include <sys/param.h>

e-n-f commented

Thanks! The thing that keeps me from switching to /bin/sh on other platforms is that make parallel-test uses the <(…) syntax to treat a pipeline as a named file. Is this supported in your /bin/sh?

Apparently, it does not.
. The quick fix in my mind is to set the SHELL to bash for only the parallel-test target though something like

+-parallel-test:
++parallel-test: $(eval SHELL:=/bin/bash)

That would keep the Linux shell happy, and make the target on FreeBSD invalid. I suspect the vast majority of people would just be trying to get a built binary, vs Dev QA.

A more complete fix would be OS detection, and shell verification, and then cascade off of that, but that would require a fair bit of additional work and complexity.

PR #72 submitted