Skip to content
This repository was archived by the owner on May 23, 2021. It is now read-only.

Commit 8805c21

Browse files
committed
Get centos build working
1 parent 3a8f6d8 commit 8805c21

File tree

3 files changed

+46
-24
lines changed

3 files changed

+46
-24
lines changed

scripts/centos.dockerfile

+21-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
FROM centos:7
2-
3-
RUN yum install -y centos-release-scl
4-
RUN yum-config-manager --enable rhel-server-rhscl-7-rpms
5-
RUN yum install -y devtoolset-6
6-
RUN yum install -y gcc-c++
7-
RUN yum install -y git
8-
RUN rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/c/ccache-3.3.4-1.el7.x86_64.rpm
9-
10-
RUN mkdir /root/node
11-
RUN cd /root/node && curl https://nodejs.org/dist/v12.14.0/node-v12.14.0-linux-x64.tar.xz | tar xJ --strip-components=1 --
12-
RUN ln -s /root/node/bin/node /usr/bin/node
1+
FROM centos:6
2+
3+
RUN yum update -y \
4+
&& yum install -y epel-release yum-utils centos-release-scl-rh \
5+
&& yum-config-manager --enable rhel-server-rhscl-6-rpms \
6+
&& yum update -y
7+
8+
RUN yum install -y \
9+
devtoolset-6 \
10+
gcc-c++ \
11+
python27 \
12+
xz \
13+
ccache \
14+
git
15+
16+
RUN mkdir /root/node \
17+
&& cd /root/node \
18+
&& curl https://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.xz | tar xJ --strip-components=1 -- \
19+
&& ln -s /root/node/bin/node /usr/bin/node
20+
1321
ENV PATH "$PATH:/root/node/bin"
22+
1423
RUN npm install -g yarn

scripts/ci.bash

+24-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ set -Eeuo pipefail
55

66
function docker-build() {
77
local image="$1" ; shift
8-
local prebuild_command="$1" ; shift
98

109
local cache="$HOME/.cache"
1110
if [[ -n ${XDG_CACHE_HOME:-} ]] ; then
@@ -22,26 +21,40 @@ function docker-build() {
2221
docker exec "$containerId" bash -c "$@"
2322
}
2423

25-
[[ -n $prebuild_command ]] && docker-exec "$prebuild_command"
24+
function docker-exec-build() {
25+
docker-exec "cd /src && ${1:-} ./scripts/node_build.bash"
26+
}
2627

2728
case $image in
2829
*armv7hf* | *aarch64*)
2930
docker-exec "cross-build-start"
30-
docker-exec "cd /src && yarn build"
31-
docker-exec "cd /src && yarn test"
31+
docker-exec-build
3232
docker-exec "cross-build-end"
3333
;;
34+
*centos*)
35+
# `__STDC_FORMAT_MACROS` is required on some older systems for access to
36+
# some macros used by Node like `PRIx64`. In newer versions of Node this
37+
# will already be set and we can remove it here.
38+
local cpp_flags="-D __STDC_FORMAT_MACROS"
39+
40+
# `-lrt` provides clock_*; required for gcc < 2.17 (in 2.17 they became
41+
# part of the main C library).
42+
local ld_flags="-lrt"
43+
44+
docker-exec-build ". /opt/rh/devtoolset-6/enable && . /opt/rh/python27/enable && CPPFLAGS='$cpp_flags' LDFLAGS='$ld_flags'"
45+
;;
3446
*)
35-
docker-exec "cd /src && yarn build"
36-
docker-exec "cd /src && yarn test"
47+
docker-exec-build
3748
;;
3849
esac
3950

51+
docker-exec "cd /src && ./node_modules/.bin/mocha"
52+
4053
docker kill "$containerId"
4154
}
4255

4356
function mac-build() {
44-
yarn build
57+
yarn build:node
4558
yarn test
4659
}
4760

@@ -52,21 +65,22 @@ function main() {
5265
local version
5366
version=$(grep version ./package.json | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[:space:]')
5467

68+
yarn build:nbin
69+
yarn build:bundle
70+
5571
local binary_name="node-$node_version-${TARGET:-darwin}"
5672
if [[ $OSTYPE == "darwin"* ]]; then
5773
binary_name="$binary_name-x86_64"
5874
mac-build
5975
else
6076
local image="codercom/nbin-$TARGET"
61-
local prebuild_command=""
6277
case $TARGET in
6378
"alpine") binary_name="$binary_name-x86_64" ;;
6479
"centos")
65-
prebuild_command="source /opt/rh/devtoolset-6/enable"
6680
binary_name="$binary_name-x86_64"
6781
;;
6882
esac
69-
docker-build "$image" "$prebuild_command"
83+
docker-build "$image"
7084
fi
7185

7286
mkdir -p "./build/$version"

scripts/node_build.bash

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ function main() {
1212

1313
cp ../../out/patches/thirdPartyMain.js ./lib/_third_party_main.js
1414

15-
if ! yarn patch:apply 2> /dev/null ; then
15+
if ! git apply ../../scripts/node.patch ; then
1616
echo "Failed to patch; assuming already patched"
17-
git status
1817
fi
1918

2019
local -i cores=2

0 commit comments

Comments
 (0)