rocksdb/java/crossbuild/docker-build-linux.sh
Adam Retter 5458eda5f0 Pass build parallelism flag to Docker builds (#12392)
Summary:
Passed the `-j` flag through to builds happening inside Docker containers.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/12392

Reviewed By: cbi42

Differential Revision: D54311937

Pulled By: ajkr

fbshipit-source-id: 5cf1bfe4b9059cc2d078fb5331812f32cf9e89ab
2024-02-28 12:51:00 -08:00

44 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
set -e
#set -x
# Set job parallelism to 1 (none) if it is not defined in the environment
if [ -z "${J}" ]; then
J=1
fi
# just in-case this is run outside Docker
mkdir -p /rocksdb-local-build
rm -rf /rocksdb-local-build/*
cp -r /rocksdb-host/* /rocksdb-local-build
cd /rocksdb-local-build
# Use scl devtoolset if available
if hash scl 2>/dev/null; then
if scl --list | grep -q 'devtoolset-8'; then
# CentOS 6+
scl enable devtoolset-8 'make clean-not-downloaded'
scl enable devtoolset-8 "PORTABLE=1 J=$J make -j$J rocksdbjavastatic"
elif scl --list | grep -q 'devtoolset-7'; then
# CentOS 6+
scl enable devtoolset-7 'make clean-not-downloaded'
scl enable devtoolset-7 "PORTABLE=1 J=$J make -j$J rocksdbjavastatic"
elif scl --list | grep -q 'devtoolset-2'; then
# CentOS 5 or 6
scl enable devtoolset-2 'make clean-not-downloaded'
scl enable devtoolset-2 "PORTABLE=1 J=$J make -j$J rocksdbjavastatic"
else
echo "Could not find devtoolset"
exit 1;
fi
else
make clean-not-downloaded
PORTABLE=1 make -j$J rocksdbjavastatic
fi
cp java/target/librocksdbjni-linux*.so java/target/rocksdbjni-*-linux*.jar java/target/rocksdbjni-*-linux*.jar.sha1 /rocksdb-java-target