-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·71 lines (62 loc) · 2.02 KB
/
build.sh
File metadata and controls
executable file
·71 lines (62 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
set -e
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
export GCC=${GCC:?Please set GCC variable to desired gcc major version}
export ARCH=${ARCH:-x86_64}
# Map architecture to target triplet
case $ARCH in
x86_64)
TARGET_TRIPLET="x86_64-unknown-linux-gnu"
;;
arm64|aarch64)
TARGET_TRIPLET="aarch64-unknown-linux-gnu"
;;
*)
echo "Unsupported architecture: $ARCH"
echo "Supported architectures: x86_64, arm64/aarch64"
exit 1
;;
esac
mkdir -p ${PWD}/output/downloads
mkdir -p ${PWD}/output/${TARGET_TRIPLET}_gcc${GCC}
###############################################################################
#
# Build
#
###############################################################################
export CT_PREFIX="${PWD}/output/${TARGET_TRIPLET}_gcc${GCC}"
DEFCONFIG=configs/${TARGET_TRIPLET}_gcc${GCC} ct-ng defconfig
ct-ng -j$(nproc) build
###############################################################################
#
# Package
#
###############################################################################
function get_commit_time() {
TZ=UTC0 git log -1 \
--format=tformat:%cd \
--date=format:%Y-%m-%dT%H:%M:%SZ
}
SOURCE_EPOCH=$get_commit_time
tar -c \
--sort=name \
--mtime="${SOURCE_EPOCH}" \
--owner=0 \
--group=0 \
--numeric-owner \
-C "output/${TARGET_TRIPLET}_gcc${GCC}" . \
| gzip -n > "output/${TARGET_TRIPLET}_gcc${GCC}.tar.gz"
cd output
sha256sum ${TARGET_TRIPLET}_gcc${GCC}.tar.gz > ${TARGET_TRIPLET}_gcc${GCC}.tar.gz.sha256
cd ..