mirror of https://github.com/aminya/setup-cpp
Merge pull request #103 from abeimler/feature/cross-mingw
add mingw cross-compiler
This commit is contained in:
commit
14b5580a5f
|
@ -140,9 +140,12 @@ jobs:
|
||||||
pnpm:
|
pnpm:
|
||||||
- 8
|
- 8
|
||||||
container:
|
container:
|
||||||
- "arch.dockerfile"
|
|
||||||
- "fedora.dockerfile"
|
|
||||||
- "ubuntu.dockerfile"
|
- "ubuntu.dockerfile"
|
||||||
|
- "fedora.dockerfile"
|
||||||
|
- "arch.dockerfile"
|
||||||
|
- "ubuntu-mingw.dockerfile"
|
||||||
|
# - "fedora-mingw.dockerfile"
|
||||||
|
# - "arch-mingw.dockerfile"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -90,6 +90,9 @@ words:
|
||||||
- whatwg
|
- whatwg
|
||||||
- xcrun
|
- xcrun
|
||||||
- Yahyaabadi
|
- Yahyaabadi
|
||||||
|
- VCPKG
|
||||||
|
- DVCPKG
|
||||||
|
- SYSROOT
|
||||||
ignoreWords: []
|
ignoreWords: []
|
||||||
import: []
|
import: []
|
||||||
dictionaryDefinitions: []
|
dictionaryDefinitions: []
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
## base image
|
||||||
|
FROM archlinux:base-devel as setup-cpp-arch-mingw
|
||||||
|
|
||||||
|
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
|
||||||
|
|
||||||
|
# install git
|
||||||
|
RUN pacman -Syuu --noconfirm && \
|
||||||
|
pacman-db-upgrade && \
|
||||||
|
pacman -S --noconfirm --needed git
|
||||||
|
# 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
|
||||||
|
WORKDIR /opt/yay
|
||||||
|
RUN chown -R yay:root . && chmod -R 775 .
|
||||||
|
USER yay
|
||||||
|
WORKDIR /opt/yay
|
||||||
|
RUN makepkg -si --noprogressbar --noconfirm
|
||||||
|
## clean up
|
||||||
|
USER root
|
||||||
|
WORKDIR /
|
||||||
|
RUN rm -rf /opt/yay
|
||||||
|
|
||||||
|
RUN pacman -Syuu --noconfirm && \
|
||||||
|
pacman-db-upgrade && \
|
||||||
|
# install nodejs
|
||||||
|
pacman -S --noconfirm --needed nodejs npm && \
|
||||||
|
# install the compiler and tools
|
||||||
|
node /usr/lib/setup-cpp/setup-cpp.js \
|
||||||
|
--compiler mingw \
|
||||||
|
--cmake true \
|
||||||
|
--ninja true \
|
||||||
|
--task true \
|
||||||
|
--vcpkg true \
|
||||||
|
--python true \
|
||||||
|
--make true \
|
||||||
|
--cppcheck true \
|
||||||
|
--gcovr true \
|
||||||
|
--doxygen true \
|
||||||
|
--ccache true && \
|
||||||
|
# arch cleanup
|
||||||
|
pacman -Scc --noconfirm && \
|
||||||
|
rm -rf /var/cache/pacman/pkg/* && \
|
||||||
|
rm -rf /tmp/*
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
||||||
|
|
||||||
|
#### Cross Building (example)
|
||||||
|
FROM setup-cpp-arch-mingw AS builder-mingw
|
||||||
|
|
||||||
|
COPY ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task build_cross_mingw'
|
|
@ -0,0 +1,23 @@
|
||||||
|
schemaVersion: 2.0.0
|
||||||
|
|
||||||
|
commandTests:
|
||||||
|
- name: mingw c compiler
|
||||||
|
command: x86_64-w64-mingw32-gcc
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-gcc.*"]
|
||||||
|
- name: mingw c++ compiler
|
||||||
|
command: x86_64-w64-mingw32-g++
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-g\\+\\+*"]
|
||||||
|
- name: powershell
|
||||||
|
command: pwsh
|
||||||
|
args: ["-Version"]
|
||||||
|
expectedOutput: [".*PowerShell.*"]
|
||||||
|
|
||||||
|
fileExistenceTests:
|
||||||
|
- name: "vcpkg"
|
||||||
|
path: "/root/vcpkg"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "cross root"
|
||||||
|
path: "/usr/x86_64-w64-mingw32"
|
||||||
|
shouldExist: true
|
|
@ -1,18 +1,6 @@
|
||||||
schemaVersion: 2.0.0
|
schemaVersion: 2.0.0
|
||||||
|
|
||||||
commandTests:
|
commandTests:
|
||||||
- name: gcc compiler
|
|
||||||
command: gcc
|
|
||||||
args: ["--version"]
|
|
||||||
expectedOutput: [".*gcc.*GCC.*"]
|
|
||||||
- name: g++ compiler
|
|
||||||
command: g++
|
|
||||||
args: ["--version"]
|
|
||||||
expectedOutput: [".*g\\+\\+.*GCC.*"]
|
|
||||||
- name: make
|
|
||||||
command: make
|
|
||||||
args: ["--version"]
|
|
||||||
expectedOutput: [".*GNU Make.*"]
|
|
||||||
- name: ninja
|
- name: ninja
|
||||||
command: /root/ninja/ninja
|
command: /root/ninja/ninja
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
|
@ -29,10 +17,10 @@ commandTests:
|
||||||
command: doxygen
|
command: doxygen
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*1.*"]
|
expectedOutput: [".*1.*"]
|
||||||
- name: cppcheck
|
- name: clang
|
||||||
command: cppcheck
|
command: /usr/lib/llvm-15/bin/clang
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*Cppcheck.*"]
|
expectedOutput: [".*clang.*"]
|
||||||
|
|
||||||
fileExistenceTests:
|
fileExistenceTests:
|
||||||
- name: "vcpkg"
|
- name: "vcpkg"
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
## base image
|
||||||
|
FROM fedora:38 as setup-cpp-fedora-mingw
|
||||||
|
|
||||||
|
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
|
||||||
|
|
||||||
|
# install nodejs
|
||||||
|
RUN dnf -y install nodejs npm && \
|
||||||
|
|
||||||
|
# install the compiler and tools
|
||||||
|
node /usr/lib/setup-cpp/setup-cpp.js \
|
||||||
|
--compiler mingw \
|
||||||
|
--cmake true \
|
||||||
|
--ninja true \
|
||||||
|
--task true \
|
||||||
|
--vcpkg true \
|
||||||
|
--python true \
|
||||||
|
--make true \
|
||||||
|
--cppcheck true \
|
||||||
|
--gcovr true \
|
||||||
|
--doxygen true \
|
||||||
|
--ccache true \
|
||||||
|
--powershell true && \
|
||||||
|
# cleanup
|
||||||
|
dnf clean all && \
|
||||||
|
rm -rf /tmp/*
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
||||||
|
|
||||||
|
#### Cross Building (example)
|
||||||
|
FROM setup-cpp-fedora-mingw AS builder-mingw
|
||||||
|
|
||||||
|
COPY ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task build_cross_mingw'
|
|
@ -0,0 +1,23 @@
|
||||||
|
schemaVersion: 2.0.0
|
||||||
|
|
||||||
|
commandTests:
|
||||||
|
- name: mingw c compiler
|
||||||
|
command: x86_64-w64-mingw32-gcc
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-gcc.*"]
|
||||||
|
- name: mingw c++ compiler
|
||||||
|
command: x86_64-w64-mingw32-cpp
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-cpp.*"]
|
||||||
|
- name: powershell
|
||||||
|
command: pwsh
|
||||||
|
args: ["-Version"]
|
||||||
|
expectedOutput: [".*PowerShell.*"]
|
||||||
|
|
||||||
|
fileExistenceTests:
|
||||||
|
- name: "vcpkg"
|
||||||
|
path: "/root/vcpkg"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "cross root"
|
||||||
|
path: "/usr/x86_64-w64-mingw32"
|
||||||
|
shouldExist: true
|
|
@ -1,18 +1,6 @@
|
||||||
schemaVersion: 2.0.0
|
schemaVersion: 2.0.0
|
||||||
|
|
||||||
commandTests:
|
commandTests:
|
||||||
- name: gcc compiler
|
|
||||||
command: gcc
|
|
||||||
args: ["--version"]
|
|
||||||
expectedOutput: [".*gcc.*GCC.*"]
|
|
||||||
- name: g++ compiler
|
|
||||||
command: g++
|
|
||||||
args: ["--version"]
|
|
||||||
expectedOutput: [".*g\\+\\+.*GCC.*"]
|
|
||||||
- name: make
|
|
||||||
command: make
|
|
||||||
args: ["--version"]
|
|
||||||
expectedOutput: [".*GNU Make.*"]
|
|
||||||
- name: ninja
|
- name: ninja
|
||||||
command: /root/ninja/ninja
|
command: /root/ninja/ninja
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
|
@ -29,6 +17,10 @@ commandTests:
|
||||||
command: doxygen
|
command: doxygen
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*1.*"]
|
expectedOutput: [".*1.*"]
|
||||||
|
- name: clang
|
||||||
|
command: /usr/lib/llvm-15/bin/clang
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*clang.*"]
|
||||||
|
|
||||||
fileExistenceTests:
|
fileExistenceTests:
|
||||||
- name: "vcpkg"
|
- name: "vcpkg"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { readFile, writeFile } from "fs/promises"
|
import { readFile, writeFile } from "fs/promises"
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const dockerFiles = ["ubuntu", "arch", "fedora"]
|
const dockerFiles = ["ubuntu", "arch", "fedora", "ubuntu-mingw", "arch-mingw", "fedora-mingw"]
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
dockerFiles.map(async (dockerFile) => {
|
dockerFiles.map(async (dockerFile) => {
|
||||||
const dockerFileContent = await readFile(`./dev/docker/setup-cpp-${dockerFile}.dockerfile`, "utf-8")
|
const dockerFileContent = await readFile(`./dev/docker/setup-cpp-${dockerFile}.dockerfile`, "utf-8")
|
|
@ -0,0 +1,41 @@
|
||||||
|
#### Base Image
|
||||||
|
FROM ubuntu:22.04 as setup-cpp-ubuntu-mingw
|
||||||
|
|
||||||
|
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
|
||||||
|
|
||||||
|
RUN apt-get update -qq && \
|
||||||
|
# install nodejs
|
||||||
|
apt-get install -y --no-install-recommends nodejs npm && \
|
||||||
|
|
||||||
|
# install the compiler and tools
|
||||||
|
node /usr/lib/setup-cpp/setup-cpp.js \
|
||||||
|
--nala true \
|
||||||
|
--compiler mingw \
|
||||||
|
--cmake true \
|
||||||
|
--ninja true \
|
||||||
|
--task true \
|
||||||
|
--vcpkg true \
|
||||||
|
--python true \
|
||||||
|
--make true \
|
||||||
|
--cppcheck true \
|
||||||
|
--gcovr true \
|
||||||
|
--doxygen true \
|
||||||
|
--ccache true \
|
||||||
|
--powershell true && \
|
||||||
|
# cleanup
|
||||||
|
nala autoremove -y && \
|
||||||
|
nala autopurge -y && \
|
||||||
|
apt-get clean && \
|
||||||
|
nala clean --lists && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
rm -rf /tmp/*
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
||||||
|
|
||||||
|
#### Cross Building (example)
|
||||||
|
FROM setup-cpp-ubuntu-mingw AS builder-mingw
|
||||||
|
|
||||||
|
COPY ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task build_cross_mingw'
|
|
@ -0,0 +1,23 @@
|
||||||
|
schemaVersion: 2.0.0
|
||||||
|
|
||||||
|
commandTests:
|
||||||
|
- name: mingw c compiler
|
||||||
|
command: x86_64-w64-mingw32-gcc
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-gcc.*"]
|
||||||
|
- name: mingw c++ compiler
|
||||||
|
command: x86_64-w64-mingw32-g++
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-g\\+\\+*"]
|
||||||
|
- name: powershell
|
||||||
|
command: pwsh
|
||||||
|
args: ["-Version"]
|
||||||
|
expectedOutput: [".*PowerShell.*"]
|
||||||
|
|
||||||
|
fileExistenceTests:
|
||||||
|
- name: "vcpkg"
|
||||||
|
path: "/root/vcpkg"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "cross root"
|
||||||
|
path: "/usr/x86_64-w64-mingw32"
|
||||||
|
shouldExist: true
|
|
@ -1,40 +1,28 @@
|
||||||
schemaVersion: 2.0.0
|
schemaVersion: 2.0.0
|
||||||
|
|
||||||
commandTests:
|
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
|
- name: ninja
|
||||||
command: /root/ninja/ninja
|
command: /root/ninja/ninja
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*1.*"]
|
expectedOutput: [".*1.*"]
|
||||||
- name: gcovr
|
- name: gcovr
|
||||||
command: gcovr
|
command: /usr/local/bin/gcovr
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*gcovr.*"]
|
expectedOutput: [".*gcovr.*"]
|
||||||
- name: ccache
|
- name: ccache
|
||||||
command: ccache
|
command: /usr/bin/ccache
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*ccache.*"]
|
expectedOutput: [".*ccache.*"]
|
||||||
- name: doxygen
|
- name: doxygen
|
||||||
command: doxygen
|
command: /usr/bin/doxygen
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*1.*"]
|
expectedOutput: [".*1.*"]
|
||||||
- name: cppcheck
|
- name: cppcheck
|
||||||
command: cppcheck
|
command: /usr/bin/cppcheck
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*Cppcheck.*"]
|
expectedOutput: [".*Cppcheck.*"]
|
||||||
- name: clang
|
- name: clang
|
||||||
command: /root/llvm/bin/clang
|
command: /usr/lib/llvm-15/bin/clang
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*clang.*"]
|
expectedOutput: [".*clang.*"]
|
||||||
|
|
||||||
|
@ -45,3 +33,9 @@ fileExistenceTests:
|
||||||
- name: "llvm"
|
- name: "llvm"
|
||||||
path: "/root/llvm"
|
path: "/root/llvm"
|
||||||
shouldExist: true
|
shouldExist: true
|
||||||
|
- name: "ninja"
|
||||||
|
path: "/root/ninja"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "cmake"
|
||||||
|
path: "/root/cmake"
|
||||||
|
shouldExist: true
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#### Cross Building (example)
|
||||||
|
FROM setup-cpp-arch-mingw AS builder-mingw
|
||||||
|
|
||||||
|
COPY ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task build_cross_mingw'
|
|
@ -0,0 +1,7 @@
|
||||||
|
#### Cross Building (example)
|
||||||
|
FROM setup-cpp-fedora-mingw AS builder-mingw
|
||||||
|
|
||||||
|
COPY ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task build_cross_mingw'
|
|
@ -0,0 +1,28 @@
|
||||||
|
## base image
|
||||||
|
FROM archlinux:base as setup-cpp-arch-mingw
|
||||||
|
|
||||||
|
RUN pacman -Syuu --noconfirm && \
|
||||||
|
pacman-db-upgrade && \
|
||||||
|
# install nodejs
|
||||||
|
pacman -S --noconfirm --needed nodejs npm && \
|
||||||
|
# install setup-cpp
|
||||||
|
npm install -g setup-cpp@v0.32.1 && \
|
||||||
|
# install the compiler and tools
|
||||||
|
setup-cpp \
|
||||||
|
--compiler mingw \
|
||||||
|
--cmake true \
|
||||||
|
--ninja true \
|
||||||
|
--task true \
|
||||||
|
--vcpkg true \
|
||||||
|
--python true \
|
||||||
|
--make true \
|
||||||
|
--cppcheck true \
|
||||||
|
--gcovr true \
|
||||||
|
--doxygen true \
|
||||||
|
--ccache true && \
|
||||||
|
# arch cleanup
|
||||||
|
pacman -Scc --noconfirm && \
|
||||||
|
rm -rf /var/cache/pacman/pkg/* && \
|
||||||
|
rm -rf /tmp/*
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
|
@ -0,0 +1,26 @@
|
||||||
|
## base image
|
||||||
|
FROM fedora:38 as setup-cpp-fedora-mingw
|
||||||
|
|
||||||
|
# install nodejs
|
||||||
|
RUN dnf -y install nodejs npm && \
|
||||||
|
# install setup-cpp
|
||||||
|
npm install -g setup-cpp@v0.32.1 && \
|
||||||
|
# install the compiler and tools
|
||||||
|
setup-cpp \
|
||||||
|
--compiler mingw \
|
||||||
|
--cmake true \
|
||||||
|
--ninja true \
|
||||||
|
--task true \
|
||||||
|
--vcpkg true \
|
||||||
|
--python true \
|
||||||
|
--make true \
|
||||||
|
--cppcheck true \
|
||||||
|
--gcovr true \
|
||||||
|
--doxygen true \
|
||||||
|
--ccache true \
|
||||||
|
--powershell true && \
|
||||||
|
# cleanup
|
||||||
|
dnf clean all && \
|
||||||
|
rm -rf /tmp/*
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
|
@ -0,0 +1,32 @@
|
||||||
|
#### Base Image
|
||||||
|
FROM ubuntu:22.04 as setup-cpp-ubuntu-mingw
|
||||||
|
|
||||||
|
RUN apt-get update -qq && \
|
||||||
|
# install nodejs
|
||||||
|
apt-get install -y --no-install-recommends nodejs npm && \
|
||||||
|
# install setup-cpp
|
||||||
|
npm install -g setup-cpp@v0.32.1 && \
|
||||||
|
# install the compiler and tools
|
||||||
|
setup-cpp \
|
||||||
|
--nala true \
|
||||||
|
--compiler mingw \
|
||||||
|
--cmake true \
|
||||||
|
--ninja true \
|
||||||
|
--task true \
|
||||||
|
--vcpkg true \
|
||||||
|
--python true \
|
||||||
|
--make true \
|
||||||
|
--cppcheck true \
|
||||||
|
--gcovr true \
|
||||||
|
--doxygen true \
|
||||||
|
--ccache true \
|
||||||
|
--powershell true && \
|
||||||
|
# cleanup
|
||||||
|
nala autoremove -y && \
|
||||||
|
nala autopurge -y && \
|
||||||
|
apt-get clean && \
|
||||||
|
nala clean --lists && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
rm -rf /tmp/*
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
|
@ -0,0 +1,7 @@
|
||||||
|
#### Cross Building (example)
|
||||||
|
FROM setup-cpp-ubuntu-mingw AS builder-mingw
|
||||||
|
|
||||||
|
COPY ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task build_cross_mingw'
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10
package.json
10
package.json
|
@ -55,13 +55,19 @@
|
||||||
"test.lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
|
"test.lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
|
||||||
"test.lint.prettier": "prettier . --check",
|
"test.lint.prettier": "prettier . --check",
|
||||||
"test.unit": "jest --runInBand",
|
"test.unit": "jest --runInBand",
|
||||||
"build.docker_tests": "pnpm build && node ./dev/scripts/generate-docker-tests.mjs",
|
"build.docker_tests": "pnpm build && node ./dev/docker/__tests__/generate-docker-tests.mjs",
|
||||||
"build.docker.arch": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/arch.dockerfile -t setup-cpp:arch .",
|
"build.docker.arch": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/arch.dockerfile -t setup-cpp:arch .",
|
||||||
"build.docker.fedora": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/fedora.dockerfile -t setup-cpp:fedora .",
|
"build.docker.fedora": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/fedora.dockerfile -t setup-cpp:fedora .",
|
||||||
"build.docker.ubuntu": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/ubuntu.dockerfile -t setup-cpp:ubuntu .",
|
"build.docker.ubuntu": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/ubuntu.dockerfile -t setup-cpp:ubuntu .",
|
||||||
|
"build.docker.arch.mingw": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/arch-mingw.dockerfile -t setup-cpp:arch-mingw .",
|
||||||
|
"build.docker.fedora.mingw": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/fedora-mingw.dockerfile -t setup-cpp:fedora-mingw .",
|
||||||
|
"build.docker.ubuntu.mingw": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/ubuntu-mingw.dockerfile -t setup-cpp:ubuntu-mingw .",
|
||||||
"test.docker.arch": "pnpm build.docker.arch && container-structure-test test --image setup-cpp:arch --config ./dev/docker/__tests__/arch.yml",
|
"test.docker.arch": "pnpm build.docker.arch && container-structure-test test --image setup-cpp:arch --config ./dev/docker/__tests__/arch.yml",
|
||||||
"test.docker.fedora": "pnpm build.docker.fedora && container-structure-test test --image setup-cpp:fedora --config ./dev/docker/__tests__/fedora.yml",
|
"test.docker.fedora": "pnpm build.docker.fedora && container-structure-test test --image setup-cpp:fedora --config ./dev/docker/__tests__/fedora.yml",
|
||||||
"test.docker.ubuntu": "pnpm build.docker.ubuntu && container-structure-test test --image setup-cpp:ubuntu --config ./dev/docker/__tests__/ubuntu.yml"
|
"test.docker.ubuntu": "pnpm build.docker.ubuntu && container-structure-test test --image setup-cpp:ubuntu --config ./dev/docker/__tests__/ubuntu.yml",
|
||||||
|
"test.docker.arch.mingw": "pnpm build.docker.arch.mingw && container-structure-test test --image setup-cpp:arch-mingw --config ./dev/docker/__tests__/arch-mingw.yml",
|
||||||
|
"test.docker.fedora.mingw": "pnpm build.docker.fedora.mingw && container-structure-test test --image setup-cpp:fedora-mingw --config ./dev/docker/__tests__/fedora-mingw.yml",
|
||||||
|
"test.docker.ubuntu.mingw": "pnpm build.docker.ubuntu.mingw && container-structure-test test --image setup-cpp:ubuntu-mingw --config ./dev/docker/__tests__/ubuntu-mingw.yml"
|
||||||
},
|
},
|
||||||
"prettier": "prettier-config-atomic",
|
"prettier": "prettier-config-atomic",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { error, info } from "ci-log"
|
||||||
import { join } from "path"
|
import { join } from "path"
|
||||||
import semverValid from "semver/functions/valid"
|
import semverValid from "semver/functions/valid"
|
||||||
import { getSuccessMessage } from "./cli-options"
|
import { getSuccessMessage } from "./cli-options"
|
||||||
import { setupGcc } from "./gcc/gcc"
|
import { setupGcc, setupMingw } from "./gcc/gcc"
|
||||||
import { activateGcovGCC, activateGcovLLVM } from "./gcovr/gcovr"
|
import { activateGcovGCC, activateGcovLLVM } from "./gcovr/gcovr"
|
||||||
import { setupLLVM } from "./llvm/llvm"
|
import { setupLLVM } from "./llvm/llvm"
|
||||||
import { setupMSVC } from "./msvc/msvc"
|
import { setupMSVC } from "./msvc/msvc"
|
||||||
|
@ -60,8 +60,12 @@ export async function installCompiler(
|
||||||
case "mingw":
|
case "mingw":
|
||||||
case "cygwin":
|
case "cygwin":
|
||||||
case "msys": {
|
case "msys": {
|
||||||
const gccVersion = getVersion("gcc", version, osVersion)
|
const gccVersion =
|
||||||
const installationInfo = await setupGcc(gccVersion, join(setupCppDir, "gcc"), arch)
|
compiler === "mingw" ? getVersion("mingw", version, osVersion) : getVersion("gcc", version, osVersion)
|
||||||
|
const installationInfo =
|
||||||
|
compiler === "mingw"
|
||||||
|
? await setupMingw(gccVersion, join(setupCppDir, "gcc"), arch)
|
||||||
|
: await setupGcc(gccVersion, join(setupCppDir, "gcc"), arch)
|
||||||
|
|
||||||
if (hasLLVM) {
|
if (hasLLVM) {
|
||||||
// remove back the added CPPFLAGS of LLVM that include the LLVM headers
|
// remove back the added CPPFLAGS of LLVM that include the LLVM headers
|
||||||
|
|
|
@ -141,6 +141,42 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
export async function setupMingw(version: string, setupDir: string, arch: string) {
|
||||||
|
let installationInfo: InstallationInfo | undefined
|
||||||
|
switch (process.platform) {
|
||||||
|
case "win32":
|
||||||
|
case "darwin": {
|
||||||
|
return setupGcc(version, setupDir, arch)
|
||||||
|
}
|
||||||
|
case "linux": {
|
||||||
|
if (isArch()) {
|
||||||
|
installationInfo = await setupPacmanPack("mingw-w64-gcc", version)
|
||||||
|
} else if (hasDnf()) {
|
||||||
|
installationInfo = await setupDnfPack([{ name: "mingw64-gcc", version }])
|
||||||
|
} else if (isUbuntu()) {
|
||||||
|
installationInfo = await setupAptPack([
|
||||||
|
{ name: "mingw-w64", version, repositories: ["ppa:ubuntu-toolchain-r/test"] },
|
||||||
|
])
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
throw new Error(`Unsupported platform for ${arch}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (installationInfo !== undefined) {
|
||||||
|
// TODO: setup alternatives and update CC/CXX env. ?
|
||||||
|
//Setting up g++-mingw-w64-i686-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||||
|
// update-alternatives: using /usr/bin/i686-w64-mingw32-g++-win32 to provide /usr/bin/i686-w64-mingw32-g++ (i686-w64-mingw32-g++) in auto mode
|
||||||
|
//Setting up g++-mingw-w64-x86-64-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||||
|
// update-alternatives: using /usr/bin/x86_64-w64-mingw32-g++-win32 to provide /usr/bin/x86_64-w64-mingw32-g++ (x86_64-w64-mingw32-g++) in auto mode
|
||||||
|
//await activateGcc(version, installationInfo.binDir)
|
||||||
|
return installationInfo
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
async function setupChocoMingw(version: string, arch: string): Promise<InstallationInfo | undefined> {
|
async function setupChocoMingw(version: string, arch: string): Promise<InstallationInfo | undefined> {
|
||||||
await setupChocoPack("mingw", version)
|
await setupChocoPack("mingw", version)
|
||||||
let binDir: string | undefined
|
let binDir: string | undefined
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { InstallationInfo } from "./setupBin"
|
import { InstallationInfo } from "./setupBin"
|
||||||
import { execRootSync } from "admina"
|
import { execRootSync } from "admina"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import { execa } from "execa"
|
import { execa, execaSync } from "execa"
|
||||||
|
import which from "which"
|
||||||
|
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
let didUpdate: boolean = false
|
let didUpdate: boolean = false
|
||||||
|
@ -13,6 +14,11 @@ export async function setupPacmanPack(name: string, version?: string, aur?: stri
|
||||||
|
|
||||||
const pacman = "pacman"
|
const pacman = "pacman"
|
||||||
|
|
||||||
|
if (aur === "yay" && which.sync("yay", { nothrow: true }) === null) {
|
||||||
|
// TODO: install yay automatically
|
||||||
|
throw new Error(`yay is needed for ${name}, but it is not installed, please install it manually first`)
|
||||||
|
}
|
||||||
|
|
||||||
// yay can't run as root, so skip update
|
// yay can't run as root, so skip update
|
||||||
if (!didUpdate && aur !== "yay") {
|
if (!didUpdate && aur !== "yay") {
|
||||||
execRootSync(pacman, ["-Sy", "--noconfirm"])
|
execRootSync(pacman, ["-Sy", "--noconfirm"])
|
||||||
|
@ -20,12 +26,16 @@ export async function setupPacmanPack(name: string, version?: string, aur?: stri
|
||||||
}
|
}
|
||||||
|
|
||||||
// install base-devel
|
// install base-devel
|
||||||
if (!didInit) {
|
if (!didInit && aur !== "yay") {
|
||||||
execRootSync(pacman, ["-S", "--noconfirm", "base-devel"])
|
execRootSync(pacman, ["-S", "--noconfirm", "base-devel"])
|
||||||
didInit = true
|
didInit = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const runInstall = (arg: string) => {
|
const runInstall = (arg: string) => {
|
||||||
|
if (aur === "yay") {
|
||||||
|
// run yay as non-root, ERROR: Running makepkg as root is not allowed as it can cause permanent, catastrophic damage to your system.
|
||||||
|
return execaSync(aur, ["-S", "--noconfirm", arg])
|
||||||
|
}
|
||||||
return execRootSync(aur ?? pacman, ["-S", "--noconfirm", arg])
|
return execRootSync(aur ?? pacman, ["-S", "--noconfirm", arg])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ export const DefaultVersions: Record<string, string | undefined> = {
|
||||||
task: "3.25.0", // https://github.com/go-task/task/releases
|
task: "3.25.0", // https://github.com/go-task/task/releases
|
||||||
doxygen: isArch() ? "1.9.6-1" : "1.9.7", // 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/
|
doxygen: isArch() ? "1.9.6-1" : "1.9.7", // 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: isArch() ? "13.1.1-1" : "13", // https://github.com/brechtsanders/winlibs_mingw/releases and // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=gcc
|
gcc: isArch() ? "13.1.1-1" : "13", // https://github.com/brechtsanders/winlibs_mingw/releases and // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=gcc
|
||||||
|
//mingw: isArch() ? "12.2.0-1" : "8", // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=mingw-w64 // https://archlinux.org/packages/extra/x86_64/mingw-w64-gcc/
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MinVersions: Record<string, string | undefined> = {
|
export const MinVersions: Record<string, string | undefined> = {
|
||||||
|
@ -46,6 +47,10 @@ export const DefaultLinuxVersion: Record<string, Record<number, string> | undefi
|
||||||
16: "11",
|
16: "11",
|
||||||
14: "11",
|
14: "11",
|
||||||
},
|
},
|
||||||
|
mingw: {
|
||||||
|
22: "8.0.0-1",
|
||||||
|
20: "7.0.0-2",
|
||||||
|
},
|
||||||
llvm: {
|
llvm: {
|
||||||
22: "15.0.6-ubuntu-18.04",
|
22: "15.0.6-ubuntu-18.04",
|
||||||
20: "15.0.6-ubuntu-18.04",
|
20: "15.0.6-ubuntu-18.04",
|
||||||
|
|
|
@ -28,5 +28,10 @@
|
||||||
"outDir": "./dist"
|
"outDir": "./dist"
|
||||||
},
|
},
|
||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
"include": ["./src", "dev/scripts", "packages/untildify-user/untildify.ts"]
|
"include": [
|
||||||
|
"./src",
|
||||||
|
"dev/scripts",
|
||||||
|
"packages/untildify-user/untildify.ts",
|
||||||
|
"dev/docker/__tests__/generate-docker-tests.mjs"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue