Skip to content

Commit 18a6d2a

Browse files
authored
Pin dockcross version in 3.x (#119)
* Pin dockcross version in 3.x * add changelog
1 parent 9c139ff commit 18a6d2a

File tree

6 files changed

+71
-19
lines changed

6 files changed

+71
-19
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ for the Linux x64 and Darwin x64 platforms.
88

99
## [Unreleased]
1010

11+
## [3.7.3] - 2022-11-10
12+
### Changed
13+
- Required version of glibc on Linux is 2.26. (#98, #92 backported in #119)
14+
15+
### Fixed
16+
- Fixed the path to Windows resources. (#109 backported in #119)
17+
18+
### Removed
19+
- Removed support for Linux MIPS and MIPSEL (#98, #92 backported in #119)
20+
1121
## [3.7.2] - 2022-02-07
1222
### Added
1323
- Added Apple M1 build (#89)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ H3-Java provides bindings to the H3 library, which is written in C. The built ar
5252

5353
| Operating System | Architectures
5454
| ---------------- | -------------
55-
| Linux | x64, x86, ARM64, ARMv5, ARMv7, MIPS, MIPSEL, PPC64LE, s390x
55+
| Linux | x64, x86, ARM64, ARMv5, ARMv7, MIPS, PPC64LE, s390x
5656
| Windows | x64, x86
5757
| Darwin (Mac OSX) | x64, ARM64
5858
| FreeBSD | x64

pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070

7171
<h3.git.remote>https://github.com/uber/h3.git</h3.git.remote>
7272
<h3.use.docker>true</h3.use.docker>
73-
<h3.remove.images>false</h3.remove.images>
73+
<h3.system.prune>false</h3.system.prune>
74+
<h3.dockcross.tag>20210624-de7b1b0</h3.dockcross.tag>
7475
<!-- Used for passing additional arguments to surefire when using JaCoCo -->
7576
<h3.additional.argLine />
7677

@@ -243,7 +244,8 @@
243244
<argument>${h3.git.remote}</argument>
244245
<argument>${h3.git.reference}</argument>
245246
<argument>${h3.use.docker}</argument>
246-
<argument>${h3.remove.images}</argument>
247+
<argument>${h3.system.prune}</argument>
248+
<argument>${h3.dockcross.tag}</argument>
247249
</arguments>
248250
</configuration>
249251
</execution>

src/main/c/h3-java/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ include(CMakeDependentOption)
2323

2424
# Needed due to CMP0042
2525
set(CMAKE_MACOSX_RPATH 1)
26-
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchain.cmake"
27-
CACHE FILEPATH
28-
"Toolchain to use for building this project")
26+
if(NOT WIN32)
27+
# Compiler options are set only on non-Windows, since these options
28+
# are not correct for MSVC.
29+
set(CMAKE_C_FLAGS_INIT "-Wall")
30+
string(CONCAT CMAKE_C_FLAGS_DEBUG_INIT
31+
"-g -gdwarf-2 -g3 -O0 -fno-inline -fno-eliminate-unused-debug-types")
32+
endif()
2933
set(LIBRARY_OUTPUT_PATH lib)
3034
set(H3_SOVERSION 1)
3135

src/main/c/h3-java/build-h3-docker.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,37 @@
1515
# limitations under the License.
1616
#
1717

18-
# Arguments: [build-root]
19-
# build-root - Location to build the library.
18+
# Arguments: [build-root] [upgrade-cmake]
19+
# build-root - Location to build the library.
20+
# upgrade-cmake - Whether to download and install a new version of CMake
21+
# cmake-root - Where to download and install the new version of CMake
2022
#
2123
# Builds H3 and H3-Java in the given directory. This is intended to be
2224
# called from build-h3.sh as part of the cross compilation process.
2325

2426
set -ex
2527

2628
BUILD_ROOT=$1
29+
UPGRADE_CMAKE=$2
30+
CMAKE_ROOT=$3
2731

28-
cd $BUILD_ROOT
32+
if $UPGRADE_CMAKE; then
33+
pushd "$CMAKE_ROOT"
34+
if ! [ -e cmake-3.23.2-linux-x86_64.sh ]; then
35+
wget -nv https://github.com/Kitware/CMake/releases/download/v3.23.2/cmake-3.23.2-linux-x86_64.sh
36+
fi
37+
echo "5cca63af386e5bd0bde67c87ffac915865abd7dcc48073528f58645abda8f695 cmake-3.23.2-linux-x86_64.sh" > cmake-3.23.2-SHA-256.txt
38+
sha256sum -c cmake-3.23.2-SHA-256.txt
39+
if ! [ -e ./bin/cmake ]; then
40+
chmod a+x cmake-3.23.2-linux-x86_64.sh
41+
./cmake-3.23.2-linux-x86_64.sh --skip-license
42+
fi
43+
export PATH=$(pwd)/bin:$PATH
44+
cmake --version
45+
popd
46+
fi
47+
48+
cd "$BUILD_ROOT"
2949

3050
mkdir -p build
3151
pushd build
@@ -35,6 +55,7 @@ cmake -DBUILD_SHARED_LIBS=OFF \
3555
-DCMAKE_C_STANDARD=99 \
3656
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
3757
-DCMAKE_BUILD_TYPE=Release \
58+
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=lib \
3859
../../h3
3960
make h3
4061
H3_BUILD_ROOT="$(pwd)"

src/main/c/h3-java/build-h3.sh

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
# git-ref - Specific git ref of H3 to build.
2222
# use-docker - "true" to perform cross compilation via Docker, "false" to
2323
# skip that step.
24-
# remove-images - If use-docker is true and this argument is true, Docker
25-
# cross compilation images will be removed after each step
24+
# system-prune - If use-docker is true and this argument is true, Docker
25+
# system prune will be run after each step
2626
# (i.e. for disk space constrained environments like CI)
27+
# dockcross-tag - Tag name for dockcross
2728
#
2829
# This script downloads H3, builds H3 and the H3-Java native library, and
2930
# cross compiles via Docker.
@@ -36,7 +37,8 @@ set -ex
3637
GIT_REMOTE=$1
3738
GIT_REVISION=$2
3839
USE_DOCKER=$3
39-
REMOVE_IMAGES=$4
40+
SYSTEM_PRUNE=$4
41+
DOCKCROSS_TAG=$5
4042

4143
echo Downloading H3 from "$GIT_REMOTE"
4244

@@ -156,30 +158,43 @@ if ! command -v docker; then
156158
exit 0
157159
fi
158160

161+
# Needed for older versions of dockcross
162+
UPGRADE_CMAKE=true
163+
CMAKE_ROOT=target/cmake-3.23.2-linux-x86_64
164+
mkdir -p $CMAKE_ROOT
165+
159166
# linux-armv6 excluded because of build failure
160-
for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux-mipsel linux-mips linux-s390x \
161-
linux-ppc64le linux-x64 linux-x86 windows-x64 windows-x86; do
167+
# linux-mips excluded due to manifest error
168+
for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux-s390x \
169+
linux-ppc64le linux-x64 linux-x86 windows-static-x64 windows-static-x86; do
162170

163171
# Setup for using dockcross
164172
BUILD_ROOT=target/h3-java-build-$image
165173
mkdir -p $BUILD_ROOT
166-
docker pull dockcross/$image
167-
docker run --rm dockcross/$image > $BUILD_ROOT/dockcross
174+
docker pull dockcross/$image:$DOCKCROSS_TAG
175+
docker run --rm dockcross/$image:$DOCKCROSS_TAG > $BUILD_ROOT/dockcross
168176
chmod +x $BUILD_ROOT/dockcross
169177

170178
# Perform the actual build inside Docker
171-
$BUILD_ROOT/dockcross --args "-v $JAVA_HOME:/java" src/main/c/h3-java/build-h3-docker.sh "$BUILD_ROOT"
179+
$BUILD_ROOT/dockcross --args "-v $JAVA_HOME:/java" src/main/c/h3-java/build-h3-docker.sh "$BUILD_ROOT" "$UPGRADE_CMAKE" "$CMAKE_ROOT"
172180

173181
# Copy the built artifact into the source tree so it can be included in the
174182
# built JAR.
175183
OUTPUT_ROOT=src/main/resources/$image
184+
if [ "$image" = "windows-static-x64" ]; then
185+
OUTPUT_ROOT=src/main/resources/windows-x64
186+
fi
187+
if [ "$image" = "windows-static-x86" ]; then
188+
OUTPUT_ROOT=src/main/resources/windows-x86
189+
fi
176190
mkdir -p $OUTPUT_ROOT
177191
if [ -e $BUILD_ROOT/lib/libh3-java.so ]; then cp $BUILD_ROOT/lib/libh3-java.so $OUTPUT_ROOT ; fi
178192
if [ -e $BUILD_ROOT/lib/libh3-java.dylib ]; then cp $BUILD_ROOT/lib/libh3-java.dylib $OUTPUT_ROOT ; fi
179193
if [ -e $BUILD_ROOT/lib/libh3-java.dll ]; then cp $BUILD_ROOT/lib/libh3-java.dll $OUTPUT_ROOT ; fi
180194

181-
if $REMOVE_IMAGES; then
182-
docker rmi dockcross/$image
195+
if $SYSTEM_PRUNE; then
196+
docker system prune --force --all
197+
docker system df
183198
rm $BUILD_ROOT/dockcross
184199
fi
185200
echo Current disk usage:

0 commit comments

Comments
 (0)