Rev 27 | Rev 29 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 27 | Rev 28 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | exit 1 |
38 | exit 1 |
39 | } |
39 | } |
40 | 40 | ||
41 | # verify we're a x86_64 Linux host |
41 | # verify we're a x86_64 Linux host |
42 | if [ ! "$(uname)" = "Linux" ] || [ ! "$(uname -m)" = "x86_64" ]; then |
42 | if [ ! "$(uname)" = "Linux" ] || [ ! "$(uname -m)" = "x86_64" ]; then |
43 | print_error_and_die "Error: this script requires a x86_64 Linux machine (possibly a virtual |
43 | print_error_and_die "Error: this script requires a x86_64 Linux machine (possibly a virtual machine, or WSL) as the build host." |
44 | fi |
- | |
45 | - | ||
46 | # verify that we have the QNX platform SDK |
- | |
47 | if [ ! -d "${QNXSDK_PATH}/${QNXSDK_HOSTPATH}" ] || [ ! -d "${QNXSDK_PATH}/${QNXSDK_TARGETPATH}" ]; then |
- | |
48 | print_error_and_die "Error: the ${QNXSDK_PATH} path doesn't contain a QNX SDK. It must contain the 'host' and 'target' directories of the QNX SDP for the targeted version of QNX and the ${BUILD_TARGET_ARCH} platform. Please deploy these directories and try again." |
- | |
49 | fi |
44 | fi |
50 | 45 | ||
51 | # verify that we have the required tools |
46 | # verify that we have the required tools |
52 | for REQUIRED_TOOL in ${REQUIRED_TOOLS}; do |
47 | for REQUIRED_TOOL in ${REQUIRED_TOOLS}; do |
53 | "${REQUIRED_TOOL}" --version > /dev/null 2>&1 || print_error_and_die \ |
48 | "${REQUIRED_TOOL}" --version > /dev/null 2>&1 || print_error_and_die \ |
Line 55... | Line 50... | ||
55 | " $(echo "${REQUIRED_TOOLS}"|sed 's/ /\n /g')" \ |
50 | " $(echo "${REQUIRED_TOOLS}"|sed 's/ /\n /g')" \ |
56 | "Please install them (possibly as binary packages with apt-get) and try again." \ |
51 | "Please install them (possibly as binary packages with apt-get) and try again." \ |
57 | "More specifically, the following tool was not found: '${REQUIRED_TOOL}'" |
52 | "More specifically, the following tool was not found: '${REQUIRED_TOOL}'" |
58 | done |
53 | done |
59 | 54 | ||
60 | # verify that |
55 | # verify that we have the QNX platform SDK |
61 | if [ ! - |
56 | if [ ! -d "${QNXSDK_PATH}/${QNXSDK_HOSTPATH}" ] || [ ! -d "${QNXSDK_PATH}/${QNXSDK_TARGETPATH}" ]; then |
62 | print_error_and_die \ |
- | |
63 |
|
57 | print_error_and_die "Error: the ${QNXSDK_PATH} path doesn't contain a QNX SDK. It must contain the 'host' and 'target' directories of the QNX SDP for the targeted version of QNX and the ${BUILD_TARGET_ARCH} platform. Please deploy these directories and try again." |
64 | "(on a POSIX machine:)" \ |
- | |
65 | " cd ${QNXSDK_PATH}" \ |
- | |
66 | " find . -name symlinks.lst -exec ./symlinks.sh {} create \\; && printf 'present' > .symlinks-state" \ |
- | |
67 | "(else on a Windows machine:)" \ |
- | |
68 | " cd ${QNXSDK_PATH}" \ |
- | |
69 | " host\\win64\\x86_64\\usr\\bin\\busybox.exe sh -c \"find . -name symlinks.lst -exec ./symlinks.sh {} create \\; && printf 'present' > .symlinks-state\"" \ |
- | |
70 | "Note that this step WILL take time on a Win32 machine, but is only done once." |
- | |
71 | fi |
58 | fi |
72 | 59 | ||
73 | # change to an immediately visible path, i.e. the user's desktop (failsafe to $HOME if xdg-user-dir is unavailable or points to a nonexistent directory) |
60 | # change to an immediately visible path, i.e. the user's desktop (failsafe to $HOME if xdg-user-dir is unavailable or points to a nonexistent directory) |
74 | STAGING_PATH="$(xdg-user-dir DESKTOP 2>/dev/null || echo "${HOME}")" |
61 | STAGING_PATH="$(xdg-user-dir DESKTOP 2>/dev/null || echo "${HOME}")" |
75 | test -d "${STAGING_PATH}" || STAGING_PATH="${HOME}" |
62 | test -d "${STAGING_PATH}" || STAGING_PATH="${HOME}" |
76 | cd "${STAGING_PATH}" |
63 | cd "${STAGING_PATH}" |
77 | 64 | ||
78 | # are we running the Windows Subsystem for Linux, instead of a real Linux ? |
65 | # are we running the Windows Subsystem for Linux, instead of a real Linux ? |
79 | if [ -n "${WSL_DISTRO_NAME}" ]; then |
66 | if [ -n "${WSL_DISTRO_NAME}" ]; then |
80 | # yes. In order to avoid the horrible 9p protocol for file interchange between NTFS and ext4 (a remarkably bad idea by Microsoft), |
67 | # yes. In order to avoid the horrible 9p protocol for file interchange between NTFS and ext4 (a remarkably bad idea by Microsoft), |
81 | # |
68 | # use the copy of the QNX SDP that our caller is supposed to have put in our $HOME in the WSL2 filesystem. The speed gain is considerable. |
82 | # NOTE: we do this all over each time the mtime of these directories change, so BEWARE! |
- | |
83 | QNXSDK_CANONICAL_PATH=" |
69 | QNXSDK_CANONICAL_PATH="${HOME}/$(basename "${QNXSDK_PATH}")" |
84 | if [ ! -d "${QNXSDK_CANONICAL_PATH}/${QNXSDK_HOSTPATH}" ] || [ |
70 | if [ ! -d "${QNXSDK_CANONICAL_PATH}/${QNXSDK_HOSTPATH}" ] || [ ! -d "${QNXSDK_CANONICAL_PATH}/${QNXSDK_TARGETPATH}" ]; then |
85 | mkdir -p "$(dirname "${QNXSDK_CANONICAL_PATH}/${QNXSDK_HOSTPATH}")" 2>/dev/null |
- | |
86 | echo "Deploying QNX ${QNXSDK_VERSION} HOST SDK to WSL2 ext4 filesystem, please wait..." |
- | |
87 | echo "This operation *WILL* take time, but is only done once - as long as this QNX SDP directory doesn't change and that your WSL's /tmp directory is preserved." |
- | |
88 |
|
71 | print_error_and_die "Error: the QNX SDP hasn't been deployed to ${QNXSDK_CANONICAL_PATH}. Please do so and run this script again." |
89 | fi |
- | |
90 | if [ ! -d "${QNXSDK_CANONICAL_PATH}/${QNXSDK_TARGETPATH}" ] || [ "${CURRENT_DIR}/${QNXSDK_PATH}/${QNXSDK_TARGETPATH}" -nt "${QNXSDK_CANONICAL_PATH}/${QNXSDK_TARGETPATH}" ]; then |
- | |
91 | mkdir -p "$(dirname "${QNXSDK_CANONICAL_PATH}/${QNXSDK_TARGETPATH}")" 2>/dev/null |
- | |
92 | echo "Deploying QNX ${QNXSDK_VERSION} TARGET SDK to WSL2 ext4 filesystem, please wait..." |
- | |
93 | echo "This operation *WILL* take time, but is only done once - as long as this QNX SDP directory doesn't change and that your WSL /tmp directory is preserved." |
- | |
94 | cp -R "${CURRENT_DIR}/${QNXSDK_PATH}/${QNXSDK_TARGETPATH}" "$(dirname "${QNXSDK_CANONICAL_PATH}/${QNXSDK_TARGETPATH}")" || exit 1 |
- | |
95 | fi |
72 | fi |
96 | else |
73 | else |
97 | # we're not in WSL. We can expect reasonably good file access speeds to the QNX SDP that's bundled with this |
74 | # 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. |
98 | QNXSDK_CANONICAL_PATH="$(realpath "${CURRENT_DIR}/${QNXSDK_PATH}")" |
75 | QNXSDK_CANONICAL_PATH="$(realpath "${CURRENT_DIR}/${QNXSDK_PATH}")" |
- | 76 | fi |
|
- | 77 | ||
- | 78 | # 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) |
|
- | 79 | if [ ! -e "${QNXSDK_CANONICAL_PATH}/${QNXSDK_HOSTPATH}/usr/bin/gcc" ] || [ ! -e "${QNXSDK_CANONICAL_PATH}/${QNXSDK_TARGETPATH}/usr/include/readline.h" ]; then |
|
- | 80 | print_error_and_die \ |
|
- | 81 | "Error: the toolchain platform-specific symbolic links have not been deployed in this QNX SDK. Please run" \ |
|
- | 82 | "(on a POSIX machine:)" \ |
|
- | 83 | " cd ${QNXSDK_CANONICAL_PATH}" \ |
|
- | 84 | " find . -name symlinks.lst -exec ./symlinks.sh {} create \\; && printf 'present' > .symlinks-state" \ |
|
- | 85 | "(else on a Windows machine:)" \ |
|
- | 86 | " cd ${QNXSDK_CANONICAL_PATH}" \ |
|
- | 87 | " host\\win64\\x86_64\\usr\\bin\\busybox.exe sh -c \"find . -name symlinks.lst -exec ./symlinks.sh {} create \\; && printf 'present' > .symlinks-state\"" \ |
|
- | 88 | "Note that this step WILL take time on a Win32 machine, but is only done once." |
|
99 | fi |
89 | fi |
100 | 90 | ||
101 | # 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 |
91 | # 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 |
102 | # (this is totally prohibitive with the official QNX toolchain) |
92 | # (this is totally prohibitive with the official QNX toolchain) |
103 | if [ ! -L /tmp/qnxsdk ] || [ ! "$(readlink /tmp/qnxsdk)" = "${QNXSDK_CANONICAL_PATH}" ]; then |
93 | if [ ! -L /tmp/qnxsdk ] || [ ! "$(readlink /tmp/qnxsdk)" = "${QNXSDK_CANONICAL_PATH}" ]; then |
Line 505... | Line 495... | ||
505 | -D CMAKE_BUILD_TYPE="${LLVM_BUILD_CONFIGURATION_TYPE}" \ |
495 | -D CMAKE_BUILD_TYPE="${LLVM_BUILD_CONFIGURATION_TYPE}" \ |
506 | -D CMAKE_INSTALL_PREFIX="/usr/bin" \ |
496 | -D CMAKE_INSTALL_PREFIX="/usr/bin" \ |
507 | -D CMAKE_STAGING_PREFIX="${CURRENT_DIR}/llvm-build/${BUILD_TARGET_ARCH}" \ |
497 | -D CMAKE_STAGING_PREFIX="${CURRENT_DIR}/llvm-build/${BUILD_TARGET_ARCH}" \ |
508 | -D CMAKE_C_COMPILER_LAUNCHER="ccache" \ |
498 | -D CMAKE_C_COMPILER_LAUNCHER="ccache" \ |
509 | -D CMAKE_CXX_COMPILER_LAUNCHER="ccache" \ |
499 | -D CMAKE_CXX_COMPILER_LAUNCHER="ccache" \ |
- | 500 | -D HAVE_STEADY_CLOCK="0" \ |
|
510 | -D LLVM_HOST_TRIPLE="${TARGET_TRIPLE}" \ |
501 | -D LLVM_HOST_TRIPLE="${TARGET_TRIPLE}" \ |
511 | -D LLVM_ENABLE_PROJECTS="${LLVM_PROJECTS_TO_BUILD}" \ |
502 | -D LLVM_ENABLE_PROJECTS="${LLVM_PROJECTS_TO_BUILD}" \ |
512 | -D LLVM_ENABLE_RUNTIMES="${LLVM_RUNTIMES_TO_BUILD}" \ |
503 | -D LLVM_ENABLE_RUNTIMES="${LLVM_RUNTIMES_TO_BUILD}" \ |
513 | -D LLVM_TARGETS_TO_BUILD="AArch64;X86" \ |
504 | -D LLVM_TARGETS_TO_BUILD="AArch64;X86" \ |
514 | -D DEFAULT_SYSROOT="../../../../../${QNXSDK_TARGETPATH}/${BUILD_TARGET_ARCH}" \ |
505 | -D DEFAULT_SYSROOT="../../../../../${QNXSDK_TARGETPATH}/${BUILD_TARGET_ARCH}" \ |