Merge pull request #95 from abeimler/feature/arch-linux

This commit is contained in:
Amin Yahyaabadi 2022-06-29 21:14:19 -07:00 committed by GitHub
commit a4796aaa60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 396 additions and 66 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
.parcel-cache/
node_modules/
dev/docker/
dev/container-tests/

View File

@ -84,12 +84,14 @@ jobs:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip docker]') }} if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip docker]') }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false
matrix: matrix:
os: os:
- ubuntu-20.04 - ubuntu-20.04
container: container:
- "ubuntu_node.dockerfile" - "ubuntu_node.dockerfile"
- "ubuntu_20.04_node.dockerfile" - "ubuntu_20.04_node.dockerfile"
- "arch_node.dockerfile"
node: node:
- 14 - 14
pnpm: pnpm:

View File

@ -9,3 +9,5 @@ pnpm install
Before running the tests locally, backup your environment variables because faulty code might corrupt the environment. Before running the tests locally, backup your environment variables because faulty code might corrupt the environment.
<https://stackoverflow.com/a/5147185/7910299> <https://stackoverflow.com/a/5147185/7910299>
Install [container-structure-test](https://github.com/GoogleContainerTools/container-structure-test) for docker testing.

View File

@ -45,6 +45,8 @@ words:
- msys - msys
- multilib - multilib
- mxschmitt - mxschmitt
- noconfirm
- noprogressbar
- nothrow - nothrow
- npmrc - npmrc
- Opencppcoverage - Opencppcoverage
@ -54,6 +56,7 @@ words:
- pypy - pypy
- setupcpp - setupcpp
- setx - setx
- Syuu
- terserrc - terserrc
- tsbuildinfo - tsbuildinfo
- ucrt - ucrt

View File

@ -0,0 +1,44 @@
schemaVersion: 2.0.0
commandTests:
- name: gcc compiler
command: gcc
args: ["--version"]
expectedOutput: [".*gcc.*GCC.*"]
- name: g++ compiler
command: g++
args: ["--version"]
expectedOutput: [".*g\\+\\+.*GCC.*"]
- name: cmake
command: cmake
args: ["--version"]
expectedOutput: [".*cmake version.*"]
- name: make
command: make
args: ["--version"]
expectedOutput: [".*GNU Make.*"]
- name: ninja
command: ninja
args: ["--version"]
expectedOutput: [".*1.*"]
- name: gcovr
command: gcovr
args: ["--version"]
expectedOutput: [".*gcovr.*"]
- name: ccache
command: ccache
args: ["--version"]
expectedOutput: [".*ccache.*"]
- name: doxygen
command: doxygen
args: ["--version"]
expectedOutput: [".*1.*"]
- name: cppcheck
command: cppcheck
args: ["--version"]
expectedOutput: [".*Cppcheck.*"]
fileExistenceTests:
- name: "vcpkg"
path: "/root/vcpkg"
shouldExist: true

View File

@ -0,0 +1,47 @@
schemaVersion: 2.0.0
commandTests:
- name: gcc compiler
command: gcc
args: ["--version"]
expectedOutput: [".*gcc.*"]
- name: g++ compiler
command: g++
args: ["--version"]
expectedOutput: [".*g\\+\\+.*"]
- name: make
command: make
args: ["--version"]
expectedOutput: [".*GNU Make.*"]
- name: ninja
command: /root/ninja/ninja
args: ["--version"]
expectedOutput: [".*1.*"]
- name: gcovr
command: gcovr
args: ["--version"]
expectedOutput: [".*gcovr.*"]
- name: ccache
command: ccache
args: ["--version"]
expectedOutput: [".*ccache.*"]
- name: doxygen
command: doxygen
args: ["--version"]
expectedOutput: [".*1.*"]
- name: cppcheck
command: cppcheck
args: ["--version"]
expectedOutput: [".*Cppcheck.*"]
- name: clang
command: /root/llvm/bin/clang
args: ["--version"]
expectedOutput: [".*clang.*"]
fileExistenceTests:
- name: "vcpkg"
path: "/root/vcpkg"
shouldExist: true
- name: "llvm"
path: "/root/llvm"
shouldExist: true

View File

@ -0,0 +1,48 @@
## base image
FROM archlinux as base
RUN pacman -Syuu --noconfirm
# Install packages available from standard repos
RUN pacman-db-upgrade && \
pacman -S --noconfirm --needed \
wget curl pkg-config zip unzip tar git && \
pacman -S --noconfirm \
nodejs && \
pacman -Scc --noconfirm
# install yay
#RUN useradd -m -G nobody -s /bin/bash yay && passwd -d yay && echo "yay ALL=(ALL) ALL" >> /etc/sudoers
#RUN git clone --depth 1 https://aur.archlinux.org/yay.git /opt/yay && cd /opt/yay && \
# chown -R yay:root . && chmod -R 775 . && \
# runuser -l yay -c "cd /opt/yay && makepkg -si --noprogressbar --noconfirm"
# add setup_cpp.js
COPY "./dist/" "/"
WORKDIR "/"
# run installation
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
# clean up
RUN pacman -Scc --noconfirm
#RUN rm -rf /home/yay/.cache/*
RUN rm -rf /tmp/*
CMD source ~/.cpprc
ENTRYPOINT [ "/bin/bash" ]
#### Building
FROM base AS builder
COPY ./dev/cpp_vcpkg_project /home/app
WORKDIR /home/app
RUN bash -c 'source ~/.cpprc \
&& task build'
### Running environment
# use a distroless image or ubuntu:22.04 if you wish
FROM gcr.io/distroless/cc
# copy the built binaries and their runtime dependencies
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
WORKDIR /home/app/
ENTRYPOINT ["./my_exe"]

View File

@ -4,18 +4,22 @@ RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends nodejs RUN apt-get install -y --no-install-recommends nodejs
# add setup_cpp.js # add setup_cpp.js
ADD "./dist/" "/" COPY "./dist/" "/"
WORKDIR "/" WORKDIR "/"
# run installation # run installation
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
# clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN rm -rf /tmp/*
CMD source ~/.cpprc CMD source ~/.cpprc
ENTRYPOINT [ "/bin/bash" ] ENTRYPOINT [ "/bin/bash" ]
#### Building #### Building
FROM base AS builder FROM base AS builder
ADD ./dev/cpp_vcpkg_project /home/app COPY ./dev/cpp_vcpkg_project /home/app
WORKDIR /home/app WORKDIR /home/app
RUN bash -c 'source ~/.cpprc \ RUN bash -c 'source ~/.cpprc \
&& task build' && task build'

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,6 +14,8 @@
"scripts": { "scripts": {
"build": "shx rm -rf dist/ && shx mkdir ./dist && run-p test.tsc build.parcel copy.matchers", "build": "shx rm -rf dist/ && shx mkdir ./dist && run-p test.tsc build.parcel copy.matchers",
"build.docker": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup_cpp .", "build.docker": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup_cpp .",
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup_cpp:arch .",
"build.docker.ubuntu": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup_cpp:ubuntu .",
"build.parcel": "cross-env NODE_ENV=production parcel build --detailed-report", "build.parcel": "cross-env NODE_ENV=production parcel build --detailed-report",
"bump": "ncu -u -x execa,numerous && pnpm update", "bump": "ncu -u -x execa,numerous && pnpm update",
"clean": "shx rm -rf .parcel-cache dist exe", "clean": "shx rm -rf .parcel-cache dist exe",
@ -24,8 +26,12 @@
"pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && node ./dev/scripts/pack-exe.js", "pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && node ./dev/scripts/pack-exe.js",
"prepare": "npm run build", "prepare": "npm run build",
"start.docker": "docker run -t setup_cpp .", "start.docker": "docker run -t setup_cpp .",
"start.docker.arch": "docker run -t setup_cpp:arch .",
"start.docker.ubuntu": "docker run -t setup_cpp:ubuntu .",
"test": "run-p test.format test.lint test.cspell test.tsc test.unit", "test": "run-p test.format test.lint test.cspell test.tsc test.unit",
"test.cspell": "cspell lint --no-progress --show-suggestions", "test.cspell": "cspell lint --no-progress --show-suggestions",
"test.docker.arch": "docker build -f ./dev/docker/arch_node.dockerfile --target base -t setup_cpp:arch-base . && container-structure-test test --image setup_cpp:arch-base --config ./dev/container-tests/arch.yml",
"test.docker.ubuntu": "docker build -f ./dev/docker/ubuntu_node.dockerfile --target base -t setup_cpp:ubuntu-base . && container-structure-test test --image setup_cpp:ubuntu-base --config ./dev/container-tests/ubuntu.yml",
"test.format": "prettier . --check", "test.format": "prettier . --check",
"test.lint": "eslint .", "test.lint": "eslint .",
"test.tsc": "tsc --noEmit | loose-ts-check", "test.tsc": "tsc --noEmit | loose-ts-check",

View File

@ -1,4 +1,4 @@
lockfileVersion: 5.3 lockfileVersion: 5.4
overrides: overrides:
semver: 7.3.7 semver: 7.3.7
@ -87,7 +87,7 @@ devDependencies:
prettier-config-atomic: 3.0.10 prettier-config-atomic: 3.0.10
shx: 0.3.4 shx: 0.3.4
terser-config-atomic: 0.1.1 terser-config-atomic: 0.1.1
ts-jest: 28.0.5_jest@28.1.1+typescript@4.7.4 ts-jest: 28.0.5_zv2ltmnvcc5apkdaecods742je
typescript: 4.7.4 typescript: 4.7.4
packages: packages:
@ -321,7 +321,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@babel/eslint-parser/7.18.2_@babel+core@7.18.5+eslint@8.18.0: /@babel/eslint-parser/7.18.2_cz6e4qppzra6gosrrzcvbsxiom:
resolution: {integrity: sha512-oFQYkE8SuH14+uR51JVAmdqwKYXGRjEXx7s+WiagVjqQ+HPE+nnwyF2qlVG8evUsUHmPcA+6YXMEDbIhEyQc5A==} resolution: {integrity: sha512-oFQYkE8SuH14+uR51JVAmdqwKYXGRjEXx7s+WiagVjqQ+HPE+nnwyF2qlVG8evUsUHmPcA+6YXMEDbIhEyQc5A==}
engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0} engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0}
peerDependencies: peerDependencies:
@ -2360,7 +2360,7 @@ packages:
'@types/yargs-parser': 21.0.0 '@types/yargs-parser': 21.0.0
dev: true dev: true
/@typescript-eslint/eslint-plugin/5.29.0_841815610045eaf78ed2b3f13a174733: /@typescript-eslint/eslint-plugin/5.29.0_qqmbkyiaixvppdwswpytuf2hgm:
resolution: {integrity: sha512-kgTsISt9pM53yRFQmLZ4npj99yGl3x3Pl7z4eA66OuTzAGC4bQB5H5fuLwPnqTKU3yyrrg4MIhjF17UYnL4c0w==} resolution: {integrity: sha512-kgTsISt9pM53yRFQmLZ4npj99yGl3x3Pl7z4eA66OuTzAGC4bQB5H5fuLwPnqTKU3yyrrg4MIhjF17UYnL4c0w==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -2371,10 +2371,10 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.29.0_eslint@8.18.0+typescript@4.7.4 '@typescript-eslint/parser': 5.29.0_b5e7v2qnwxfo6hmiq56u52mz3e
'@typescript-eslint/scope-manager': 5.29.0 '@typescript-eslint/scope-manager': 5.29.0
'@typescript-eslint/type-utils': 5.29.0_eslint@8.18.0+typescript@4.7.4 '@typescript-eslint/type-utils': 5.29.0_b5e7v2qnwxfo6hmiq56u52mz3e
'@typescript-eslint/utils': 5.29.0_eslint@8.18.0+typescript@4.7.4 '@typescript-eslint/utils': 5.29.0_b5e7v2qnwxfo6hmiq56u52mz3e
debug: 4.3.4 debug: 4.3.4
eslint: 8.18.0 eslint: 8.18.0
functional-red-black-tree: 1.0.1 functional-red-black-tree: 1.0.1
@ -2387,7 +2387,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/parser/5.29.0_eslint@8.18.0+typescript@4.7.4: /@typescript-eslint/parser/5.29.0_b5e7v2qnwxfo6hmiq56u52mz3e:
resolution: {integrity: sha512-ruKWTv+x0OOxbzIw9nW5oWlUopvP/IQDjB5ZqmTglLIoDTctLlAJpAQFpNPJP/ZI7hTT9sARBosEfaKbcFuECw==} resolution: {integrity: sha512-ruKWTv+x0OOxbzIw9nW5oWlUopvP/IQDjB5ZqmTglLIoDTctLlAJpAQFpNPJP/ZI7hTT9sARBosEfaKbcFuECw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -2415,7 +2415,7 @@ packages:
'@typescript-eslint/visitor-keys': 5.29.0 '@typescript-eslint/visitor-keys': 5.29.0
dev: true dev: true
/@typescript-eslint/type-utils/5.29.0_eslint@8.18.0+typescript@4.7.4: /@typescript-eslint/type-utils/5.29.0_b5e7v2qnwxfo6hmiq56u52mz3e:
resolution: {integrity: sha512-JK6bAaaiJozbox3K220VRfCzLa9n0ib/J+FHIwnaV3Enw/TO267qe0pM1b1QrrEuy6xun374XEAsRlA86JJnyg==} resolution: {integrity: sha512-JK6bAaaiJozbox3K220VRfCzLa9n0ib/J+FHIwnaV3Enw/TO267qe0pM1b1QrrEuy6xun374XEAsRlA86JJnyg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -2425,7 +2425,7 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/utils': 5.29.0_eslint@8.18.0+typescript@4.7.4 '@typescript-eslint/utils': 5.29.0_b5e7v2qnwxfo6hmiq56u52mz3e
debug: 4.3.4 debug: 4.3.4
eslint: 8.18.0 eslint: 8.18.0
tsutils: 3.21.0_typescript@4.7.4 tsutils: 3.21.0_typescript@4.7.4
@ -2460,7 +2460,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/utils/5.29.0_eslint@8.18.0+typescript@4.7.4: /@typescript-eslint/utils/5.29.0_b5e7v2qnwxfo6hmiq56u52mz3e:
resolution: {integrity: sha512-3Eos6uP1nyLOBayc/VUdKZikV90HahXE5Dx9L5YlSd/7ylQPXhLk1BYb29SDgnBnTp+jmSZUU0QxUiyHgW4p7A==} resolution: {integrity: sha512-3Eos6uP1nyLOBayc/VUdKZikV90HahXE5Dx9L5YlSd/7ylQPXhLk1BYb29SDgnBnTp+jmSZUU0QxUiyHgW4p7A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -3764,7 +3764,7 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/eslint-config-airbnb-base/14.2.1_9462c2f560e8d8d9149a63cde905d125: /eslint-config-airbnb-base/14.2.1_srrmf5la5dmnsfe2mpg6sboreu:
resolution: {integrity: sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==} resolution: {integrity: sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
peerDependencies: peerDependencies:
@ -3773,13 +3773,13 @@ packages:
dependencies: dependencies:
confusing-browser-globals: 1.0.11 confusing-browser-globals: 1.0.11
eslint: 8.18.0 eslint: 8.18.0
eslint-plugin-import: 2.26.0_c98dd95c676de54ce87ba8db61cd826d eslint-plugin-import: 2.26.0_zgg5sxdhnxsuz2d3vdnwdtmcnu
object.assign: 4.1.2 object.assign: 4.1.2
object.entries: 1.1.5 object.entries: 1.1.5
dev: true dev: true
optional: true optional: true
/eslint-config-airbnb/18.2.1_5cd494cb9c5361701be934d5d6e756ed: /eslint-config-airbnb/18.2.1_ltkjjs44knqxag7jgtk5nz2w5u:
resolution: {integrity: sha512-glZNDEZ36VdlZWoxn/bUR1r/sdFKPd1mHPbqUtkctgNG4yT2DLLtJ3D+yCV+jzZCc2V1nBVkmdknOJBZ5Hc0fg==} resolution: {integrity: sha512-glZNDEZ36VdlZWoxn/bUR1r/sdFKPd1mHPbqUtkctgNG4yT2DLLtJ3D+yCV+jzZCc2V1nBVkmdknOJBZ5Hc0fg==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
peerDependencies: peerDependencies:
@ -3790,8 +3790,8 @@ packages:
eslint-plugin-react-hooks: ^4 || ^3 || ^2.3.0 || ^1.7.0 eslint-plugin-react-hooks: ^4 || ^3 || ^2.3.0 || ^1.7.0
dependencies: dependencies:
eslint: 8.18.0 eslint: 8.18.0
eslint-config-airbnb-base: 14.2.1_9462c2f560e8d8d9149a63cde905d125 eslint-config-airbnb-base: 14.2.1_srrmf5la5dmnsfe2mpg6sboreu
eslint-plugin-import: 2.26.0_c98dd95c676de54ce87ba8db61cd826d eslint-plugin-import: 2.26.0_zgg5sxdhnxsuz2d3vdnwdtmcnu
eslint-plugin-jsx-a11y: 6.6.0_eslint@8.18.0 eslint-plugin-jsx-a11y: 6.6.0_eslint@8.18.0
eslint-plugin-react: 7.23.2_eslint@8.18.0 eslint-plugin-react: 7.23.2_eslint@8.18.0
eslint-plugin-react-hooks: 4.6.0_eslint@8.18.0 eslint-plugin-react-hooks: 4.6.0_eslint@8.18.0
@ -3804,15 +3804,15 @@ packages:
resolution: {integrity: sha512-wS/1xK1detB18BYj3EFOFjpxp9H01kQNKJbO6tgGDycHYgurZyHKh+kU+o0zRoZMqwXw4hmFimTN0EvVerBX1w==} resolution: {integrity: sha512-wS/1xK1detB18BYj3EFOFjpxp9H01kQNKJbO6tgGDycHYgurZyHKh+kU+o0zRoZMqwXw4hmFimTN0EvVerBX1w==}
dependencies: dependencies:
'@babel/core': 7.18.5 '@babel/core': 7.18.5
'@babel/eslint-parser': 7.18.2_@babel+core@7.18.5+eslint@8.18.0 '@babel/eslint-parser': 7.18.2_cz6e4qppzra6gosrrzcvbsxiom
'@babel/plugin-syntax-flow': 7.17.12_@babel+core@7.18.5 '@babel/plugin-syntax-flow': 7.17.12_@babel+core@7.18.5
'@babel/plugin-syntax-jsx': 7.17.12_@babel+core@7.18.5 '@babel/plugin-syntax-jsx': 7.17.12_@babel+core@7.18.5
'@typescript-eslint/eslint-plugin': 5.29.0_841815610045eaf78ed2b3f13a174733 '@typescript-eslint/eslint-plugin': 5.29.0_qqmbkyiaixvppdwswpytuf2hgm
'@typescript-eslint/parser': 5.29.0_eslint@8.18.0+typescript@4.7.4 '@typescript-eslint/parser': 5.29.0_b5e7v2qnwxfo6hmiq56u52mz3e
eslint: 8.18.0 eslint: 8.18.0
eslint-config-prettier: 8.5.0_eslint@8.18.0 eslint-config-prettier: 8.5.0_eslint@8.18.0
eslint-plugin-html: 6.2.0 eslint-plugin-html: 6.2.0
eslint-plugin-import: 2.26.0_c98dd95c676de54ce87ba8db61cd826d eslint-plugin-import: 2.26.0_zgg5sxdhnxsuz2d3vdnwdtmcnu
eslint-plugin-json: 3.1.0 eslint-plugin-json: 3.1.0
eslint-plugin-node: 11.1.0_eslint@8.18.0 eslint-plugin-node: 11.1.0_eslint@8.18.0
eslint-plugin-only-warn: /@aminya/eslint-plugin-only-warn/1.2.2 eslint-plugin-only-warn: /@aminya/eslint-plugin-only-warn/1.2.2
@ -3825,7 +3825,7 @@ packages:
typescript: 4.7.4 typescript: 4.7.4
optionalDependencies: optionalDependencies:
coffeescript: 1.12.7 coffeescript: 1.12.7
eslint-plugin-coffee: 0.1.15_71a5b804ebf7d01bcef72e514ee6421d eslint-plugin-coffee: 0.1.15_ogs3qbhl67ibxtxxfziu5zscdu
eslint-plugin-react-hooks: 4.6.0_eslint@8.18.0 eslint-plugin-react-hooks: 4.6.0_eslint@8.18.0
transitivePeerDependencies: transitivePeerDependencies:
- eslint-import-resolver-typescript - eslint-import-resolver-typescript
@ -3851,7 +3851,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/eslint-module-utils/2.7.3_997a240915676dc771d6b5349fa398d5: /eslint-module-utils/2.7.3_tf5cicivm5w4o4owwu2j7i4y2u:
resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==} resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==}
engines: {node: '>=4'} engines: {node: '>=4'}
peerDependencies: peerDependencies:
@ -3869,7 +3869,7 @@ packages:
eslint-import-resolver-webpack: eslint-import-resolver-webpack:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.29.0_eslint@8.18.0+typescript@4.7.4 '@typescript-eslint/parser': 5.29.0_b5e7v2qnwxfo6hmiq56u52mz3e
debug: 3.2.7 debug: 3.2.7
eslint-import-resolver-node: 0.3.6 eslint-import-resolver-node: 0.3.6
find-up: 2.1.0 find-up: 2.1.0
@ -3877,21 +3877,21 @@ packages:
- supports-color - supports-color
dev: true dev: true
/eslint-plugin-coffee/0.1.15_71a5b804ebf7d01bcef72e514ee6421d: /eslint-plugin-coffee/0.1.15_ogs3qbhl67ibxtxxfziu5zscdu:
resolution: {integrity: sha512-+qtkIPSc9etYqOODIlENqiRjID/oEoGMAAQJN988Aczy461NIwzaamFY6Fi0QDVVDb2v+OL/StVrk/QmyItfeg==} resolution: {integrity: sha512-+qtkIPSc9etYqOODIlENqiRjID/oEoGMAAQJN988Aczy461NIwzaamFY6Fi0QDVVDb2v+OL/StVrk/QmyItfeg==}
requiresBuild: true requiresBuild: true
peerDependencies: peerDependencies:
eslint: '*' eslint: '*'
dependencies: dependencies:
axe-core: 3.5.6 axe-core: 3.5.6
babel-eslint: /@babel/eslint-parser/7.18.2_@babel+core@7.18.5+eslint@8.18.0 babel-eslint: /@babel/eslint-parser/7.18.2_cz6e4qppzra6gosrrzcvbsxiom
babylon: 7.0.0-beta.47 babylon: 7.0.0-beta.47
coffeescript: 2.7.0 coffeescript: 2.7.0
doctrine: 2.1.0 doctrine: 2.1.0
eslint: 8.18.0 eslint: 8.18.0
eslint-config-airbnb: 18.2.1_5cd494cb9c5361701be934d5d6e756ed eslint-config-airbnb: 18.2.1_ltkjjs44knqxag7jgtk5nz2w5u
eslint-config-airbnb-base: 14.2.1_9462c2f560e8d8d9149a63cde905d125 eslint-config-airbnb-base: 14.2.1_srrmf5la5dmnsfe2mpg6sboreu
eslint-plugin-import: 2.26.0_c98dd95c676de54ce87ba8db61cd826d eslint-plugin-import: 2.26.0_zgg5sxdhnxsuz2d3vdnwdtmcnu
eslint-plugin-jsx-a11y: 6.6.0_eslint@8.18.0 eslint-plugin-jsx-a11y: 6.6.0_eslint@8.18.0
eslint-plugin-react: 7.23.2_eslint@8.18.0 eslint-plugin-react: 7.23.2_eslint@8.18.0
eslint-plugin-react-native: 3.11.0_eslint@8.18.0 eslint-plugin-react-native: 3.11.0_eslint@8.18.0
@ -3927,7 +3927,7 @@ packages:
htmlparser2: 7.2.0 htmlparser2: 7.2.0
dev: true dev: true
/eslint-plugin-import/2.26.0_c98dd95c676de54ce87ba8db61cd826d: /eslint-plugin-import/2.26.0_zgg5sxdhnxsuz2d3vdnwdtmcnu:
resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==} resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==}
engines: {node: '>=4'} engines: {node: '>=4'}
peerDependencies: peerDependencies:
@ -3937,14 +3937,14 @@ packages:
'@typescript-eslint/parser': '@typescript-eslint/parser':
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.29.0_eslint@8.18.0+typescript@4.7.4 '@typescript-eslint/parser': 5.29.0_b5e7v2qnwxfo6hmiq56u52mz3e
array-includes: 3.1.5 array-includes: 3.1.5
array.prototype.flat: 1.3.0 array.prototype.flat: 1.3.0
debug: 2.6.9 debug: 2.6.9
doctrine: 2.1.0 doctrine: 2.1.0
eslint: 8.18.0 eslint: 8.18.0
eslint-import-resolver-node: 0.3.6 eslint-import-resolver-node: 0.3.6
eslint-module-utils: 2.7.3_997a240915676dc771d6b5349fa398d5 eslint-module-utils: 2.7.3_tf5cicivm5w4o4owwu2j7i4y2u
has: 1.0.3 has: 1.0.3
is-core-module: 2.9.0 is-core-module: 2.9.0
is-glob: 4.0.3 is-glob: 4.0.3
@ -7730,7 +7730,7 @@ packages:
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
dev: false dev: false
/ts-jest/28.0.5_jest@28.1.1+typescript@4.7.4: /ts-jest/28.0.5_zv2ltmnvcc5apkdaecods742je:
resolution: {integrity: sha512-Sx9FyP9pCY7pUzQpy4FgRZf2bhHY3za576HMKJFs+OnQ9jS96Du5vNsDKkyedQkik+sEabbKAnCliv9BEsHZgQ==} resolution: {integrity: sha512-Sx9FyP9pCY7pUzQpy4FgRZf2bhHY3za576HMKJFs+OnQ9jS96Du5vNsDKkyedQkik+sEabbKAnCliv9BEsHZgQ==}
engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0} engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}
hasBin: true hasBin: true

View File

@ -1,6 +1,8 @@
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack" import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupCcache(version: string, _setupDir: string, _arch: string) { export function setupCcache(version: string, _setupDir: string, _arch: string) {
@ -12,6 +14,9 @@ export function setupCcache(version: string, _setupDir: string, _arch: string) {
return setupBrewPack("ccache", version) return setupBrewPack("ccache", version)
} }
case "linux": { case "linux": {
if (isArch()) {
return setupPacmanPack("ccache", version)
}
return setupAptPack("ccache", version) return setupAptPack("ccache", version)
} }
default: { default: {

View File

@ -1,7 +1,9 @@
import { addPath } from "../utils/env/addEnv" import { addPath } from "../utils/env/addEnv"
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack" import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupCppcheck(version: string | undefined, _setupDir: string, _arch: string) { export async function setupCppcheck(version: string | undefined, _setupDir: string, _arch: string) {
@ -15,6 +17,9 @@ export async function setupCppcheck(version: string | undefined, _setupDir: stri
return setupBrewPack("cppcheck", version) return setupBrewPack("cppcheck", version)
} }
case "linux": { case "linux": {
if (isArch()) {
return setupPacmanPack("cppcheck", version)
}
return setupAptPack("cppcheck", version) return setupAptPack("cppcheck", version)
} }
default: { default: {

View File

@ -1,4 +1,5 @@
import { Inputs, Opts } from "./main" import { Inputs, Opts } from "./main"
import { isArch } from "./utils/env/isArch"
// passing "" to a tool installed by a package manager (apt, brew, choco) will result in the default version of that package manager. // passing "" to a tool installed by a package manager (apt, brew, choco) will result in the default version of that package manager.
// the directly downloaded tools require a given version ("" doesn't work). // the directly downloaded tools require a given version ("" doesn't work).
@ -14,7 +15,7 @@ const DefaultVersions: Record<string, string> = {
meson: "0.62.2", // https://github.com/mesonbuild/meson/releases meson: "0.62.2", // https://github.com/mesonbuild/meson/releases
kcov: "40", // https://github.com/SimonKagstrom/kcov/releases kcov: "40", // https://github.com/SimonKagstrom/kcov/releases
task: "3.12.1", // https://github.com/go-task/task/releases task: "3.12.1", // https://github.com/go-task/task/releases
doxygen: "1.9.4", // https://www.doxygen.nl/download.html // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=doxygen // https://formulae.brew.sh/formula/doxygen doxygen: isArch() ? "1.9.3-1" : "1.9.4", // https://www.doxygen.nl/download.html // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=doxygen // https://formulae.brew.sh/formula/doxygen // https://archlinux.org/packages/extra/x86_64/doxygen/
gcc: "11", // https://github.com/brechtsanders/winlibs_mingw/releases and // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=gcc gcc: "11", // https://github.com/brechtsanders/winlibs_mingw/releases and // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=gcc
} }

View File

@ -1,5 +1,6 @@
import { addPath } from "../utils/env/addEnv" import { addPath } from "../utils/env/addEnv"
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin" import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
import { setupBrewPack } from "../utils/setup/setupBrewPack" import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
@ -10,6 +11,7 @@ import { setupGraphviz } from "../graphviz/graphviz"
import { getVersion } from "../default_versions" import { getVersion } from "../default_versions"
import { existsSync } from "fs" import { existsSync } from "fs"
import { join } from "path" import { join } from "path"
import { isArch } from "../utils/env/isArch"
/** Get the platform data for cmake */ /** Get the platform data for cmake */
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -57,16 +59,24 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
case "linux": { case "linux": {
let installationInfo: InstallationInfo let installationInfo: InstallationInfo
if (version === "") { if (version === "") {
installationInfo = setupAptPack("doxygen", undefined) if (isArch()) {
} else { installationInfo = setupPacmanPack("doxygen", undefined)
try { } else {
// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
setupAptPack("libclang-cpp9")
} catch (err) {
notice(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
installationInfo = setupAptPack("doxygen", undefined) installationInfo = setupAptPack("doxygen", undefined)
} }
} else {
if (isArch()) {
installationInfo = setupPacmanPack("doxygen", version)
} else {
try {
// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
setupAptPack("libclang-cpp9")
} catch (err) {
notice(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
installationInfo = setupAptPack("doxygen", undefined)
}
}
} }
await setupGraphviz(getVersion("graphviz", undefined), "", arch) await setupGraphviz(getVersion("graphviz", undefined), "", arch)
return installationInfo return installationInfo

View File

@ -1,6 +1,7 @@
import { addPath, addEnv } from "../utils/env/addEnv" import { addPath, addEnv } from "../utils/env/addEnv"
import { existsSync } from "fs" import { existsSync } from "fs"
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack" import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack" import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import semverMajor from "semver/functions/major" import semverMajor from "semver/functions/major"
@ -12,6 +13,8 @@ import { isGitHubCI } from "../utils/env/isci"
import { addBinExtension } from "../utils/extension/extension" import { addBinExtension } from "../utils/extension/extension"
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin" import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
import { extract7Zip } from "../utils/setup/extract" import { extract7Zip } from "../utils/setup/extract"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
interface MingwInfo { interface MingwInfo {
releaseName: string releaseName: string
@ -79,12 +82,19 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
} }
case "linux": { case "linux": {
if (arch === "x64") { if (arch === "x64") {
setupAptPack("gcc", version, ["ppa:ubuntu-toolchain-r/test"]) if (isArch()) {
installationInfo = setupAptPack("g++", version, []) installationInfo = setupPacmanPack("gcc", version)
} else {
setupAptPack("gcc", version, ["ppa:ubuntu-toolchain-r/test"])
installationInfo = setupAptPack("g++", version, [])
}
} else { } else {
info(`Install g++-multilib because gcc for ${arch} was requested`) info(`Install g++-multilib because gcc for ${arch} was requested`)
setupAptPack("gcc-multilib", version, ["ppa:ubuntu-toolchain-r/test"]) if (isArch()) {
installationInfo = setupAptPack("g++-multilib", version, []) setupPacmanPack("gcc-multilib", version)
} else {
setupAptPack("gcc-multilib", version, ["ppa:ubuntu-toolchain-r/test"])
}
} }
break break
} }
@ -150,7 +160,7 @@ async function activateGcc(version: string, binDir: string) {
if (majorVersion >= 5) { if (majorVersion >= 5) {
promises.push(addEnv("CC", `${binDir}/gcc-${majorVersion}`), addEnv("CXX", `${binDir}/g++-${majorVersion}`)) promises.push(addEnv("CC", `${binDir}/gcc-${majorVersion}`), addEnv("CXX", `${binDir}/g++-${majorVersion}`))
if (process.platform === "linux") { if (isUbuntu()) {
updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`) updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`)
updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`) updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`)
updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`) updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`)
@ -159,7 +169,7 @@ async function activateGcc(version: string, binDir: string) {
} else { } else {
promises.push(addEnv("CC", `${binDir}/gcc-${version}`), addEnv("CXX", `${binDir}/g++-${version}`)) promises.push(addEnv("CC", `${binDir}/gcc-${version}`), addEnv("CXX", `${binDir}/g++-${version}`))
if (process.platform === "linux") { if (isUbuntu()) {
updateAptAlternatives("cc", `${binDir}/gcc-${version}`) updateAptAlternatives("cc", `${binDir}/gcc-${version}`)
updateAptAlternatives("cxx", `${binDir}/g++-${version}`) updateAptAlternatives("cxx", `${binDir}/g++-${version}`)
updateAptAlternatives("gcc", `${binDir}/gcc-${version}`) updateAptAlternatives("gcc", `${binDir}/gcc-${version}`)

View File

@ -1,8 +1,10 @@
import { addPath } from "../utils/env/addEnv" import { addPath } from "../utils/env/addEnv"
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { InstallationInfo } from "../utils/setup/setupBin" import { InstallationInfo } from "../utils/setup/setupBin"
import { setupBrewPack } from "../utils/setup/setupBrewPack" import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupGraphviz(version: string, _setupDir: string, _arch: string) { export async function setupGraphviz(version: string, _setupDir: string, _arch: string) {
@ -15,6 +17,9 @@ export async function setupGraphviz(version: string, _setupDir: string, _arch: s
return setupBrewPack("graphviz", version) return setupBrewPack("graphviz", version)
} }
case "linux": { case "linux": {
if (isArch()) {
return setupPacmanPack("graphviz", version)
}
return setupAptPack("graphviz", version) return setupAptPack("graphviz", version)
} }
default: { default: {

View File

@ -8,7 +8,9 @@ import { execSudo } from "../utils/exec/sudo"
import { addBinExtension } from "../utils/extension/extension" import { addBinExtension } from "../utils/extension/extension"
import { extractTarByExe } from "../utils/setup/extract" import { extractTarByExe } from "../utils/setup/extract"
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { PackageInfo, setupBin } from "../utils/setup/setupBin" import { PackageInfo, setupBin } from "../utils/setup/setupBin"
import { isArch } from "../utils/env/isArch"
function getKcovPackageInfo(version: string): PackageInfo { function getKcovPackageInfo(version: string): PackageInfo {
const version_number = parseInt(version.replace(/^v/, ""), 10) const version_number = parseInt(version.replace(/^v/, ""), 10)
@ -42,8 +44,13 @@ async function buildKcov(file: string, dest: string) {
await setupCmake(getVersion("cmake", undefined), join(untildify(""), "cmake"), "") await setupCmake(getVersion("cmake", undefined), join(untildify(""), "cmake"), "")
} }
if (process.platform === "linux") { if (process.platform === "linux") {
setupAptPack("libdw-dev") if (isArch()) {
setupAptPack("libcurl4-openssl-dev") setupPacmanPack("libdwarf")
setupPacmanPack("libcurl-openssl")
} else {
setupAptPack("libdw-dev")
setupAptPack("libcurl4-openssl-dev")
}
} }
await execa("cmake", ["-S", "./", "-B", "./build"], { cwd: out, stdio: "inherit" }) await execa("cmake", ["-S", "./", "-B", "./build"], { cwd: out, stdio: "inherit" })
await execa("cmake", ["--build", "./build", "--config", "Release"], { cwd: out, stdio: "inherit" }) await execa("cmake", ["--build", "./build", "--config", "Release"], { cwd: out, stdio: "inherit" })
@ -54,6 +61,12 @@ async function buildKcov(file: string, dest: string) {
export async function setupKcov(version: string, setupDir: string, arch: string) { export async function setupKcov(version: string, setupDir: string, arch: string) {
switch (process.platform) { switch (process.platform) {
case "linux": { case "linux": {
if (isArch()) {
// TODO install kcov ? setupPacmanPack("kcov")
const installationInfo = await setupBin("kcov", version, getKcovPackageInfo, setupDir, arch)
setupPacmanPack("binutils")
return installationInfo
}
const installationInfo = await setupBin("kcov", version, getKcovPackageInfo, setupDir, arch) const installationInfo = await setupBin("kcov", version, getKcovPackageInfo, setupDir, arch)
setupAptPack("libbinutils") setupAptPack("libbinutils")
return installationInfo return installationInfo

View File

@ -20,6 +20,8 @@ import { existsSync } from "fs"
import { isGitHubCI } from "../utils/env/isci" import { isGitHubCI } from "../utils/env/isci"
import { setupGcc } from "../gcc/gcc" import { setupGcc } from "../gcc/gcc"
import { getVersion } from "../default_versions" import { getVersion } from "../default_versions"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
//================================================ //================================================
// Version // Version
@ -285,7 +287,12 @@ async function _setupLLVM(version: string, setupDir: string, arch: string) {
if (process.platform === "linux") { if (process.platform === "linux") {
// install llvm build dependencies // install llvm build dependencies
await setupGcc(getVersion("gcc", undefined), "", arch) // using llvm requires ld, an up to date libstdc++, etc. So, install gcc first await setupGcc(getVersion("gcc", undefined), "", arch) // using llvm requires ld, an up to date libstdc++, etc. So, install gcc first
setupAptPack("libtinfo-dev") if (isArch()) {
// setupPacmanPack("ncurses")
// TODO: install libtinfo ?
} else {
setupAptPack("libtinfo-dev")
}
} }
// eslint-disable-next-line require-atomic-updates // eslint-disable-next-line require-atomic-updates
didInit = true didInit = true
@ -333,7 +340,7 @@ export async function activateLLVM(directory: string, versionGiven: string) {
} }
} }
if (process.platform === "linux") { if (isUbuntu()) {
updateAptAlternatives("cc", `${directory}/bin/clang`) updateAptAlternatives("cc", `${directory}/bin/clang`)
updateAptAlternatives("cxx", `${directory}/bin/clang++`) updateAptAlternatives("cxx", `${directory}/bin/clang++`)
updateAptAlternatives("clang", `${directory}/bin/clang`) updateAptAlternatives("clang", `${directory}/bin/clang`)

View File

@ -1,7 +1,9 @@
import { addPath } from "../utils/env/addEnv" import { addPath } from "../utils/env/addEnv"
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack" import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupMake(version: string, _setupDir: string, _arch: string) { export async function setupMake(version: string, _setupDir: string, _arch: string) {
@ -15,6 +17,9 @@ export async function setupMake(version: string, _setupDir: string, _arch: strin
return { binDir: "/usr/local/opt/make/libexec/gnubin" } return { binDir: "/usr/local/opt/make/libexec/gnubin" }
} }
case "linux": { case "linux": {
if (isArch()) {
return setupPacmanPack("make", version)
}
return setupAptPack("make", version) return setupAptPack("make", version)
} }
default: { default: {

View File

@ -1,9 +1,11 @@
import { addPath } from "../utils/env/addEnv" import { addPath } from "../utils/env/addEnv"
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack" import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isGitHubCI } from "../utils/env/isci" import { isGitHubCI } from "../utils/env/isci"
import { warning, info } from "../utils/io/io" import { warning, info } from "../utils/io/io"
import { isArch } from "../utils/env/isArch"
export async function setupPython(version: string, setupDir: string, arch: string) { export async function setupPython(version: string, setupDir: string, arch: string) {
if (!isGitHubCI()) { if (!isGitHubCI()) {
@ -38,6 +40,11 @@ export async function setupPythonViaSystem(version: string, setupDir: string, _a
return setupBrewPack("python3", version) return setupBrewPack("python3", version)
} }
case "linux": { case "linux": {
if (isArch()) {
const installInfo = setupPacmanPack("python", version)
setupPacmanPack("python-pip")
return installInfo
}
const installInfo = setupAptPack("python3", version) const installInfo = setupAptPack("python3", version)
setupAptPack("python3-pip") setupAptPack("python3-pip")
return installInfo return installInfo

View File

@ -1,6 +1,8 @@
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack" import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupSevenZip(version: string, _setupDir: string, _arch: string) { export function setupSevenZip(version: string, _setupDir: string, _arch: string) {
@ -12,6 +14,9 @@ export function setupSevenZip(version: string, _setupDir: string, _arch: string)
return setupBrewPack("p7zip", version) return setupBrewPack("p7zip", version)
} }
case "linux": { case "linux": {
if (isArch()) {
return setupPacmanPack("p7zip", version)
}
return setupAptPack("p7zip-full", version) return setupAptPack("p7zip-full", version)
} }
default: { default: {

15
src/utils/env/isArch.ts vendored Normal file
View File

@ -0,0 +1,15 @@
import which from "which"
let isArchCache: undefined | boolean = undefined
export function isArch(): boolean {
if (process.platform !== "linux") {
return false
}
if (isArchCache === undefined) {
// detect arch by checking if pacman exists
isArchCache = which.sync("pacman", { nothrow: true }) !== null
}
return isArchCache
}

15
src/utils/env/isUbuntu.ts vendored Normal file
View File

@ -0,0 +1,15 @@
import which from "which"
let isUbuntuCache: undefined | boolean = undefined
export function isUbuntu(): boolean {
if (process.platform !== "linux") {
return false
}
if (isUbuntuCache === undefined) {
const apt = "apt-get"
isUbuntuCache = which.sync(apt, { nothrow: true }) !== null
}
return isUbuntuCache
}

View File

@ -1,7 +1,8 @@
import { getUbuntuVersion } from "ubuntu-version" import { getUbuntuVersion } from "ubuntu-version"
import { isUbuntu } from "./isUbuntu"
export async function ubuntuVersion(): Promise<number[] | null> { export async function ubuntuVersion(): Promise<number[] | null> {
if (process.platform === "linux") { if (isUbuntu()) {
const versionSplitted = await getUbuntuVersion() const versionSplitted = await getUbuntuVersion()
if (versionSplitted.length === 0) { if (versionSplitted.length === 0) {

View File

@ -6,6 +6,8 @@ import { existsSync } from "fs"
import { tmpdir } from "os" import { tmpdir } from "os"
import { isGitHubCI } from "../env/isci" import { isGitHubCI } from "../env/isci"
import { setupAptPack } from "./setupAptPack" import { setupAptPack } from "./setupAptPack"
import { setupPacmanPack } from "./setupPacmanPack"
import { isArch } from "../env/isArch"
/** A type that describes a package */ /** A type that describes a package */
export type PackageInfo = { export type PackageInfo = {
@ -88,9 +90,15 @@ export async function setupBin(
if (!didInit) { if (!didInit) {
if (process.platform === "linux") { if (process.platform === "linux") {
// extraction dependencies // extraction dependencies
setupAptPack("unzip") if (isArch()) {
setupAptPack("tar") setupPacmanPack("unzip")
setupAptPack("xz-utils") setupPacmanPack("tar")
setupPacmanPack("xz")
} else {
setupAptPack("unzip")
setupAptPack("tar")
setupAptPack("xz-utils")
}
} }
// eslint-disable-next-line require-atomic-updates // eslint-disable-next-line require-atomic-updates
didInit = true didInit = true

View File

@ -0,0 +1,41 @@
/* eslint-disable require-atomic-updates */
import { InstallationInfo } from "./setupBin"
import { execSudo } from "../exec/sudo"
import { info } from "../io/io"
let didUpdate: boolean = false
let didInit: boolean = false
/** A function that installs a package using pacman */
export function setupPacmanPack(name: string, version?: string, aur?: string): InstallationInfo {
info(`Installing ${name} ${version ?? ""} via pacman`)
const pacman = "pacman"
if (!didUpdate) {
execSudo(pacman, ["-Syuu", "--noconfirm"])
didUpdate = true
}
if (!didInit) {
// set time - zone
// TZ = Canada / Pacific
// ln - snf / usr / share / zoneinfo / $TZ / etc / localtime && echo $TZ > /etc/timezone
// install base-devel
execSudo(pacman, ["-Sy", "--noconfirm", "base-devel"])
didInit = true
}
if (version !== undefined && version !== "") {
try {
execSudo(aur ?? pacman, ["-S", "--noconfirm", `${name}=${version}`])
} catch {
execSudo(aur ?? pacman, ["-S", "--noconfirm", `${name}${version}`])
}
} else {
execSudo(aur ?? pacman, ["-S", "--noconfirm", name])
}
return { binDir: "/usr/bin/" }
}

View File

@ -10,6 +10,8 @@ import { join } from "path"
import { getVersion } from "../../default_versions" import { getVersion } from "../../default_versions"
import { InstallationInfo } from "./setupBin" import { InstallationInfo } from "./setupBin"
import { setupAptPack } from "./setupAptPack" import { setupAptPack } from "./setupAptPack"
import { setupPacmanPack } from "./setupPacmanPack"
import { isArch } from "../env/isArch"
let python: string | undefined let python: string | undefined
let binDir: string | undefined let binDir: string | undefined
@ -42,7 +44,11 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
execa.sync(python, ["-m", "pip", "install", "-U", "pip==21.3.1"], { stdio: "inherit" }) execa.sync(python, ["-m", "pip", "install", "-U", "pip==21.3.1"], { stdio: "inherit" })
} else if (process.platform === "linux") { } else if (process.platform === "linux") {
// ensure that pip is installed on Linux (happens when python is found but pip not installed) // ensure that pip is installed on Linux (happens when python is found but pip not installed)
setupAptPack("python3-pip") if (isArch()) {
setupPacmanPack("python-pip")
} else {
setupAptPack("python3-pip")
}
} }
// install wheel (required for Conan, Meson, etc.) // install wheel (required for Conan, Meson, etc.)

View File

@ -8,7 +8,9 @@ import { execSudo } from "../utils/exec/sudo"
import { addShellExtension, addShellHere } from "../utils/extension/extension" import { addShellExtension, addShellHere } from "../utils/extension/extension"
import { notice } from "../utils/io/io" import { notice } from "../utils/io/io"
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { InstallationInfo } from "../utils/setup/setupBin" import { InstallationInfo } from "../utils/setup/setupBin"
import { isArch } from "../utils/env/isArch"
let hasVCPKG = false let hasVCPKG = false
@ -17,12 +19,21 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) { if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) {
if (process.platform === "linux") { if (process.platform === "linux") {
// vcpkg download and extraction dependencies // vcpkg download and extraction dependencies
setupAptPack("curl") if (isArch()) {
setupAptPack("zip") setupPacmanPack("curl")
setupAptPack("unzip") setupPacmanPack("zip")
setupAptPack("tar") setupPacmanPack("unzip")
setupAptPack("git") setupPacmanPack("tar")
setupAptPack("pkg-config") setupPacmanPack("git")
setupPacmanPack("pkg-config")
} else {
setupAptPack("curl")
setupAptPack("zip")
setupAptPack("unzip")
setupAptPack("tar")
setupAptPack("git")
setupAptPack("pkg-config")
}
} }
if (!existsSync(join(setupDir, addShellExtension("bootstrap-vcpkg")))) { if (!existsSync(join(setupDir, addShellExtension("bootstrap-vcpkg")))) {