Rev 19 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 19 | Rev 20 | ||
---|---|---|---|
Line 35... | Line 35... | ||
35 | exit 1 |
35 | exit 1 |
36 | } |
36 | } |
37 | 37 | ||
38 | # verify we're a x86_64 Linux host |
38 | # verify we're a x86_64 Linux host |
39 | if [ ! "$(uname)" = "Linux" ] || [ ! "$(uname -m)" = "x86_64" ]; then |
39 | if [ ! "$(uname)" = "Linux" ] || [ ! "$(uname -m)" = "x86_64" ]; then |
40 | print_error_and_die "Error: this script requires a x86_64 Linux machine (possibly a virtual |
40 | print_error_and_die "Error: this script requires a x86_64 Linux machine (possibly a virtual machine, or WSL2) as the build host." |
41 | fi |
41 | fi |
42 | 42 | ||
43 | # verify that we have the required tools |
43 | # verify that we have the required tools |
44 | for REQUIRED_TOOL in ${REQUIRED_TOOLS}; do |
44 | for REQUIRED_TOOL in ${REQUIRED_TOOLS}; do |
45 | "${REQUIRED_TOOL}" --version > /dev/null 2>&1 || print_error_and_die \ |
45 | "${REQUIRED_TOOL}" --version > /dev/null 2>&1 || print_error_and_die \ |
Line 71... | Line 71... | ||
71 | # we're not in WSL. We can expect reasonably good file access speeds to the QNX SDP that's bundled with this repository, so just use it. |
71 | # we're not in WSL. We can expect reasonably good file access speeds to the QNX SDP that's bundled with this repository, so just use it. |
72 | QNXSDK_CANONICAL_PATH="$(realpath "${CURRENT_DIR}/${QNXSDK_PATH}")" |
72 | QNXSDK_CANONICAL_PATH="$(realpath "${CURRENT_DIR}/${QNXSDK_PATH}")" |
73 | fi |
73 | fi |
74 | 74 | ||
75 | # verify that the symlinks are deployed in the SDK -- just test one of them in each relevant directory ($QNX_HOST for the tools, $QNX_TARGET for the sysroot) |
75 | # verify that the symlinks are deployed in the SDK -- just test one of them in each relevant directory ($QNX_HOST for the tools, $QNX_TARGET for the sysroot) |
76 | if [ ! -e "${QNXSDK_CANONICAL_PATH}/${QNXSDK_HOSTPATH}/usr/bin/ntox86_64-gcc |
76 | if [ ! -e "${QNXSDK_CANONICAL_PATH}/${QNXSDK_HOSTPATH}/usr/bin/ntox86_64-gcc" ]; then |
77 | print_error_and_die \ |
- | |
78 |
|
77 | # symlinks not deployed in the QNX SDK: do so |
79 |
|
78 | OLDDIR="$(pwd)" |
80 |
|
79 | cd "${QNXSDK_CANONICAL_PATH}" |
81 |
|
80 | find . -name symlinks.lst -exec ./symlinks.sh {} create \; && printf 'present-v2' > .symlinks-state |
82 | "(else on a Windows machine:)" \ |
- | |
83 |
|
81 | cd "${OLDDIR}" |
84 | " host\\win64\\x86_64\\usr\\bin\\busybox.exe sh -c \"find . -name symlinks.lst -exec ./symlinks.sh {} create \\; && printf 'present' > .symlinks-state\"" \ |
- | |
85 | "Note that this step WILL take time on a Win32 machine, but is only done once." |
- | |
86 | fi |
82 | fi |
87 | 83 | ||
88 | # Create a symlink in /tmp that will lead to the QNX platform SDK so as to avoid spaces in paths if it doesn't exist already |
84 | # Create a symlink in /tmp that will lead to the QNX platform SDK so as to avoid spaces in paths if it doesn't exist already |
89 | # (this is totally prohibitive with the official QNX toolchain) |
85 | # (this is totally prohibitive with the official QNX toolchain) |
90 | if [ ! -L /tmp/qnxsdk ] || [ ! "$(readlink /tmp/qnxsdk)" = "${QNXSDK_CANONICAL_PATH}" ]; then |
86 | if [ ! -L /tmp/qnxsdk ] || [ ! "$(readlink /tmp/qnxsdk)" = "${QNXSDK_CANONICAL_PATH}" ]; then |
Line 117... | Line 113... | ||
117 | rm -f "${CURRENT_DIR}/${2}" |
113 | rm -f "${CURRENT_DIR}/${2}" |
118 | exit 1 |
114 | exit 1 |
119 | fi |
115 | fi |
120 | fi |
116 | fi |
121 | echo "Extracting ${1} sources..." |
117 | echo "Extracting ${1} sources..." |
- | 118 | STARTDIR="$(pwd)" |
|
122 | cd "$(dirname "${1}")" |
119 | cd "$(dirname "${1}")" |
123 | if echo "${2}"|grep -q "\.tar\.bz2$"; then |
120 | if echo "${2}"|grep -q "\.tar\.bz2$"; then |
124 | # BZip2 tarball |
121 | # BZip2 tarball |
125 | tar xjf "${CURRENT_DIR}/${2}" || exit 1 |
122 | tar xjf "${CURRENT_DIR}/${2}" || exit 1 |
126 | elif echo "${2}"|grep -q "\.tar\.xz$"; then |
123 | elif echo "${2}"|grep -q "\.tar\.xz$"; then |
Line 128... | Line 125... | ||
128 | tar xJf "${CURRENT_DIR}/${2}" || exit 1 |
125 | tar xJf "${CURRENT_DIR}/${2}" || exit 1 |
129 | elif echo "${2}"|grep -q "\.tar\.gz$"; then |
126 | elif echo "${2}"|grep -q "\.tar\.gz$"; then |
130 | # GZipped tarball |
127 | # GZipped tarball |
131 | tar xzf "${CURRENT_DIR}/${2}" || exit 1 |
128 | tar xzf "${CURRENT_DIR}/${2}" || exit 1 |
132 | else |
129 | else |
133 |
|
130 | print_error_and_die "Error: unsupported file extension. Please improve the download_and_unpack_if_necessary() shell function to support it." |
134 | exit 1 |
- | |
135 | fi |
131 | fi |
136 | # make sure the expected directory is here after extraction |
132 | # make sure the expected directory is here after extraction |
137 | if [ ! -d "${1}" ]; then |
133 | if [ ! -d "$(basename "${1}")" ]; then |
138 |
|
134 | print_error_and_die "Error: couldn't find ${1} in extracted sources." |
139 | exit 1 |
- | |
140 | fi |
135 | fi |
141 | # do we have a patchset to apply ? |
136 | # do we have a patchset to apply ? |
142 | if [ -n "${4}" ]; then |
137 | if [ -n "${4}" ]; then |
- | 138 | if [ ! -s "${CURRENT_DIR}/${2}.patchset" ]; then |
|
143 | echo "Downloading ${1} patchset from ${4}..." |
139 | echo "Downloading ${1} patchset from ${4}..." |
144 | wget -O "${CURRENT_DIR}/${2}.patchset" "${4}" || exit 1 |
140 | wget -O "${CURRENT_DIR}/${2}.patchset" "${4}" || exit 1 |
- | 141 | fi |
|
145 | echo "Applying patchset..." |
142 | echo "Applying patchset..." |
146 | OLDDIR="$(pwd)" |
143 | OLDDIR="$(pwd)" |
147 | cd "${1}" |
144 | cd "$(basename "${1}")" |
148 | patch -N -Z -p1 < "${CURRENT_DIR}/${2}.patchset" || exit 1 |
145 | patch -N -Z -p1 < "${CURRENT_DIR}/${2}.patchset" || exit 1 |
149 | cd "${OLDDIR}" |
146 | cd "${OLDDIR}" |
150 | unset OLDDIR |
147 | unset OLDDIR |
151 | fi |
148 | fi |
- | 149 | cd "${STARTDIR}" |
|
- | 150 | unset STARTDIR |
|
152 | return 0 |
151 | return 0 |
153 | } |
152 | } |
154 | download_and_unpack_if_necessary "${BINUTILS_SOURCES_DIR}" "${BINUTILS_SOURCES_FILE}" "${BINUTILS_SOURCES_URL}" || exit 1 |
153 | download_and_unpack_if_necessary "${BINUTILS_SOURCES_DIR}" "${BINUTILS_SOURCES_FILE}" "${BINUTILS_SOURCES_URL}" || exit 1 |
155 | 154 | ||
156 | # change directory to the binutils sources |
155 | # change directory to the binutils sources |