Skip to content

Commit aecc5b6

Browse files
committed
tools: Crossbuild for ARMv8-64
Bug: TryGhost#903 Change-Id: Ic91292879deed92fcffd90d7b2d79f551c5b06f4 Signed-off-by: Philippe Coval <[email protected]>
1 parent 2bd051d commit aecc5b6

File tree

2 files changed

+133
-0
lines changed

2 files changed

+133
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/echo docker build . -f
2+
# -*- coding: utf-8 -*-
3+
# SPDX-License-Identifier: ISC
4+
# Copyright 2019-present Samsung Electronics Co., Ltd. and other contributors
5+
#{
6+
# ISC License
7+
# Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
8+
# Copyright (c) 1995-2003 by Internet Software Consortium
9+
# Permission to use, copy, modify, and /or distribute this software
10+
# for any purpose with or without fee is hereby granted,
11+
# provided that the above copyright notice
12+
# and this permission notice appear in all copies.
13+
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
15+
# OF MERCHANTABILITY AND FITNESS.
16+
# IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
17+
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19+
# WHETHER IN AN ACTION OF CONTRACT,
20+
# NEGLIGENCE OR OTHER TORTIOUS ACTION,
21+
# ARISING OUT OF OR IN CONNECTION WITH THE USE
22+
# OR PERFORMANCE OF THIS SOFTWARE.
23+
#}
24+
25+
FROM arm64v8/node:carbon
26+
ADD tools/docker/architecture/linux-arm64/local/qemu-aarch64-static /usr/bin/qemu-aarch64-static
27+
28+
MAINTAINER Philippe Coval ([email protected])
29+
30+
ENV DEBIAN_FRONTEND noninteractive
31+
ENV LC_ALL en_US.UTF-8
32+
ENV LANG ${LC_ALL}
33+
34+
RUN echo "#log: Configuring locales" \
35+
&& set -x \
36+
&& apt-get update -y \
37+
&& apt-get install -y locales \
38+
&& echo "${LC_ALL} UTF-8" | tee /etc/locale.gen \
39+
&& locale-gen ${LC_ALL} \
40+
&& dpkg-reconfigure locales \
41+
&& sync
42+
43+
ENV project node-sqlite3
44+
45+
RUN echo "#log: ${project}: Setup system" \
46+
&& set -x \
47+
&& apt-get update -y \
48+
&& apt-get install -y \
49+
curl \
50+
sudo \
51+
build-essential \
52+
python \
53+
&& apt-get clean \
54+
&& NVM_VERSION="v0.33.8" \
55+
&& NODE_VERSION="--lts=carbon" \
56+
&& curl -o- https://raw.githubusercontent.com/creationix/nvm/${NVM_VERSION}/install.sh | bash \
57+
&& which nvm || . ~/.bashrc \
58+
&& nvm install ${NODE_VERSION} \
59+
&& nvm use ${NODE_VERSION} \
60+
&& sync
61+
62+
ADD . /usr/local/opt/${project}/src/${project}
63+
WORKDIR /usr/local/opt/${project}/src/${project}
64+
RUN echo "#log: ${project}: Preparing sources" \
65+
&& set -x \
66+
&& which npm || . ~/.bashrc \
67+
&& npm install || cat npm-debug.log \
68+
&& npm install \
69+
&& npm install --unsafe-perm --build-from-source \
70+
&& sync
71+
72+
WORKDIR /usr/local/opt/${project}/src/${project}
73+
RUN echo "#log: ${project}: Building sources" \
74+
&& set -x \
75+
&& which npm || . ~/.bashrc \
76+
&& npm run pack \
77+
&& npm pack \
78+
&& find ${PWD}/build/stage/ -type f \
79+
&& sync
80+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/sh
2+
# -*- coding: utf-8 -*-
3+
# SPDX-License-Identifier: ISC
4+
# Copyright 2019-present Samsung Electronics Co., Ltd. and other contributors
5+
#{
6+
# ISC License
7+
# Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
8+
# Copyright (c) 1995-2003 by Internet Software Consortium
9+
# Permission to use, copy, modify, and /or distribute this software
10+
# for any purpose with or without fee is hereby granted,
11+
# provided that the above copyright notice
12+
# and this permission notice appear in all copies.
13+
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
15+
# OF MERCHANTABILITY AND FITNESS.
16+
# IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
17+
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19+
# WHETHER IN AN ACTION OF CONTRACT,
20+
# NEGLIGENCE OR OTHER TORTIOUS ACTION,
21+
# ARISING OUT OF OR IN CONNECTION WITH THE USE
22+
# OR PERFORMANCE OF THIS SOFTWARE.
23+
#}
24+
25+
set -e
26+
set -x
27+
28+
this_dir=$(dirname -- "$0")
29+
this_dir=$(realpath "${this_dir}")
30+
this_name=$(basename -- "$0")
31+
top_dir="${this_dir}/../../.."
32+
33+
module_name="sqlite3"
34+
project="node-${module_name}"
35+
arch="aarch64" # AKA: arm64, arm64v8
36+
architecture=$(basename "${this_dir}")
37+
name="${project}-${architecture}"
38+
dir="/usr/local/opt/${project}/"
39+
dist_dir="${dir}/src/${project}/build"
40+
tag=$(git describe --tags || echo v0.0.0)
41+
version=$(echo "${tag}" | cut -dv -f2 | cut -d'-' -f1)
42+
43+
mkdir -p "${this_dir}/local" "${this_dir}/tmp"
44+
cp -a "/usr/bin/qemu-${arch}-static" "${this_dir}/local"
45+
time docker build -t "${name}" -f "${this_dir}/Dockerfile" .
46+
container=$(docker create "${name}")
47+
mkdir -p "${this_dir}/tmp/${dist_dir}"
48+
rm -rf "${this_dir}/tmp/${dist_dir}"
49+
docker cp "${container}:${dist_dir}" "${this_dir}/tmp/${dist_dir}"
50+
file=$(ls "${this_dir}/tmp/${dist_dir}/stage/${module_name}/"*/*".tar.gz" | head -n1 \
51+
|| echo "/tmp/${USER}/failure.tmp")
52+
53+
sha256sum "${file}"

0 commit comments

Comments
 (0)