summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Pasa <francescopasa@gmail.com>2022-02-17 22:26:22 +0100
committerFrancesco Pasa <francescopasa@gmail.com>2022-02-24 20:45:08 +0100
commitfa54f1137604b5762b414b8a79c1b38d7d5e1ef1 (patch)
tree84448f63914e346b94727411e6e357818db89042
parent6c28960f0fe2eec06aca7d58fd73f3c7cdbe1112 (diff)
downloadcouchdb-jenkins-frapa-autodetect_spidermonkey_version.tar.gz
Autodetect spidermonkey version in ./configurejenkins-frapa-autodetect_spidermonkey_version
I have struggled with this point when building couchDB, because it's written nowhere in the documentation that you need to configure the version properly. It seems that other people had the problem as well: https://couchdb.slack.com/archives/C49LEE7NW/p1632249155263400 The updated configure script automatically finds out the installed library version. It also introduces a dependency on `sed`, `ldconfig` and `head`, and remove the default to version 1.8.5 which is old and not in most distributions anymore. The argument was also removed from the CI scripts because it does not exist anymore.
-rw-r--r--.github/workflows/ubuntu.yml2
-rw-r--r--build-aux/Jenkinsfile.full22
-rwxr-xr-xconfigure23
3 files changed, 27 insertions, 20 deletions
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index 4de1bc868..7636914ff 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -88,7 +88,7 @@ jobs:
cd couch
sed -i -e "s@DRV_CFLAGS -DPIC@DRV_CFLAGS -I/usr/local/include -DPIC@" src/couch/rebar.config.script
sed -i -e "s@DRV_LDFLAGS -lm@DRV_LDFLAGS -L/usr/local/lib -lm@" src/couch/rebar.config.script
- sh ./configure --spidermonkey-version=91 --disable-docs
+ sh ./configure --disable-docs
- name: Compile
run: |
cd couch
diff --git a/build-aux/Jenkinsfile.full b/build-aux/Jenkinsfile.full
index 26cec87e4..8a5fbb6af 100644
--- a/build-aux/Jenkinsfile.full
+++ b/build-aux/Jenkinsfile.full
@@ -25,37 +25,31 @@ MINIMUM_ERLANG_VERSION = '21'
meta = [
'centos7': [
name: 'CentOS 7',
- spidermonkey_vsn: '1.8.5',
image: "apache/couchdbci-centos:7-erlang-${ERLANG_VERSION}"
],
'centos8': [
name: 'CentOS 8',
- spidermonkey_vsn: '60',
image: "apache/couchdbci-centos:8-erlang-${ERLANG_VERSION}"
],
'bionic': [
name: 'Ubuntu 18.04',
- spidermonkey_vsn: '1.8.5',
image: "apache/couchdbci-ubuntu:bionic-erlang-${ERLANG_VERSION}"
],
'focal': [
name: 'Ubuntu 20.04',
- spidermonkey_vsn: '68',
image: "apache/couchdbci-ubuntu:focal-erlang-${ERLANG_VERSION}"
],
'stretch': [
name: 'Debian 9',
- spidermonkey_vsn: '1.8.5',
image: "apache/couchdbci-debian:stretch-erlang-${ERLANG_VERSION}"
],
'buster': [
name: 'Debian 10',
- spidermonkey_vsn: '60',
image: "apache/couchdbci-debian:buster-erlang-${ERLANG_VERSION}"
],
@@ -63,21 +57,18 @@ meta = [
// 'buster-arm64': [
// name: 'Debian 10 ARM'
- // spidermonkey_vsn: '60',
// image: "apache/couchdbci-debian:arm64v8-buster-erlang-${ERLANG_VERSION}",
// node_label: 'arm64v8'
// ],
// 'buster-ppc64': [
// name: 'Debian 10 POWER'
- // spidermonkey_vsn: '60',
// image: "apache/couchdbci-debian:pp64le-buster-erlang-${ERLANG_VERSION}",
// node_label: 'ppc64le'
// ],
'bullseye': [
name: 'Debian 11',
- spidermonkey_vsn: '78',
image: "apache/couchdbci-debian:bullseye-erlang-${ERLANG_VERSION}"
],
@@ -119,12 +110,13 @@ def generateNativeStage(platform) {
withEnv([
'HOME='+pwd(),
'PATH+USRLOCAL=/usr/local/bin',
- 'MAKE='+meta[platform].gnu_make
+ 'MAKE='+meta[platform].gnu_make,
+ 'SM_VSN='+meta[platform].spidermonkey_vsn
]) {
sh( script: "mkdir -p ${COUCHDB_IO_LOG_DIR} ${platform}/build", label: 'Create build directories' )
sh( script: "tar -xf apache-couchdb-*.tar.gz -C ${platform}/build --strip-components=1", label: 'Unpack release' )
dir( "${platform}/build" ) {
- sh "./configure --skip-deps --spidermonkey-version ${meta[platform].spidermonkey_vsn}"
+ sh "./configure --skip-deps"
sh '$MAKE'
sh '$MAKE eunit'
sh '$MAKE elixir-suite'
@@ -176,7 +168,7 @@ def generateContainerStage(platform) {
sh( script: "mkdir -p ${COUCHDB_IO_LOG_DIR} ${platform}/build", label: 'Create build directories' )
sh( script: "tar -xf apache-couchdb-*.tar.gz -C ${platform}/build --strip-components=1", label: 'Unpack release' )
dir( "${platform}/build" ) {
- sh "./configure --skip-deps --spidermonkey-version ${meta[platform].spidermonkey_vsn}"
+ sh "./configure --skip-deps"
sh 'make'
sh 'make eunit'
sh 'make elixir-suite'
@@ -271,14 +263,10 @@ pipeline {
registryCredentialsId 'dockerhub_creds'
}
}
- environment {
- // TODO find a way to avoid setting this explicitly
- spidermonkey = '78'
- }
steps {
timeout(time: 15, unit: "MINUTES") {
sh (script: 'rm -rf apache-couchdb-*', label: 'Clean workspace of any previous release artifacts' )
- sh "./configure --spidermonkey-version ${spidermonkey}"
+ sh "./configure"
sh 'make erlfmt-check'
sh 'make elixir-check-formatted'
sh 'make dist'
diff --git a/configure b/configure
index c016c31ef..866bb8102 100755
--- a/configure
+++ b/configure
@@ -29,11 +29,22 @@ ERLANG_MD5="false"
SKIP_DEPS=0
COUCHDB_USER="$(whoami 2>/dev/null || echo couchdb)"
-SM_VSN=${SM_VSN:-"1.8.5"}
+OS="$(uname)"
ARCH="$(uname -m)"
+SM_VSN=${SM_VSN:-$([ "$OS" = "Linux" ] || echo "1.8.5")}
+# Try to detect SpiderMonkey (libmozjs) version automatically on linux
+SM_VSN=${SM_VSN:-$(/sbin/ldconfig -p | sed -n 's/.libmozjs-*\([0-9]*\).*/\1/p' | head -n 1)}
+if [ -z "$SM_VSN" ]; then
+ SM_VSN="1.8.5"
+fi
+
+if [ "$SM_VSN" = "185" ]; then
+ SM_VSN="1.8.5"
+fi
+
. ${rootdir}/version.mk
-COUCHDB_VERSION=${vsn_major}.${vsn_minor}.${vsn_patch}
+COUCHDB_VERSION=${vsn_major}.${vsn_minor}.${vsn_patch}src/couch/rebar.config.script
display_help () {
cat << EOF
@@ -211,6 +222,14 @@ parse_opts() {
parse_opts $@
+# If SM_VSN is empty, the SpiderMonkey version could not be detected,
+# and it was not set with the CLI argument. Quit the script and warn the user.
+if [ -z "$SM_VSN" ]; then
+ echo 'ERROR: Could not detect SpiderMonkey version. Ensure SpyderMonkey is installed' \
+ 'or set the version explicitly with "--spidermonkey-version".'
+ exit 1
+fi
+
if [ "${ARCH}" = "aarch64" ] && [ "${SM_VSN}" = "60" ]
then
echo "ERROR: SpiderMonkey 60 is known broken on ARM 64 (aarch64). Use another version instead."