Skip to content

Commit

Permalink
[Valhalla] Bump v3.5.1 (#9295)
Browse files Browse the repository at this point in the history
* [Valhalla] Bump v3.5.0

* Bump gcc to v8

* Bump boost

* bump to 3.5.1

* try same gcc as protoc

* Update build_tarballs.jl

* try reenabling hostbuild protoc

* fix protoc paths and vars

* add protoc exec patch

* Bump geos

* add lz4 vars

* try gcc for all platforms

* try newer gcc

* use clang for Mac

* i686 seems to build with gcc toolchain specified?

* bash fix

* force armv7l to use gcc

* try macOS 10.14

* try newer apple sdk

* add lz4.pc patch for FreeBSD compatibility and remove unused CMake flags

* Bump Mac to 11.3

* tweak protoc patch

* revert

* fix patch

* try even more modern mac...

* try forcing cxx 17

* refine

* use gcc for mac

* Fix Mac Version

* Mac use v11.1

* bump mac sdk

* try to fix Mac errors...

* tweak Mac build

* pin protoc

* drop compat from hostbuilddependency

* switch back to clang...

* Fix cxx standard flag

* tweak Mac cmake

* fix mac

* ensure correct vars are set

* add protoclite

* Update protoc-find-exec.patch

* add debug statement

* try using newer cmake

* drop cmake

* web ui is the worst

* add prefix for all

* try building on windows

* lz.pc for mingw

* Enable tools

* add ExecutableProduct valhalla_service

* Activate build features

* Turn off http server

* add gdal vars

* add missing dependency sqlite_jll

* add libspatialite

* tweak openssl import

* bump libspatial dependency

* add luajit

* drop data tools

* try to get to build...

* try setting cxx standard

* try cxx flag

* add cxxflags

* [Valhalla] Add compat bounds for LibCURL

* add riscv patch for cxx20 warnings

* add arm fix

* fix patch typo

* Drop excess flags (?)

* turn off gdal

* specify cxx17

* drop comment to trigger build

* add tweak

* Bump OpenSSL

* revert devcontainer.json

* make relative to prefix

* retriever build

* rerun

* try specifying compat for both protoc

* use packagespec

* tweak packagespec

* retrigger build

* retrigger build

* drop excess param

---------

Co-authored-by: Mosè Giordano <[email protected]>
  • Loading branch information
jeremiahpslewis and giordano authored Feb 17, 2025
1 parent 9e4a245 commit 0ea71ef
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 30 deletions.
86 changes: 56 additions & 30 deletions V/Valhalla/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,77 @@
using BinaryBuilder, Pkg

name = "Valhalla"
version = v"3.3.0"
version = v"3.5.1"

# Collection of sources required to complete build
sources = [
GitSource("https://github.com/valhalla/valhalla.git", "ea7d44af37c47fcf0cb186e7ba0f9f77e96f202a"),
GitSource("https://github.com/valhalla/valhalla.git", "d377c8ace9ea88dfa989466258bf738b1080f22a"),
DirectorySource("./bundled"),
ArchiveSource("https://github.com/realjf/MacOSX-SDKs/releases/download/v0.0.1/MacOSX12.3.sdk.tar.xz",
"a511c1cf1ebfe6fe3b8ec005374b9c05e89ac28b3d4eb468873f59800c02b030"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/valhalla/
# Handle Mac SDK <10.12 errors
# Handle Mac SDK <10.14 errors
if [[ "${target}" == x86_64-apple-darwin* ]]; then
export MACOSX_DEPLOYMENT_TARGET=10.12
# Install a newer SDK which supports C++20
pushd $WORKSPACE/srcdir/MacOSX12.*.sdk
rm -rf /opt/${target}/${target}/sys-root/System
rm -rf /opt/${target}/${target}/sys-root/usr/*
cp -ra usr/* "/opt/${target}/${target}/sys-root/usr/."
cp -ra System "/opt/${target}/${target}/sys-root/."
popd
export MACOSX_DEPLOYMENT_TARGET=12.3
fi
git submodule update --init --recursive
# Help cmake find protoc exec for host, protoc libs for target
atomic_patch -p1 ${WORKSPACE}/srcdir/patches/protoc-find-exec.patch
# Improve compatibility with more recent CXX20 oriented gcc version
atomic_patch -p1 ${WORKSPACE}/srcdir/patches/fix-template-id-cdtor-error.patch
if [[ "${target}" == *freebsd* ]]; then
cd third_party/cpp-statsd-client
atomic_patch -p1 ${WORKSPACE}/srcdir/patches/cpp-statsd-client.patch
cd ../../
fi
if [[ "${target}" == *freebsd* ]] || [[ "${target}" == *mingw* ]]; then
# FreeBSD, Mingw don't seem to ship a lz4.pc file
mv ${WORKSPACE}/srcdir/patches/liblz4.pc ${prefix}/lib/pkgconfig/
fi
mkdir build && cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DENABLE_DATA_TOOLS=OFF \
-DENABLE_PYTHON_BINDINGS=OFF \
-DENABLE_BENCHMARKS=OFF \
-DENABLE_TESTS=OFF \
-DZLIB_LIBRARY=${libdir}/libz.${dlext} \
-DZLIB_INCLUDE_DIR=${includedir} \
-DProtobuf_INCLUDE_DIR=${includedir} \
-DPROTOBUF_LIBRARY=${libdir}/libprotobuf.${dlext} \
-DENABLE_SERVICES=OFF \
-DENABLE_TOOLS=OFF \
-DENABLE_CCACHE=OFF \
-DENABLE_BENCHMARKS=OFF \
-DProtobuf_PROTOC_EXECUTABLE=${host_bindir}/protoc \
CMAKE_FLAGS=(
-DCMAKE_INSTALL_PREFIX=$prefix
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_PREFIX_PATH=${prefix}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN}
-DBUILD_SHARED_LIBS=ON
-DENABLE_SERVICES=OFF
-DENABLE_TOOLS=ON
-DENABLE_CCACHE=OFF
-DENABLE_DATA_TOOLS=OFF
-DENABLE_PYTHON_BINDINGS=OFF
-DENABLE_BENCHMARKS=OFF
-DENABLE_TESTS=OFF
-DENABLE_GDAL=OFF
-DPROTOBUF_INCLUDE_DIRS=${includedir}
-DPROTOBUF_LIBRARIES=${libdir}/libprotobuf.${dlext}
-DPROTOBUF_PROTOC_LIBRARIES=${libdir}/libprotoc.${dlext}
-DProtobuf_LITE_LIBRARIES=${libdir}/libprotobuf-lite.${dlext}
-DPROTOBUF_PROTOC_EXECUTABLE=${host_bindir}/protoc
-DLOGGING_LEVEL=DEBUG
-DCMAKE_CXX_STANDARD=17
)
cmake "${CMAKE_FLAGS[@]}" ..
make -j${nproc}
make -j${nproc} install
Expand All @@ -58,25 +83,26 @@ install_license ../LICENSE.md

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
# Windows is blocked until pkg-config issues are figured out (https://github.com/valhalla/valhalla/issues/3931)
platforms = supported_platforms(; exclude=Sys.iswindows)
platforms = supported_platforms()
platforms = expand_cxxstring_abis(platforms)

# The products that we will ensure are always built
products = Product[
LibraryProduct("libvalhalla", :libvalhalla),
ExecutableProduct("valhalla_service", :valhalla_service),
]

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency("boost_jll"; compat="=1.76.0")
Dependency("GEOS_jll")
Dependency("LibCURL_jll")
HostBuildDependency(PackageSpec(name="protoc_jll", version=v"105.29.3"))
Dependency("boost_jll"; compat="=1.87.0")
Dependency("GEOS_jll"; compat="3.13.1")
Dependency("LibCURL_jll"; compat="7.73,8")
Dependency("Lz4_jll")
Dependency("protoc_jll")
HostBuildDependency("protoc_jll")
Dependency("protoc_jll"; compat="105.29.3")
Dependency("Zlib_jll")
Dependency("OpenSSL_jll"; compat="3.0.16")
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"6")
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"11.1")
49 changes: 49 additions & 0 deletions V/Valhalla/bundled/patches/fix-template-id-cdtor-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git a/valhalla/midgard/vector2.h b/valhalla/midgard/vector2.h
index 37d88effc..f6e0a1dc7 100644
--- a/valhalla/midgard/vector2.h
+++ b/valhalla/midgard/vector2.h
@@ -19,7 +19,7 @@ public:
/**
* Default constructor
*/
- VectorXY<PrecisionT>() : x_(0.0), y_(0.0) {
+ VectorXY() : x_(0.0), y_(0.0) {
}

/**
@@ -27,7 +27,7 @@ public:
* origin to the point.
* @param p Point.
*/
- VectorXY<PrecisionT>(const PointXY<PrecisionT>& p) : x_(p.x()), y_(p.y()) {
+ VectorXY(const PointXY<PrecisionT>& p) : x_(p.x()), y_(p.y()) {
}

/**
@@ -35,7 +35,7 @@ public:
* @param x x component of the vector.
* @param y y component of the vector.
*/
- VectorXY<PrecisionT>(const PrecisionT x, const PrecisionT y) : x_(x), y_(y) {
+ VectorXY(const PrecisionT x, const PrecisionT y) : x_(x), y_(y) {
}

/**
@@ -43,7 +43,7 @@ public:
* @param from Point at origin of the vector.
* @param to Point at end of vector
*/
- VectorXY<PrecisionT>(const PointXY<PrecisionT>& from, const PointXY<PrecisionT>& to)
+ VectorXY(const PointXY<PrecisionT>& from, const PointXY<PrecisionT>& to)
: x_(to.x() - from.x()), y_(to.y() - from.y()) {
}

@@ -51,7 +51,7 @@ public:
* Copy constructor.
* @param w Vector to copy to the new vector.
*/
- VectorXY<PrecisionT>(const VectorXY<PrecisionT>& w) : x_(w.x()), y_(w.y()) {
+ VectorXY(const VectorXY<PrecisionT>& w) : x_(w.x()), y_(w.y()) {
}

/**
10 changes: 10 additions & 0 deletions V/Valhalla/bundled/patches/liblz4.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=${pcfiledir}/../..
exec_prefix=${pcfiledir}/../..
libdir=${prefix}/lib
includedir=${prefix}/include

Name: lz4
Description: LZ4 compression library
Version: ygg
Libs: -L${libdir} -llz4
Cflags: -I${includedir}
20 changes: 20 additions & 0 deletions V/Valhalla/bundled/patches/protoc-find-exec.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3af4452a7..e3c46be57 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -175,7 +175,14 @@ endif()
# for protoc location in a platform agnostic manner
# newer protobuf versions require a compat bool
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")
-find_package(Protobuf REQUIRED)
+find_package(Protobuf CONFIG REQUIRED)
+
+if(Protobuf_PROTOC_EXECUTABLE)
+ set_target_properties(protobuf::protoc PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${Protobuf_PROTOC_EXECUTABLE}"
+ )
+endif()
+
# and turn it off again
message(STATUS "Using protoc from ${Protobuf_PROTOC_EXECUTABLE}")
message(STATUS "Using pbf headers from ${Protobuf_INCLUDE_DIRS}")

0 comments on commit 0ea71ef

Please sign in to comment.