dsh-remote 0.8.91 → 0.8.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/LICENSE +21 -21
  2. package/README.en.md +369 -368
  3. package/README.md +354 -353
  4. package/cordis.patch.yml +9 -9
  5. package/lib/audit.js +45 -45
  6. package/lib/binding.js +172 -172
  7. package/lib/client.js +4647 -4550
  8. package/lib/credential.js +270 -263
  9. package/lib/errors.js +141 -141
  10. package/lib/exec-job.js +242 -242
  11. package/lib/file-reference.js +457 -457
  12. package/lib/forwards.js +258 -258
  13. package/lib/host-api.js +822 -822
  14. package/lib/hostkey.js +108 -108
  15. package/lib/http-transport.js +201 -201
  16. package/lib/ignore.js +202 -202
  17. package/lib/index.js +4488 -4394
  18. package/lib/instructions-dynamic.js +415 -415
  19. package/lib/instructions.js +288 -288
  20. package/lib/open-folder.js +56 -56
  21. package/lib/openssh.js +940 -881
  22. package/lib/paths.js +292 -292
  23. package/lib/pool.js +1029 -970
  24. package/lib/posix-shell.cjs +34 -0
  25. package/lib/registry.js +296 -296
  26. package/lib/remote-fs.js +173 -173
  27. package/lib/remote-sandbox.js +183 -183
  28. package/lib/remote-shell-child.cjs +397 -400
  29. package/lib/remote-shell.js +697 -697
  30. package/lib/remote-skills.js +312 -0
  31. package/lib/routes-audit.js +58 -58
  32. package/lib/routes-forwards.js +72 -72
  33. package/lib/routes-fs.js +251 -245
  34. package/lib/routes-machines.js +186 -186
  35. package/lib/routes-misc.js +187 -150
  36. package/lib/routes-term.js +169 -169
  37. package/lib/routes-update.js +143 -143
  38. package/lib/routes-web-attach.js +112 -112
  39. package/lib/routes-workspace.js +312 -312
  40. package/lib/search.js +235 -235
  41. package/lib/sftp-surface.js +119 -119
  42. package/lib/sshconfig.js +779 -779
  43. package/lib/sync.js +350 -350
  44. package/lib/tasks.js +95 -95
  45. package/lib/telemetry.js +247 -247
  46. package/lib/terminal.js +205 -205
  47. package/lib/tui/flow.js +130 -130
  48. package/lib/tui/format.js +380 -380
  49. package/lib/tui/i18n.js +350 -350
  50. package/lib/tui/index.js +531 -531
  51. package/lib/tui/provider.js +344 -344
  52. package/lib/tui/scene.js +986 -986
  53. package/lib/update.js +490 -472
  54. package/lib/web-attach.js +860 -850
  55. package/lib/workspace-cleanup.js +337 -337
  56. package/package.json +103 -100
  57. package/node_modules/buildcheck/.eslintrc.js +0 -5
  58. package/node_modules/buildcheck/.github/workflows/ci.yml +0 -88
  59. package/node_modules/buildcheck/.github/workflows/lint.yml +0 -27
  60. package/node_modules/buildcheck/.npmignore +0 -3
  61. package/node_modules/buildcheck/LICENSE +0 -19
  62. package/node_modules/buildcheck/README.md +0 -106
  63. package/node_modules/buildcheck/deps/Find-VisualStudio.cs +0 -250
  64. package/node_modules/buildcheck/lib/findvs.js +0 -361
  65. package/node_modules/buildcheck/lib/index.js +0 -738
  66. package/node_modules/buildcheck/package.json +0 -36
  67. package/node_modules/buildcheck/test/test.js +0 -8
  68. package/node_modules/cpu-features/.eslintrc.js +0 -5
  69. package/node_modules/cpu-features/.github/workflows/ci.yml +0 -74
  70. package/node_modules/cpu-features/.github/workflows/lint.yml +0 -27
  71. package/node_modules/cpu-features/LICENSE +0 -19
  72. package/node_modules/cpu-features/README.md +0 -59
  73. package/node_modules/cpu-features/binding.gyp +0 -16
  74. package/node_modules/cpu-features/buildcheck.js +0 -32
  75. package/node_modules/cpu-features/deps/cpu_features/.clang-format +0 -4
  76. package/node_modules/cpu-features/deps/cpu_features/.dockerignore +0 -31
  77. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/Dockerfile +0 -5
  78. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/aarch64_linux_cmake.yml +0 -30
  79. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_freebsd_cmake.yml +0 -22
  80. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_linux_bazel.yml +0 -26
  81. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_linux_cmake.yml +0 -31
  82. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_macos_cmake.yml +0 -43
  83. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_windows_cmake.yml +0 -25
  84. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/arm_linux_cmake.yml +0 -31
  85. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/clang_format.yml +0 -24
  86. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/mips_linux_cmake.yml +0 -30
  87. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/power_linux_cmake.yml +0 -29
  88. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/riscv_linux_cmake.yml +0 -28
  89. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/s390x_linux_cmake.yml +0 -27
  90. package/node_modules/cpu-features/deps/cpu_features/.grenrc.yml +0 -21
  91. package/node_modules/cpu-features/deps/cpu_features/BUILD.bazel +0 -329
  92. package/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt +0 -261
  93. package/node_modules/cpu-features/deps/cpu_features/CONTRIBUTING.md +0 -23
  94. package/node_modules/cpu-features/deps/cpu_features/LICENSE +0 -230
  95. package/node_modules/cpu-features/deps/cpu_features/README.md +0 -272
  96. package/node_modules/cpu-features/deps/cpu_features/WORKSPACE +0 -19
  97. package/node_modules/cpu-features/deps/cpu_features/bazel/ci/README.md +0 -5
  98. package/node_modules/cpu-features/deps/cpu_features/bazel/platforms.bzl +0 -11
  99. package/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesConfig.cmake.in +0 -3
  100. package/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesNdkCompatConfig.cmake.in +0 -3
  101. package/node_modules/cpu-features/deps/cpu_features/cmake/README.md +0 -30
  102. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/Makefile +0 -252
  103. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/README.md +0 -40
  104. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.dot +0 -64
  105. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.svg +0 -312
  106. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/generate_image.sh +0 -7
  107. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/amd64/Dockerfile +0 -48
  108. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/toolchain/Dockerfile +0 -34
  109. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/CMakeLists.txt +0 -22
  110. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/main.cpp +0 -11
  111. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/vagrant/freebsd/Vagrantfile +0 -107
  112. package/node_modules/cpu-features/deps/cpu_features/cmake/googletest.CMakeLists.txt.in +0 -15
  113. package/node_modules/cpu-features/deps/cpu_features/cpu_features.gyp +0 -105
  114. package/node_modules/cpu-features/deps/cpu_features/include/cpu_features_cache_info.h +0 -54
  115. package/node_modules/cpu-features/deps/cpu_features/include/cpu_features_macros.h +0 -384
  116. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_aarch64.h +0 -259
  117. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h +0 -121
  118. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_mips.h +0 -74
  119. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_ppc.h +0 -149
  120. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_riscv.h +0 -72
  121. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_s390x.h +0 -108
  122. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_x86.h +0 -288
  123. package/node_modules/cpu-features/deps/cpu_features/include/internal/bit_utils.h +0 -40
  124. package/node_modules/cpu-features/deps/cpu_features/include/internal/cpuid_x86.h +0 -37
  125. package/node_modules/cpu-features/deps/cpu_features/include/internal/filesystem.h +0 -39
  126. package/node_modules/cpu-features/deps/cpu_features/include/internal/hwcaps.h +0 -240
  127. package/node_modules/cpu-features/deps/cpu_features/include/internal/stack_line_reader.h +0 -49
  128. package/node_modules/cpu-features/deps/cpu_features/include/internal/string_view.h +0 -110
  129. package/node_modules/cpu-features/deps/cpu_features/include/internal/windows_utils.h +0 -70
  130. package/node_modules/cpu-features/deps/cpu_features/ndk_compat/CMakeLists.txt +0 -60
  131. package/node_modules/cpu-features/deps/cpu_features/ndk_compat/README.md +0 -4
  132. package/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.c +0 -205
  133. package/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.h +0 -320
  134. package/node_modules/cpu-features/deps/cpu_features/ndk_compat/ndk-compat-test.c +0 -12
  135. package/node_modules/cpu-features/deps/cpu_features/patches/0001-Add-Apple-Silicon-Support.patch +0 -456
  136. package/node_modules/cpu-features/deps/cpu_features/scripts/generate_badges.d +0 -165
  137. package/node_modules/cpu-features/deps/cpu_features/scripts/make_release.sh +0 -75
  138. package/node_modules/cpu-features/deps/cpu_features/scripts/run_integration.sh +0 -490
  139. package/node_modules/cpu-features/deps/cpu_features/scripts/test_integration.sh +0 -79
  140. package/node_modules/cpu-features/deps/cpu_features/src/copy.inl +0 -19
  141. package/node_modules/cpu-features/deps/cpu_features/src/define_introspection.inl +0 -86
  142. package/node_modules/cpu-features/deps/cpu_features/src/define_introspection_and_hwcaps.inl +0 -26
  143. package/node_modules/cpu-features/deps/cpu_features/src/equals.inl +0 -22
  144. package/node_modules/cpu-features/deps/cpu_features/src/filesystem.c +0 -62
  145. package/node_modules/cpu-features/deps/cpu_features/src/hwcaps.c +0 -169
  146. package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64__base_implementation.inl +0 -88
  147. package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_linux_or_android.c +0 -79
  148. package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.c +0 -82
  149. package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_windows.c +0 -138
  150. package/node_modules/cpu-features/deps/cpu_features/src/impl_arm_linux_or_android.c +0 -212
  151. package/node_modules/cpu-features/deps/cpu_features/src/impl_mips_linux_or_android.c +0 -93
  152. package/node_modules/cpu-features/deps/cpu_features/src/impl_ppc_linux.c +0 -163
  153. package/node_modules/cpu-features/deps/cpu_features/src/impl_riscv_linux.c +0 -111
  154. package/node_modules/cpu-features/deps/cpu_features/src/impl_s390x_linux.c +0 -120
  155. package/node_modules/cpu-features/deps/cpu_features/src/impl_x86__base_implementation.inl +0 -2055
  156. package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_freebsd.c +0 -68
  157. package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_linux_or_android.c +0 -58
  158. package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_macos.c +0 -57
  159. package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_windows.c +0 -58
  160. package/node_modules/cpu-features/deps/cpu_features/src/stack_line_reader.c +0 -132
  161. package/node_modules/cpu-features/deps/cpu_features/src/string_view.c +0 -192
  162. package/node_modules/cpu-features/deps/cpu_features/src/utils/list_cpu_features.c +0 -461
  163. package/node_modules/cpu-features/deps/cpu_features/test/CMakeLists.txt +0 -114
  164. package/node_modules/cpu-features/deps/cpu_features/test/bit_utils_test.cc +0 -53
  165. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_aarch64_test.cc +0 -396
  166. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_arm_test.cc +0 -384
  167. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_mips_test.cc +0 -176
  168. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_ppc_test.cc +0 -131
  169. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_riscv_test.cc +0 -180
  170. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_s390x_test.cc +0 -82
  171. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_x86_test.cc +0 -1729
  172. package/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.cc +0 -103
  173. package/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.h +0 -61
  174. package/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.cc +0 -52
  175. package/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.h +0 -31
  176. package/node_modules/cpu-features/deps/cpu_features/test/stack_line_reader_test.cc +0 -132
  177. package/node_modules/cpu-features/deps/cpu_features/test/string_view_test.cc +0 -202
  178. package/node_modules/cpu-features/lib/index.js +0 -5
  179. package/node_modules/cpu-features/package.json +0 -40
  180. package/node_modules/cpu-features/src/binding.cc +0 -151
  181. package/node_modules/cpu-features/test/test.js +0 -12
@@ -1,75 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -e # Fail on error
4
- set -u # Treat unset variables as an error and exit immediately
5
-
6
- ACTION='\033[1;90m'
7
- FINISHED='\033[1;96m'
8
- NOCOLOR='\033[0m'
9
- ERROR='\033[0;31m'
10
-
11
- echo -e "${ACTION}Checking environnement${NOCOLOR}"
12
- if [[ ! $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
13
- then
14
- echo -e "${ERROR}Invalid version number. Aborting. ${NOCOLOR}"
15
- exit 1
16
- fi
17
-
18
- declare -r VERSION=$1
19
- declare -r GIT_TAG="v$1"
20
-
21
- BRANCH=$(git rev-parse --abbrev-ref HEAD)
22
- if [[ "${BRANCH}" != "main" ]]
23
- then
24
- echo -e "${ERROR}Not on main. Aborting. ${NOCOLOR}"
25
- echo
26
- exit 1
27
- fi
28
-
29
- git fetch
30
- HEADHASH=$(git rev-parse HEAD)
31
- UPSTREAMHASH=$(git rev-parse main@{upstream})
32
-
33
- if [[ "${HEADHASH}" != "${UPSTREAMHASH}" ]]
34
- then
35
- echo -e "${ERROR}Not up to date with origin. Aborting.${NOCOLOR}"
36
- echo
37
- exit 1
38
- fi
39
-
40
- git update-index -q --refresh
41
- if ! git diff-index --quiet HEAD --
42
- then
43
- echo -e "${ERROR}Branch has uncommited changes. Aborting.${NOCOLOR}"
44
- exit 1
45
- fi
46
-
47
- if [ ! -z "$(git ls-files --exclude-standard --others)" ]
48
- then
49
- echo -e "${ERROR}Branch has untracked files. Aborting.${NOCOLOR}"
50
- exit 1
51
- fi
52
-
53
- declare -r LATEST_GIT_TAG=$(git describe --tags --abbrev=0)
54
- declare -r LATEST_VERSION=${LATEST_GIT_TAG#"v"}
55
-
56
- if ! dpkg --compare-versions "${VERSION}" "gt" "${LATEST_VERSION}"
57
- then
58
- echo -e "${ERROR}Invalid version ${VERSION} <= ${LATEST_VERSION} (latest). Aborting.${NOCOLOR}"
59
- exit 1
60
- fi
61
-
62
- echo -e "${ACTION}Modifying CMakeLists.txt${NOCOLOR}"
63
- sed -i "s/CpuFeatures VERSION ${LATEST_VERSION}/CpuFeatures VERSION ${VERSION}/g" CMakeLists.txt
64
-
65
- echo -e "${ACTION}Commit new revision${NOCOLOR}"
66
- git add CMakeLists.txt
67
- git commit -m"Release ${GIT_TAG}"
68
-
69
- echo -e "${ACTION}Create new tag${NOCOLOR}"
70
- git tag ${GIT_TAG}
71
-
72
- echo -e "${FINISHED}Manual steps:${NOCOLOR}"
73
- echo -e "${FINISHED} - Push the tag upstream 'git push origin ${GIT_TAG}'${NOCOLOR}"
74
- echo -e "${FINISHED} - Create a new release https://github.com/google/cpu_features/releases/new${NOCOLOR}"
75
- echo -e "${FINISHED} - Update the Release Notes 'gren release --override'${NOCOLOR}"
@@ -1,490 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -eo pipefail
3
-
4
- function extract() {
5
- echo "Extracting ${1}..."
6
- case $1 in
7
- *.tar.bz2) tar xjf "$1" ;;
8
- *.tar.xz) tar xJf "$1" ;;
9
- *.tar.gz) tar xzf "$1" ;;
10
- *)
11
- >&2 echo "don't know how to extract '$1'..."
12
- exit 1
13
- esac
14
- }
15
-
16
- function unpack() {
17
- mkdir -p "${ARCHIVE_DIR}"
18
- cd "${ARCHIVE_DIR}" || exit 2
19
- local -r URL=$1
20
- local -r RELATIVE_DIR=$2
21
- local -r DESTINATION="${ARCHIVE_DIR}/${RELATIVE_DIR}"
22
- if [[ ! -d "${DESTINATION}" ]] ; then
23
- echo "Downloading ${URL}..."
24
- local -r ARCHIVE_NAME=$(basename "${URL}")
25
- [[ -f "${ARCHIVE_NAME}" ]] || wget --no-verbose "${URL}"
26
- extract "${ARCHIVE_NAME}"
27
- rm -f "${ARCHIVE_NAME}"
28
- fi
29
- }
30
-
31
- function install_qemu() {
32
- if [[ "${QEMU_ARCH}" == "DISABLED" ]]; then
33
- >&2 echo 'QEMU is disabled !'
34
- return 0
35
- fi
36
- local -r QEMU_VERSION=${QEMU_VERSION:=7.1.0}
37
- local -r QEMU_TARGET=${QEMU_ARCH}-linux-user
38
-
39
- if echo "${QEMU_VERSION} ${QEMU_TARGET}" | cmp --silent "${QEMU_INSTALL}/.build" -; then
40
- echo "qemu ${QEMU_VERSION} up to date!"
41
- return 0
42
- fi
43
-
44
- echo "QEMU_VERSION: ${QEMU_VERSION}"
45
- echo "QEMU_TARGET: ${QEMU_TARGET}"
46
-
47
- rm -rf "${QEMU_INSTALL}"
48
-
49
- # Checking for a tarball before downloading makes testing easier :-)
50
- local -r QEMU_URL="http://wiki.qemu-project.org/download/qemu-${QEMU_VERSION}.tar.xz"
51
- local -r QEMU_DIR="qemu-${QEMU_VERSION}"
52
- unpack ${QEMU_URL} ${QEMU_DIR}
53
- cd ${QEMU_DIR} || exit 2
54
-
55
- # Qemu (meson based build) depends on: pkgconf, libglib2.0, python3, ninja
56
- ./configure \
57
- --prefix="${QEMU_INSTALL}" \
58
- --target-list="${QEMU_TARGET}" \
59
- --audio-drv-list= \
60
- --disable-brlapi \
61
- --disable-curl \
62
- --disable-curses \
63
- --disable-docs \
64
- --disable-gcrypt \
65
- --disable-gnutls \
66
- --disable-gtk \
67
- --disable-libnfs \
68
- --disable-libssh \
69
- --disable-nettle \
70
- --disable-opengl \
71
- --disable-sdl \
72
- --disable-virglrenderer \
73
- --disable-vte
74
-
75
- # wrapper on ninja
76
- make -j8
77
- make install
78
-
79
- echo "$QEMU_VERSION $QEMU_TARGET" > "${QEMU_INSTALL}/.build"
80
- }
81
-
82
- function assert_defined(){
83
- if [[ -z "${!1}" ]]; then
84
- >&2 echo "Variable '${1}' must be defined"
85
- exit 1
86
- fi
87
- }
88
-
89
- function clean_build() {
90
- # Cleanup previous build
91
- rm -rf "${BUILD_DIR}"
92
- mkdir -p "${BUILD_DIR}"
93
- }
94
-
95
- function expand_linaro_config() {
96
- #ref: https://releases.linaro.org/components/toolchain/binaries/
97
- local -r LINARO_VERSION=7.5-2019.12
98
- local -r LINARO_ROOT_URL=https://releases.linaro.org/components/toolchain/binaries/${LINARO_VERSION}
99
-
100
- local -r GCC_VERSION=7.5.0-2019.12
101
- local -r GCC_URL=${LINARO_ROOT_URL}/${TARGET}/gcc-linaro-${GCC_VERSION}-x86_64_${TARGET}.tar.xz
102
- local -r GCC_RELATIVE_DIR="gcc-linaro-${GCC_VERSION}-x86_64_${TARGET}"
103
- unpack "${GCC_URL}" "${GCC_RELATIVE_DIR}"
104
-
105
- local -r SYSROOT_VERSION=2.25-2019.12
106
- local -r SYSROOT_URL=${LINARO_ROOT_URL}/${TARGET}/sysroot-glibc-linaro-${SYSROOT_VERSION}-${TARGET}.tar.xz
107
- local -r SYSROOT_RELATIVE_DIR=sysroot-glibc-linaro-${SYSROOT_VERSION}-${TARGET}
108
- unpack "${SYSROOT_URL}" "${SYSROOT_RELATIVE_DIR}"
109
-
110
- local -r SYSROOT_DIR=${ARCHIVE_DIR}/${SYSROOT_RELATIVE_DIR}
111
- local -r STAGING_DIR=${ARCHIVE_DIR}/${SYSROOT_RELATIVE_DIR}-stage
112
- local -r GCC_DIR=${ARCHIVE_DIR}/${GCC_RELATIVE_DIR}
113
-
114
- # Write a Toolchain file
115
- # note: This is manadatory to use a file in order to have the CMake variable
116
- # 'CMAKE_CROSSCOMPILING' set to TRUE.
117
- # ref: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-linux
118
- cat >"$TOOLCHAIN_FILE" <<EOL
119
- set(CMAKE_SYSTEM_NAME Linux)
120
- set(CMAKE_SYSTEM_PROCESSOR ${TARGET})
121
-
122
- set(CMAKE_SYSROOT ${SYSROOT_DIR})
123
- set(CMAKE_STAGING_PREFIX ${STAGING_DIR})
124
-
125
- set(tools ${GCC_DIR})
126
- set(CMAKE_C_COMPILER \${tools}/bin/${TARGET}-gcc)
127
- set(CMAKE_CXX_COMPILER \${tools}/bin/${TARGET}-g++)
128
-
129
- set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
130
- set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
131
- set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
132
- set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
133
- EOL
134
- CMAKE_ADDITIONAL_ARGS+=( -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" )
135
- QEMU_ARGS+=( -L "${SYSROOT_DIR}" )
136
- QEMU_ARGS+=( -E LD_LIBRARY_PATH=/lib )
137
- }
138
-
139
- function expand_bootlin_config() {
140
- # ref: https://toolchains.bootlin.com/
141
- local -r GCC_DIR=${ARCHIVE_DIR}/${GCC_RELATIVE_DIR}
142
-
143
- case "${TARGET}" in
144
- "aarch64")
145
- local -r TOOLCHAIN_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--glibc--stable-2021.11-1.tar.bz2"
146
- local -r GCC_PREFIX="aarch64"
147
- ;;
148
- "aarch64be")
149
- local -r TOOLCHAIN_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64be/tarballs/aarch64be--glibc--stable-2021.11-1.tar.bz2"
150
- local -r GCC_PREFIX="aarch64_be"
151
- ;;
152
- "ppc64le")
153
- local -r TOOLCHAIN_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc64le-power8/tarballs/powerpc64le-power8--glibc--stable-2021.11-1.tar.bz2"
154
- local -r GCC_PREFIX="powerpc64le"
155
- ;;
156
- "ppc64")
157
- local -r TOOLCHAIN_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc64-power8/tarballs/powerpc64-power8--glibc--stable-2021.11-1.tar.bz2"
158
- local -r GCC_PREFIX="powerpc64"
159
- ;;
160
- "ppc")
161
- #local -r TOOLCHAIN_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc-e500mc/tarballs/powerpc-e500mc--glibc--stable-2021.11-1.tar.bz2"
162
- local -r TOOLCHAIN_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc-440fp/tarballs/powerpc-440fp--glibc--stable-2021.11-1.tar.bz2"
163
- local -r GCC_PREFIX="powerpc"
164
- ;;
165
- "riscv32")
166
- local -r TOOLCHAIN_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/riscv32-ilp32d/tarballs/riscv32-ilp32d--glibc--bleeding-edge-2022.08-1.tar.bz2"
167
- local -r GCC_PREFIX="riscv32"
168
- ;;
169
- "riscv64")
170
- local -r TOOLCHAIN_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/riscv64-lp64d/tarballs/riscv64-lp64d--glibc--stable-2022.08-1.tar.bz2"
171
- local -r GCC_PREFIX="riscv64"
172
- ;;
173
- "s390x")
174
- local -r TOOLCHAIN_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/s390x-z13/tarballs/s390x-z13--glibc--stable-2022.08-1.tar.bz2"
175
- local -r GCC_PREFIX="s390x"
176
- ;;
177
- *)
178
- >&2 echo 'unknown power platform'
179
- exit 1 ;;
180
- esac
181
-
182
- local -r TOOLCHAIN_RELATIVE_DIR="${TARGET}"
183
- unpack "${TOOLCHAIN_URL}" "${TOOLCHAIN_RELATIVE_DIR}"
184
- local -r EXTRACT_DIR="${ARCHIVE_DIR}/$(basename ${TOOLCHAIN_URL%.tar.bz2})"
185
-
186
- local -r TOOLCHAIN_DIR=${ARCHIVE_DIR}/${TOOLCHAIN_RELATIVE_DIR}
187
- if [[ -d "${EXTRACT_DIR}" ]]; then
188
- mv "${EXTRACT_DIR}" "${TOOLCHAIN_DIR}"
189
- fi
190
-
191
- local -r SYSROOT_DIR="${TOOLCHAIN_DIR}/${GCC_PREFIX}-buildroot-linux-gnu/sysroot"
192
- #local -r STAGING_DIR=${SYSROOT_DIR}-stage
193
-
194
- # Write a Toolchain file
195
- # note: This is manadatory to use a file in order to have the CMake variable
196
- # 'CMAKE_CROSSCOMPILING' set to TRUE.
197
- # ref: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-linux
198
- cat >"${TOOLCHAIN_FILE}" <<EOL
199
- set(CMAKE_SYSTEM_NAME Linux)
200
- set(CMAKE_SYSTEM_PROCESSOR ${GCC_PREFIX})
201
-
202
- set(CMAKE_SYSROOT ${SYSROOT_DIR})
203
- #set(CMAKE_STAGING_PREFIX ${STAGING_DIR})
204
-
205
- set(tools ${TOOLCHAIN_DIR})
206
-
207
- set(CMAKE_C_COMPILER \${tools}/bin/${GCC_PREFIX}-linux-gcc)
208
- set(CMAKE_C_FLAGS "${POWER_FLAGS}")
209
- set(CMAKE_CXX_COMPILER \${tools}/bin/${GCC_PREFIX}-linux-g++)
210
- set(CMAKE_CXX_FLAGS "${POWER_FLAGS} -L${SYSROOT_DIR}/lib")
211
-
212
- set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_DIR})
213
- set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
214
- set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
215
- set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
216
- set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
217
- EOL
218
-
219
- CMAKE_ADDITIONAL_ARGS+=( -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" )
220
- QEMU_ARGS+=( -L "${SYSROOT_DIR}" )
221
- QEMU_ARGS+=( -E LD_PRELOAD="${SYSROOT_DIR}/usr/lib/libstdc++.so.6:${SYSROOT_DIR}/lib/libgcc_s.so.1" )
222
- }
223
-
224
- function expand_codescape_config() {
225
- # https://www.mips.com/develop/tools/codescape-mips-sdk/mips-toolchain-configurations/
226
- # mips-mti: MIPS32R6 and MIPS64R6
227
- # mips-img: MIPS32R2 and MIPS64R2
228
-
229
- # ref: https://codescape.mips.com/components/toolchain/2020.06-01/downloads.html
230
- local -r DATE=2020.06-01
231
- local -r CODESCAPE_URL=https://codescape.mips.com/components/toolchain/${DATE}/Codescape.GNU.Tools.Package.${DATE}.for.MIPS.MTI.Linux.CentOS-6.x86_64.tar.gz
232
- local -r GCC_RELATIVE_DIR="mips-mti-linux-gnu/${DATE}"
233
-
234
- # ref: https://codescape.mips.com/components/toolchain/2019.02-04/downloads.html
235
- #local -r DATE=2019.02-04
236
- #local -r CODESCAPE_URL=https://codescape.mips.com/components/toolchain/${DATE}/Codescape.GNU.Tools.Package.${DATE}.for.MIPS.IMG.Linux.CentOS-6.x86_64.tar.gz
237
- #local -r GCC_RELATIVE_DIR="mips-img-linux-gnu/${DATE}"
238
-
239
- local -r GCC_URL=${CODESCAPE_URL}
240
- unpack "${GCC_URL}" "${GCC_RELATIVE_DIR}"
241
-
242
- local -r GCC_DIR=${ARCHIVE_DIR}/${GCC_RELATIVE_DIR}
243
- local MIPS_FLAGS=""
244
- local LIBC_DIR_SUFFIX=""
245
- local FLAVOUR=""
246
- case "${TARGET}" in
247
- "mips32")
248
- MIPS_FLAGS="-EB -mips32r6 -mabi=32"
249
- FLAVOUR="mips-r6-hard"
250
- #MIPS_FLAGS="-EB -mips32r2 -mabi=32"
251
- #FLAVOUR="mips-r2-hard"
252
- LIBC_DIR_SUFFIX="lib"
253
- ;;
254
- "mips32el")
255
- MIPS_FLAGS="-EL -mips32r6 -mabi=32"
256
- FLAVOUR="mipsel-r6-hard"
257
- #MIPS_FLAGS="-EL -mips32r2 -mabi=32"
258
- #FLAVOUR="mipsel-r2-hard"
259
- LIBC_DIR_SUFFIX="lib"
260
- ;;
261
- "mips64")
262
- MIPS_FLAGS="-EB -mips64r6 -mabi=64"
263
- FLAVOUR="mips-r6-hard"
264
- #MIPS_FLAGS="-EB -mips64r2 -mabi=64"
265
- #FLAVOUR="mips-r2-hard"
266
- LIBC_DIR_SUFFIX="lib64"
267
- ;;
268
- "mips64el")
269
- MIPS_FLAGS="-EL -mips64r6 -mabi=64"
270
- FLAVOUR="mipsel-r6-hard"
271
- #MIPS_FLAGS="-EL -mips64r2 -mabi=64"
272
- #FLAVOUR="mipsel-r2-hard"
273
- LIBC_DIR_SUFFIX="lib64"
274
- ;;
275
- *)
276
- >&2 echo 'unknown mips platform'
277
- exit 1 ;;
278
- esac
279
- local -r SYSROOT_DIR=${GCC_DIR}/sysroot
280
- local -r STAGING_DIR=${SYSROOT_DIR}-stage
281
-
282
- # Write a Toolchain file
283
- # note: This is manadatory to use a file in order to have the CMake variable
284
- # 'CMAKE_CROSSCOMPILING' set to TRUE.
285
- # ref: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-linux
286
- cat >"${TOOLCHAIN_FILE}" <<EOL
287
- set(CMAKE_SYSTEM_NAME Linux)
288
- set(CMAKE_SYSTEM_PROCESSOR ${TARGET})
289
-
290
- set(CMAKE_SYSROOT ${SYSROOT_DIR})
291
- set(CMAKE_STAGING_PREFIX ${STAGING_DIR})
292
-
293
- set(tools ${GCC_DIR})
294
-
295
- # R6
296
- set(CMAKE_C_COMPILER \${tools}/bin/mips-mti-linux-gnu-gcc)
297
- set(CMAKE_C_FLAGS "${MIPS_FLAGS}")
298
- set(CMAKE_CXX_COMPILER \${tools}/bin/mips-mti-linux-gnu-g++)
299
- set(CMAKE_CXX_FLAGS "${MIPS_FLAGS} -L${SYSROOT_DIR}/usr/lib64")
300
-
301
- # R2
302
- #set(CMAKE_C_COMPILER \${tools}/bin/mips-img-linux-gnu-gcc)
303
- #set(CMAKE_C_FLAGS "${MIPS_FLAGS}")
304
- #set(CMAKE_CXX_COMPILER \${tools}/bin/mips-img-linux-gnu-g++)
305
- #set(CMAKE_CXX_FLAGS "${MIPS_FLAGS}")
306
-
307
- set(CMAKE_FIND_ROOT_PATH ${GCC_DIR})
308
- set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
309
- set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
310
- set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
311
- set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
312
- EOL
313
-
314
- CMAKE_ADDITIONAL_ARGS+=( -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" )
315
- QEMU_ARGS+=( -L "${SYSROOT_DIR}/${FLAVOUR}" )
316
- local -r LIBC_DIR=${GCC_DIR}/mips-mti-linux-gnu/lib/${FLAVOUR}/${LIBC_DIR_SUFFIX}
317
- #local -r LIBC_DIR=${GCC_DIR}/mips-img-linux-gnu/lib/${FLAVOUR}/${LIBC_DIR_SUFFIX}
318
- QEMU_ARGS+=( -E LD_PRELOAD="${LIBC_DIR}/libstdc++.so.6:${LIBC_DIR}/libgcc_s.so.1" )
319
- }
320
-
321
- function build() {
322
- cd "${PROJECT_DIR}" || exit 2
323
- set -x
324
- clean_build
325
- cmake -S. -B"${BUILD_DIR}" "${CMAKE_DEFAULT_ARGS[@]}" "${CMAKE_ADDITIONAL_ARGS[@]}"
326
- cmake --build "${BUILD_DIR}" --target all -j8 -v
327
- set +x
328
- }
329
-
330
- function run_test() {
331
- assert_defined QEMU_ARCH
332
- if [[ "${QEMU_ARCH}" == "DISABLED" ]]; then
333
- >&2 echo "QEMU is disabled for ${TARGET}"
334
- return
335
- fi
336
- install_qemu
337
- RUN_CMD="${QEMU_INSTALL}/bin/qemu-${QEMU_ARCH} ${QEMU_ARGS[*]}"
338
-
339
- cd "${BUILD_DIR}" || exit 2
340
- declare -a TEST_BINARIES=()
341
- TEST_BINARIES+=($(find "${BUILD_DIR}"/test -executable -type f))
342
- TEST_BINARIES+=($(find "${BUILD_DIR}" -maxdepth 1 -executable -type f))
343
- set -x
344
- set -e
345
- for test_binary in ${TEST_BINARIES[*]} ; do
346
- ${RUN_CMD} "${test_binary}"
347
- done
348
- set +e
349
- set +x
350
- }
351
-
352
- function usage() {
353
- local -r NAME=$(basename "$0")
354
- echo -e "$NAME - Build using a cross toolchain.
355
-
356
- SYNOPSIS
357
- \t$NAME [-h|--help] [toolchain|build|qemu|test|all]
358
-
359
- DESCRIPTION
360
- \tCross compile using a cross toolchain.
361
-
362
- \tYou MUST define the following variables before running this script:
363
- \t* TARGET:
364
- \t\tx86_64
365
- \t\taarch64 aarch64be (bootlin)
366
- \t\taarch64-linux-gnu aarch64_be-linux-gnu (linaro)
367
- \t\tarm-linux-gnueabihf armv8l-linux-gnueabihf arm-linux-gnueabi (linaro)
368
- \t\tarmeb-linux-gnueabihf armeb-linux-gnueabi (linaro)
369
- \t\tmips32 mips32el (codespace)
370
- \t\tmips64 mips64el (codespace)
371
- \t\tppc (bootlin)
372
- \t\tppc64 ppc64le (bootlin)
373
- \t\triscv32 riscv64 (bootlin)
374
- \t\ts390x (bootlin)
375
-
376
- OPTIONS
377
- \t-h --help: show this help text
378
- \ttoolchain: download, unpack toolchain and generate CMake toolchain file
379
- \tbuild: toolchain + build the project using the toolchain file (note: remove previous build dir)
380
- \tqemu: download, unpack and build qemu
381
- \ttest: qemu + run all executable using qemu (note: don't build !)
382
- \tall: build + test (default)
383
-
384
- EXAMPLES
385
- * Using export:
386
- export TARGET=aarch64-linux-gnu
387
- $0
388
-
389
- * One-liner:
390
- TARGET=aarch64-linux-gnu $0"
391
- }
392
-
393
- # Main
394
- function main() {
395
- case ${1} in
396
- -h | --help)
397
- usage; exit ;;
398
- esac
399
-
400
- assert_defined TARGET
401
-
402
- declare -r PROJECT_DIR="$(cd -P -- "$(dirname -- "$0")/.." && pwd -P)"
403
- declare -r ARCHIVE_DIR="${PROJECT_DIR}/build_cross/archives"
404
- declare -r BUILD_DIR="${PROJECT_DIR}/build_cross/${TARGET}"
405
- declare -r TOOLCHAIN_FILE=${ARCHIVE_DIR}/toolchain_${TARGET}.cmake
406
-
407
- echo "Target: '${TARGET}'"
408
-
409
- echo "Project dir: '${PROJECT_DIR}'"
410
- echo "Archive dir: '${ARCHIVE_DIR}'"
411
- echo "Build dir: '${BUILD_DIR}'"
412
- echo "toolchain file: '${TOOLCHAIN_FILE}'"
413
-
414
- declare -a CMAKE_DEFAULT_ARGS=( -G ${CMAKE_GENERATOR:-"Ninja"} )
415
- declare -a CMAKE_ADDITIONAL_ARGS=()
416
-
417
- declare -a QEMU_ARGS=()
418
- case ${TARGET} in
419
- x86_64)
420
- declare -r QEMU_ARCH=x86_64 ;;
421
- arm-linux-gnueabihf | armv8l-linux-gnueabihf | arm-linux-gnueabi)
422
- expand_linaro_config
423
- declare -r QEMU_ARCH=arm ;;
424
- armeb-linux-gnueabihf | armeb-linux-gnueabi)
425
- expand_linaro_config
426
- declare -r QEMU_ARCH=DISABLED ;;
427
- aarch64-linux-gnu)
428
- expand_linaro_config
429
- declare -r QEMU_ARCH=aarch64 ;;
430
- aarch64_be-linux-gnu)
431
- expand_linaro_config
432
- declare -r QEMU_ARCH=aarch64_be ;;
433
- aarch64)
434
- expand_bootlin_config
435
- declare -r QEMU_ARCH=aarch64 ;;
436
- aarch64be)
437
- expand_bootlin_config
438
- declare -r QEMU_ARCH=aarch64_be ;;
439
- mips32)
440
- expand_codescape_config
441
- declare -r QEMU_ARCH=mips ;;
442
- mips32el)
443
- expand_codescape_config
444
- declare -r QEMU_ARCH=mipsel ;;
445
- mips64)
446
- expand_codescape_config
447
- declare -r QEMU_ARCH=mips64 ;;
448
- mips64el)
449
- expand_codescape_config
450
- declare -r QEMU_ARCH=mips64el ;;
451
- ppc64le)
452
- expand_bootlin_config
453
- declare -r QEMU_ARCH=ppc64le ;;
454
- ppc64)
455
- expand_bootlin_config
456
- declare -r QEMU_ARCH=ppc64 ;;
457
- ppc)
458
- expand_bootlin_config
459
- declare -r QEMU_ARCH=ppc ;;
460
- riscv32)
461
- expand_bootlin_config
462
- declare -r QEMU_ARCH=riscv32 ;;
463
- riscv64)
464
- expand_bootlin_config
465
- declare -r QEMU_ARCH=riscv64 ;;
466
- s390x)
467
- expand_bootlin_config
468
- declare -r QEMU_ARCH=s390x ;;
469
- *)
470
- >&2 echo "Unknown TARGET '${TARGET}'..."
471
- exit 1 ;;
472
- esac
473
- declare -r QEMU_INSTALL=${ARCHIVE_DIR}/qemu-${QEMU_ARCH}
474
-
475
- case ${1} in
476
- toolchain)
477
- exit ;;
478
- build)
479
- build ;;
480
- qemu)
481
- install_qemu ;;
482
- test)
483
- run_test ;;
484
- *)
485
- build
486
- run_test ;;
487
- esac
488
- }
489
-
490
- main "${1:-all}"
@@ -1,79 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # Toolchains for little-endian, 64-bit ARMv8 for GNU/Linux systems
4
- function set_aarch64-linux-gnu() {
5
- export TARGET=aarch64-linux-gnu
6
- }
7
-
8
- # Toolchains for little-endian, hard-float, 32-bit ARMv7 (and earlier) for GNU/Linux systems
9
- function set_arm-linux-gnueabihf() {
10
- export TARGET=arm-linux-gnueabihf
11
- }
12
-
13
- # Toolchains for little-endian, 32-bit ARMv8 for GNU/Linux systems
14
- function set_armv8l-linux-gnueabihf() {
15
- export TARGET=armv8l-linux-gnueabihf
16
- }
17
-
18
- # Toolchains for little-endian, soft-float, 32-bit ARMv7 (and earlier) for GNU/Linux systems
19
- function set_arm-linux-gnueabi() {
20
- export TARGET=arm-linux-gnueabi
21
- }
22
-
23
- # Toolchains for big-endian, 64-bit ARMv8 for GNU/Linux systems
24
- function set_aarch64_be-linux-gnu() {
25
- export TARGET=aarch64_be-linux-gnu
26
- }
27
-
28
- # Toolchains for big-endian, hard-float, 32-bit ARMv7 (and earlier) for GNU/Linux systems
29
- function set_armeb-linux-gnueabihf() {
30
- export TARGET=armeb-linux-gnueabihf
31
- }
32
-
33
- # Toolchains for big-endian, soft-float, 32-bit ARMv7 (and earlier) for GNU/Linux systems
34
- function set_armeb-linux-gnueabi() {
35
- export TARGET=armeb-linux-gnueabi
36
- }
37
-
38
- function set_mips32() {
39
- export TARGET=mips32
40
- }
41
-
42
- function set_mips32el() {
43
- export TARGET=mips32el
44
- }
45
-
46
- function set_mips64() {
47
- export TARGET=mips64
48
- }
49
-
50
- function set_mips64el() {
51
- export TARGET=mips64el
52
- }
53
-
54
- function set_x86_64() {
55
- export TARGET=x86_64
56
- }
57
-
58
- ENVIRONMENTS="
59
- set_aarch64-linux-gnu
60
- set_arm-linux-gnueabihf
61
- set_armv8l-linux-gnueabihf
62
- set_arm-linux-gnueabi
63
- set_aarch64_be-linux-gnu
64
- set_armeb-linux-gnueabihf
65
- set_armeb-linux-gnueabi
66
- set_mips32
67
- set_mips32el
68
- set_mips64
69
- set_mips64el
70
- set_x86_64
71
- "
72
-
73
- set -e
74
-
75
- for SET_ENVIRONMENT in ${ENVIRONMENTS}; do
76
- echo "testing ${SET_ENVIRONMENT}"
77
- ${SET_ENVIRONMENT}
78
- ./"$(dirname -- "$0")"/run_integration.sh
79
- done
@@ -1,19 +0,0 @@
1
- // Copyright 2021 Google LLC
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- #include <stddef.h>
16
-
17
- static void copy(char *__restrict dst, const char *src, size_t count) {
18
- for (size_t i = 0; i < count; ++i) dst[i] = src[i];
19
- }