Commit 8ddcd2cb authored by Michał Kępień's avatar Michał Kępień
Browse files

Enable parallel compilation for FreeBSD QCOW2 jobs

Packer jobs should also benefit from parallel compilation the way Docker
jobs do.  This only applies to FreeBSD jobs for the time being (since we
do not compile any source code while building other QCOW2 images), but
make the necessary adjustments on a "global" level (in packer/Makefile)
anyway, so that further platforms can be tweaked more conveniently if
the need arises in the future.  While packer/freebsd/packer.json only
allocates 2 vCPUs to the VM building the QCOW2 image and the default
number of parallel build jobs is set to 6, we do not care much about
that discrepancy.
parent 543773f3
......@@ -28,6 +28,7 @@ CI_REGISTRY_PREFIX := qcow2
endif
endif
$(TARGETS): BUILD_PARALLEL_JOBS ?= 1
$(TARGETS): CI_REGISTRY_NAME = $(CI_REGISTRY_PREFIX):$@
$(TARGETS): QCOW2_IMAGE = $@
$(TARGETS): VENDOR = $(word 1,$(subst -, ,$@))
......@@ -35,7 +36,7 @@ $(TARGETS): VERSION = $(word 2,$(subst -, ,$@))
$(TARGETS): ISO_URL ?= $($(VENDOR)_$(subst .,_,$(VERSION))_iso_url)
$(TARGETS): ISO_CHECKSUM ?= $($(VENDOR)_$(subst .,_,$(VERSION))_iso_checksum)
$(TARGETS):
QCOW2_IMAGE="$(QCOW2_IMAGE)" make -C $(VENDOR) prepare
BUILD_PARALLEL_JOBS="$(BUILD_PARALLEL_JOBS)" QCOW2_IMAGE="$(QCOW2_IMAGE)" make -C $(VENDOR) prepare
cd "$(VENDOR)/$(QCOW2_IMAGE)" && ISO_URL="$(ISO_URL)" ISO_CHECKSUM="$(ISO_CHECKSUM)" QCOW2_IMAGE="$(QCOW2_IMAGE)" packer build packer.json
sed -e 's,@QCOW2_IMAGE@,$(QCOW2_IMAGE),g' < Dockerfile.in > "$(VENDOR)/$(QCOW2_IMAGE)/output-qemu/Dockerfile"
docker build -t "$(CI_REGISTRY_IMAGE)/$(CI_REGISTRY_NAME)" "$(VENDOR)/$(QCOW2_IMAGE)/output-qemu"
......
......@@ -5,5 +5,9 @@ QCOW2_IMAGE ?= freebsd-12.1-x86_64
prepare:
mkdir -p "$(QCOW2_IMAGE)"
sed -e 's,@KYUA_GIT_COMMIT@,$(KYUA_GIT_COMMIT),g' < post-install.sh.in > "$(QCOW2_IMAGE)/post-install.sh"
sed \
-e 's,@BUILD_PARALLEL_JOBS@,$(BUILD_PARALLEL_JOBS),g' \
-e 's,@KYUA_GIT_COMMIT@,$(KYUA_GIT_COMMIT),g' \
< post-install.sh.in \
> "$(QCOW2_IMAGE)/post-install.sh"
cp installerconfig packer.json "$(QCOW2_IMAGE)/"
......@@ -17,12 +17,12 @@ fi
ASSUME_ALWAYS_YES=yes pkg install gmake
curl -sSL "https://github.com/LMDB/lmdb/archive/LMDB_0.9.24.tar.gz" | tar -C /usr/src -xzf -
cd /usr/src/lmdb-LMDB_0.9.24/libraries/liblmdb
gmake CC=clang && gmake install
gmake -j@BUILD_PARALLEL_JOBS@ CC=clang && gmake install
ASSUME_ALWAYS_YES=yes pkg install automake lutok
curl -sSL "https://github.com/Mno-hime/kyua/archive/@KYUA_GIT_COMMIT@.tar.gz" | tar -C /usr/src -xzf -
cd /usr/src/kyua-@KYUA_GIT_COMMIT@
./configure && make && make install
./configure && make -j@BUILD_PARALLEL_JOBS@ && make install
cd ..
rm -rf /usr/local/tests/kyua /usr/src/kyua-@KYUA_GIT_COMMIT@
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment