Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Rev 26 | Rev 28 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26 Rev 27
Line 67... Line 67...
67
                "(else on a Windows machine:)" \
67
                "(else on a Windows machine:)" \
68
                "       cd ${QNXSDK_PATH}" \
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\"" \
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."
70
                "Note that this step WILL take time on a Win32 machine, but is only done once."
71
fi
71
fi
-
 
72
 
-
 
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)
-
 
74
STAGING_PATH="$(xdg-user-dir DESKTOP 2>/dev/null || echo "${HOME}")"
-
 
75
test -d "${STAGING_PATH}" || STAGING_PATH="${HOME}"
-
 
76
cd "${STAGING_PATH}"
72
 
77
 
73
# are we running the Windows Subsystem for Linux, instead of a real Linux ?
78
# are we running the Windows Subsystem for Linux, instead of a real Linux ?
74
if [ -n "${WSL_DISTRO_NAME}" ]; then
79
if [ -n "${WSL_DISTRO_NAME}" ]; then
75
        # yes. In order to avoid the horrible 9p protocol for file interchange between NTFS and ext4 (a remarkably bad idea by Microsoft),
80
        # yes. In order to avoid the horrible 9p protocol for file interchange between NTFS and ext4 (a remarkably bad idea by Microsoft),
76
        # have a copy of $QNX_HOST and $QNX_TARGET in the WSL2 filesystem. The speed gain is considerable.
81
        # have a copy of $QNX_HOST and $QNX_TARGET in the WSL2 filesystem. The speed gain is considerable.
77
        # NOTE: we do this all over each time the mtime of these directories change, so BEWARE!
82
        # NOTE: we do this all over each time the mtime of these directories change, so BEWARE!
-
 
83
        QNXSDK_CANONICAL_PATH="~/$(basename "${QNXSDK_PATH}")"
78
        if [ ! -d "/tmp/qnxsdk/${QNXSDK_HOSTPATH}" ] || [ "${CURRENT_DIR}/${QNXSDK_PATH}/${QNXSDK_HOSTPATH}" -nt "/tmp/qnxsdk/${QNXSDK_HOSTPATH}" ]; then
84
        if [ ! -d "${QNXSDK_CANONICAL_PATH}/${QNXSDK_HOSTPATH}" ] || [ "${CURRENT_DIR}/${QNXSDK_PATH}/${QNXSDK_HOSTPATH}" -nt "${QNXSDK_CANONICAL_PATH}/${QNXSDK_HOSTPATH}" ]; then
79
                mkdir -p "$(dirname "/tmp/qnxsdk/${QNXSDK_HOSTPATH}")" 2>/dev/null
85
                mkdir -p "$(dirname "${QNXSDK_CANONICAL_PATH}/${QNXSDK_HOSTPATH}")" 2>/dev/null
80
                echo "Deploying QNX ${QNXSDK_VERSION} HOST SDK to WSL2 ext4 filesystem, please wait..."
86
                echo "Deploying QNX ${QNXSDK_VERSION} HOST SDK to WSL2 ext4 filesystem, please wait..."
81
                echo "This operation *WILL* take time, but is only done once - as long as your WSL filesystem is preserved."
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."
82
                cp -R "${CURRENT_DIR}/${QNXSDK_PATH}/${QNXSDK_HOSTPATH}" "$(dirname "/tmp/qnxsdk/${QNXSDK_HOSTPATH}")" || exit 1
88
                cp -R "${CURRENT_DIR}/${QNXSDK_PATH}/${QNXSDK_HOSTPATH}" "$(dirname "${QNXSDK_CANONICAL_PATH}/${QNXSDK_HOSTPATH}")" || exit 1
83
        fi
89
        fi
84
        if [ ! -d "/tmp/qnxsdk/${QNXSDK_TARGETPATH}" ] || [ "${CURRENT_DIR}/${QNXSDK_PATH}/${QNXSDK_TARGETPATH}" -nt "/tmp/qnxsdk/${QNXSDK_TARGETPATH}" ]; then
90
        if [ ! -d "${QNXSDK_CANONICAL_PATH}/${QNXSDK_TARGETPATH}" ] || [ "${CURRENT_DIR}/${QNXSDK_PATH}/${QNXSDK_TARGETPATH}" -nt "${QNXSDK_CANONICAL_PATH}/${QNXSDK_TARGETPATH}" ]; then
85
                mkdir -p "$(dirname "/tmp/qnxsdk/${QNXSDK_TARGETPATH}")" 2>/dev/null
91
                mkdir -p "$(dirname "${QNXSDK_CANONICAL_PATH}/${QNXSDK_TARGETPATH}")" 2>/dev/null
86
                echo "Deploying QNX ${QNXSDK_VERSION} TARGET SDK to WSL2 ext4 filesystem, please wait..."
92
                echo "Deploying QNX ${QNXSDK_VERSION} TARGET SDK to WSL2 ext4 filesystem, please wait..."
87
                echo "This operation *WILL* take time, but is only done once - as long as your WSL filesystem is preserved."
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."
88
                cp -R "${CURRENT_DIR}/${QNXSDK_PATH}/${QNXSDK_TARGETPATH}" "$(dirname "/tmp/qnxsdk/${QNXSDK_TARGETPATH}")" || exit 1
94
                cp -R "${CURRENT_DIR}/${QNXSDK_PATH}/${QNXSDK_TARGETPATH}" "$(dirname "${QNXSDK_CANONICAL_PATH}/${QNXSDK_TARGETPATH}")" || exit 1
89
        fi
95
        fi
90
else
96
else
-
 
97
        # we're not in WSL. We can expect reasonably good file access speeds to the QNX SDP that's bundled with this repository.
-
 
98
        QNXSDK_CANONICAL_PATH="$(realpath "${CURRENT_DIR}/${QNXSDK_PATH}")"
-
 
99
fi
-
 
100
 
91
        # we're not in WSL. 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
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
92
        # (this is totally prohibitive with the official QNX toolchain)
102
# (this is totally prohibitive with the official QNX toolchain)
93
        if [ ! -L /tmp/qnxsdk ] || [ ! "$(readlink /tmp/qnxsdk)" = "$(realpath "${CURRENT_DIR}/${QNXSDK_PATH}")" ]; then
103
if [ ! -L /tmp/qnxsdk ] || [ ! "$(readlink /tmp/qnxsdk)" = "${QNXSDK_CANONICAL_PATH}" ]; then
94
                echo "Creating symlink to QNX toolchain in /tmp/qnxsdk..."
104
        echo "Creating symlink to QNX toolchain in /tmp/qnxsdk..."
95
                rm -rf /tmp/qnxsdk 2>/dev/null
105
        rm -rf /tmp/qnxsdk 2>/dev/null
96
                ln -fs "$(realpath "${CURRENT_DIR}/${QNXSDK_PATH}")" /tmp/qnxsdk || exit 1
106
        ln -fs "${QNXSDK_CANONICAL_PATH}" /tmp/qnxsdk || exit 1
97
        fi
-
 
98
fi
107
fi
99
 
108
 
100
# setup the environment
109
# setup the environment
101
export QNX_HOST="/tmp/qnxsdk/${QNXSDK_HOSTPATH}"
110
export QNX_HOST="/tmp/qnxsdk/${QNXSDK_HOSTPATH}"
102
export QNX_TARGET="/tmp/qnxsdk/${QNXSDK_TARGETPATH}"
111
export QNX_TARGET="/tmp/qnxsdk/${QNXSDK_TARGETPATH}"
Line 113... Line 122...
113
test "${BUILD_TARGET_ARCH}" = "x86_64" && export TARGET_VENDOR="pc" || export TARGET_VENDOR="unknown"
122
test "${BUILD_TARGET_ARCH}" = "x86_64" && export TARGET_VENDOR="pc" || export TARGET_VENDOR="unknown"
114
export TARGET_KERNEL="nto"
123
export TARGET_KERNEL="nto"
115
export TARGET_SYSTEM="qnx${QNXSDK_VERSION}"
124
export TARGET_SYSTEM="qnx${QNXSDK_VERSION}"
116
export TARGET_TRIPLE="${TARGET_ARCH}-${TARGET_VENDOR}-${TARGET_KERNEL}-${TARGET_SYSTEM}"
125
export TARGET_TRIPLE="${TARGET_ARCH}-${TARGET_VENDOR}-${TARGET_KERNEL}-${TARGET_SYSTEM}"
117
echo "Will build for ${TARGET_TRIPLE}"
126
echo "Will build for ${TARGET_TRIPLE}"
118
 
-
 
119
# 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)
-
 
120
STAGING_PATH="$(xdg-user-dir DESKTOP 2>/dev/null || echo "${HOME}")"
-
 
121
test -d "${STAGING_PATH}" || STAGING_PATH="${HOME}"
-
 
122
cd "${STAGING_PATH}"
-
 
123
 
127
 
124
# download the involved source packages and unpack them if not done yet
128
# download the involved source packages and unpack them if not done yet
125
download_and_unpack_if_necessary()
129
download_and_unpack_if_necessary()
126
{
130
{
127
        # helper function that downloads a sources tarball, extracts it and patches it if necessary
131
        # helper function that downloads a sources tarball, extracts it and patches it if necessary