mirror of
				https://github.com/bensuperpc/dockcross.git
				synced 2025-10-31 08:06:23 +01:00 
			
		
		
		
	Compare commits
	
		
			14 Commits
		
	
	
		
			update_ci_
			...
			update_web
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 292bb9d2a3 | |||
| 7a4634c4f8 | |||
| 96839c5789 | |||
| eda038eacf | |||
| daad4d760d | |||
| 979104089a | |||
| 7876c21e62 | |||
| c068180665 | |||
| 63514041f6 | |||
| 3d5142d6ad | |||
| a9dda23ae7 | |||
| 0fc1c34f29 | |||
| 84d4b38037 | |||
| a5f1b3098a | 
							
								
								
									
										61
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										61
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							| @@ -18,24 +18,45 @@ jobs: | |||||||
|     name: base |     name: base | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v3 |       - name: checkout code | ||||||
|  |         uses: actions/checkout@v3 | ||||||
|  |         with: | ||||||
|  |           submodules: "recursive" | ||||||
|  |           fetch-depth: 1 | ||||||
|  |  | ||||||
|       - name: build |       - name: build | ||||||
|         run: make base |         uses: nick-fields/retry@v2 | ||||||
|  |         with: | ||||||
|  |           timeout_minutes: 120 | ||||||
|  |           retry_wait_seconds: 40 | ||||||
|  |           max_attempts: 3 | ||||||
|  |           retry_on: error | ||||||
|  |           command: make base | ||||||
|  |  | ||||||
|       - name: test |       - name: test | ||||||
|         run: make base.test |         run: make base.test | ||||||
|  |  | ||||||
|       - name: archive base |       - name: archive base | ||||||
|         run: | |         run: | | ||||||
|           mkdir -p cache |           mkdir -p cache | ||||||
|           docker save dockcross/base:latest | xz -e9 -T0 > ./cache/base.tar.xz |           docker save dockcross/base:latest | xz -e9 -T0 > ./cache/base.tar.xz | ||||||
|  |  | ||||||
|       - name: save base |       - name: save base | ||||||
|         uses: actions/upload-artifact@v3 |         uses: actions/upload-artifact@v3 | ||||||
|         with: |         with: | ||||||
|           name: cache |           name: cache | ||||||
|           path: ./cache |           path: ./cache | ||||||
|           retention-days: 1 |           retention-days: 1 | ||||||
|  |  | ||||||
|       - name: deploy |       - name: deploy | ||||||
|         if: github.ref == 'refs/heads/master' |         if: github.ref == 'refs/heads/master' | ||||||
|         run: | |         uses: nick-fields/retry@v2 | ||||||
|  |         with: | ||||||
|  |           timeout_minutes: 30 | ||||||
|  |           retry_wait_seconds: 30 | ||||||
|  |           max_attempts: 4 | ||||||
|  |           retry_on: error | ||||||
|  |           command: | | ||||||
|             docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }} |             docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }} | ||||||
|             docker image push dockcross/base --all-tags |             docker image push dockcross/base --all-tags | ||||||
|  |  | ||||||
| @@ -833,17 +854,32 @@ jobs: | |||||||
|               cpython_arg: "", |               cpython_arg: "", | ||||||
|             } |             } | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v3 |       - name: checkout code | ||||||
|  |         uses: actions/checkout@v3 | ||||||
|  |         with: | ||||||
|  |           submodules: "recursive" | ||||||
|  |           fetch-depth: 1 | ||||||
|  |  | ||||||
|       - uses: actions/download-artifact@v3 |       - uses: actions/download-artifact@v3 | ||||||
|         with: |         with: | ||||||
|           name: cache |           name: cache | ||||||
|           path: ./cache |           path: ./cache | ||||||
|  |  | ||||||
|       - name: load base |       - name: load base | ||||||
|         run: xz -d -k < ./cache/base.tar.xz | docker load |         run: xz -d -k < ./cache/base.tar.xz | docker load | ||||||
|  |  | ||||||
|       - name: build |       - name: build | ||||||
|         run: make ${{ matrix.arch_name.image }} |         uses: nick-fields/retry@v2 | ||||||
|  |         with: | ||||||
|  |           timeout_minutes: 360 | ||||||
|  |           retry_wait_seconds: 20 | ||||||
|  |           max_attempts: 3 | ||||||
|  |           retry_on: error | ||||||
|  |           command: make ${{ matrix.arch_name.image }} | ||||||
|  |  | ||||||
|       - name: basic test |       - name: basic test | ||||||
|         run: make ${{ matrix.arch_name.image }}.test |         run: make ${{ matrix.arch_name.image }}.test | ||||||
|  |  | ||||||
|       # Updated on 19/05/2022 |       # Updated on 19/05/2022 | ||||||
|       - name: stockfish build test |       - name: stockfish build test | ||||||
|         if: ${{ matrix.arch_name.stockfish == 'yes' }} |         if: ${{ matrix.arch_name.stockfish == 'yes' }} | ||||||
| @@ -855,12 +891,14 @@ jobs: | |||||||
|           cd ../.. |           cd ../.. | ||||||
|           rm -rf Stockfish |           rm -rf Stockfish | ||||||
|       # Updated on 19/05/2022 |       # Updated on 19/05/2022 | ||||||
|  |  | ||||||
|       - name: ninja build test |       - name: ninja build test | ||||||
|         if: ${{ matrix.arch_name.ninja == 'yes' }} |         if: ${{ matrix.arch_name.ninja == 'yes' }} | ||||||
|         run: | |         run: | | ||||||
|           git clone --depth 1 --branch v1.11.0 https://github.com/ninja-build/ninja.git |           git clone --depth 1 --branch v1.11.0 https://github.com/ninja-build/ninja.git | ||||||
|           cd ninja |           cd ninja | ||||||
|           ./../tools/dockcross-cmake-builder.sh ${{ matrix.arch_name.image }} ${{ matrix.arch_name.ninja_arg }} |           ./../tools/dockcross-cmake-builder.sh ${{ matrix.arch_name.image }} ${{ matrix.arch_name.ninja_arg }} | ||||||
|  |  | ||||||
|       # Updated on 19/05/2022 |       # Updated on 19/05/2022 | ||||||
|       - name: openssl build test |       - name: openssl build test | ||||||
|         if: ${{ matrix.arch_name.openssl == 'yes' }} |         if: ${{ matrix.arch_name.openssl == 'yes' }} | ||||||
| @@ -873,6 +911,7 @@ jobs: | |||||||
|           ./../tools/dockcross-make-builder.sh ${{ matrix.arch_name.image }} -j2 |           ./../tools/dockcross-make-builder.sh ${{ matrix.arch_name.image }} -j2 | ||||||
|           cd .. |           cd .. | ||||||
|           rm -rf openssl |           rm -rf openssl | ||||||
|  |  | ||||||
|       # Updated on 19/05/2022 |       # Updated on 19/05/2022 | ||||||
|       - name: C build test |       - name: C build test | ||||||
|         if: ${{ matrix.arch_name.C == 'yes' }} |         if: ${{ matrix.arch_name.C == 'yes' }} | ||||||
| @@ -883,6 +922,7 @@ jobs: | |||||||
|           ./../tools/dockcross-cmake-builder.sh ${{ matrix.arch_name.image }} ${{ matrix.arch_name.C_arg }} |           ./../tools/dockcross-cmake-builder.sh ${{ matrix.arch_name.image }} ${{ matrix.arch_name.C_arg }} | ||||||
|           cd .. |           cd .. | ||||||
|           rm -rf C |           rm -rf C | ||||||
|  |  | ||||||
|       # Updated on 19/05/2022 |       # Updated on 19/05/2022 | ||||||
|       - name: C-Plus-Plus build test |       - name: C-Plus-Plus build test | ||||||
|         if: ${{ matrix.arch_name.C-Plus-Plus == 'yes' }} |         if: ${{ matrix.arch_name.C-Plus-Plus == 'yes' }} | ||||||
| @@ -893,6 +933,7 @@ jobs: | |||||||
|           ./../tools/dockcross-cmake-builder.sh ${{ matrix.arch_name.image }} ${{ matrix.arch_name.C-Plus-Plus_arg }} |           ./../tools/dockcross-cmake-builder.sh ${{ matrix.arch_name.image }} ${{ matrix.arch_name.C-Plus-Plus_arg }} | ||||||
|           cd .. |           cd .. | ||||||
|           rm -rf C-Plus-Plus |           rm -rf C-Plus-Plus | ||||||
|  |  | ||||||
|       # Updated on 19/05/2022 |       # Updated on 19/05/2022 | ||||||
|       - name: fmt build test |       - name: fmt build test | ||||||
|         if: ${{ matrix.arch_name.fmt == 'yes' }} |         if: ${{ matrix.arch_name.fmt == 'yes' }} | ||||||
| @@ -902,6 +943,7 @@ jobs: | |||||||
|           ./../tools/dockcross-cmake-builder.sh ${{ matrix.arch_name.image }} ${{ matrix.arch_name.fmt_arg }} -DFMT_DOC=OFF |           ./../tools/dockcross-cmake-builder.sh ${{ matrix.arch_name.image }} ${{ matrix.arch_name.fmt_arg }} -DFMT_DOC=OFF | ||||||
|           cd .. |           cd .. | ||||||
|           rm -rf fmt |           rm -rf fmt | ||||||
|  |  | ||||||
|       # Updated on 19/05/2022 |       # Updated on 19/05/2022 | ||||||
|       - name: cpython build test |       - name: cpython build test | ||||||
|         if: ${{ matrix.arch_name.cpython == 'yes' }} |         if: ${{ matrix.arch_name.cpython == 'yes' }} | ||||||
| @@ -912,8 +954,15 @@ jobs: | |||||||
|           ./../tools/dockcross-make-builder.sh ${{ matrix.arch_name.image }} -j2 |           ./../tools/dockcross-make-builder.sh ${{ matrix.arch_name.image }} -j2 | ||||||
|           cd .. |           cd .. | ||||||
|           rm -rf cpython |           rm -rf cpython | ||||||
|  |  | ||||||
|       - name: deploy |       - name: deploy | ||||||
|         if: github.ref == 'refs/heads/master' |         if: github.ref == 'refs/heads/master' | ||||||
|         run: | |         uses: nick-fields/retry@v2 | ||||||
|  |         with: | ||||||
|  |           timeout_minutes: 30 | ||||||
|  |           retry_wait_seconds: 30 | ||||||
|  |           max_attempts: 4 | ||||||
|  |           retry_on: error | ||||||
|  |           command: | | ||||||
|             docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }} |             docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }} | ||||||
|             docker image push dockcross/${{ matrix.arch_name.image }} --all-tags |             docker image push dockcross/${{ matrix.arch_name.image }} --all-tags | ||||||
|   | |||||||
| @@ -189,7 +189,7 @@ Once this part is finished, there must be 3 files in the **linux-arm64** folder: | |||||||
| - **Dockerfile.in**, the docker file. | - **Dockerfile.in**, the docker file. | ||||||
| - **Toolchain.cmake**, the CMake file for the toolchains. | - **Toolchain.cmake**, the CMake file for the toolchains. | ||||||
|  |  | ||||||
| ### Makefile and CI | ### Makefile | ||||||
|  |  | ||||||
| For this last part, we will see how to add the image to the [Makefile](Makefile) and to a github action. | For this last part, we will see how to add the image to the [Makefile](Makefile) and to a github action. | ||||||
|  |  | ||||||
| @@ -225,6 +225,42 @@ GEN_IMAGES = android-arm android-arm64 \ | |||||||
|  linux-riscv64 linux-riscv32 linux-m68k-uclibc linux-x64-tinycc linux-xtensa-uclibc |  linux-riscv64 linux-riscv32 linux-m68k-uclibc linux-x64-tinycc linux-xtensa-uclibc | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | ### Image building and testing | ||||||
|  |  | ||||||
|  | You can now start building the image: | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | make linux-arm64 | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | When finished, you can test it: | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | make linux-arm64.test | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | If you want to go a little further in the tests: | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | docker run --rm linux-arm64 > ./linux-arm64 | ||||||
|  | chmod +x ./linux-arm64 | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | And then run the commands to build a project (you must be in the directory of your project to build): | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | ./linux-arm64 make | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | With CMake + Ninja: | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | ./linux-arm64 cmake -Bbuild -S. -GNinja | ||||||
|  | ./linux-arm64 ninja -Cbuild | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | ### CI (github action) | ||||||
|  |  | ||||||
| To finish, you have to add to [Github Action](.github/workflows/main.yml) the image/folder name: | To finish, you have to add to [Github Action](.github/workflows/main.yml) the image/folder name: | ||||||
|  |  | ||||||
| ```yml | ```yml | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| Copyright (c) 2015, 2016, 2017, 2018 Steeve Morin, Rob Burns, Matthew McCormick, Jean-Christophe-Fillion-Robin | Copyright (c) 2015, 2016, 2017, 2018, 2021 Steeve Morin, Rob Burns, Matthew McCormick, Jean-Christophe-Fillion-Robin, Bensuperpc | ||||||
|  |  | ||||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | Permission is hereby granted, free of charge, to any person obtaining a copy | ||||||
| of this software and associated documentation files (the "Software"), to deal | of this software and associated documentation files (the "Software"), to deal | ||||||
|   | |||||||
| @@ -25,7 +25,7 @@ Cross compiling toolchains in Docker images. | |||||||
| ## Examples | ## Examples | ||||||
|  |  | ||||||
| 1. `dockcross make`: Build the *Makefile* in the current directory. | 1. `dockcross make`: Build the *Makefile* in the current directory. | ||||||
| 2. `dockcross cmake -Bbuild -H. -GNinja`: Run CMake with a build directory `./build` for a *CMakeLists.txt* file in the current directory and generate `ninja` build configuration files. | 2. `dockcross cmake -Bbuild -S. -GNinja`: Run CMake with a build directory `./build` for a *CMakeLists.txt* file in the current directory and generate `ninja` build configuration files. | ||||||
| 3. `dockcross ninja -Cbuild`: Run ninja in the `./build` directory. | 3. `dockcross ninja -Cbuild`: Run ninja in the `./build` directory. | ||||||
| 4. `dockcross bash -c '$CC test/C/hello.c -o hello'`: Build the *hello.c* file with the compiler identified with the `CC` environmental variable in the build environment. | 4. `dockcross bash -c '$CC test/C/hello.c -o hello'`: Build the *hello.c* file with the compiler identified with the `CC` environmental variable in the build environment. | ||||||
| 5. `dockcross bash`: Run an interactive shell in the build environment. | 5. `dockcross bash`: Run an interactive shell in the build environment. | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| FROM emscripten/emsdk:3.1.5 | ARG DOCKER_IMAGE_VERSION=3.1.10 | ||||||
|  | FROM emscripten/emsdk:$DOCKER_IMAGE_VERSION | ||||||
|  |  | ||||||
| LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" | LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" | ||||||
|  |  | ||||||
| @@ -56,7 +57,7 @@ RUN ln -s /usr/bin/python3 /usr/bin/python | |||||||
|  |  | ||||||
| #include "common.webassembly" | #include "common.webassembly" | ||||||
|  |  | ||||||
| ENV EMSCRIPTEN_VERSION 3.1.5 | ENV EMSCRIPTEN_VERSION $DOCKER_IMAGE_VERSION | ||||||
|  |  | ||||||
| ENV PATH /emsdk:/emsdk/upstream/bin/:/emsdk/upstream/emscripten:${PATH} | ENV PATH /emsdk:/emsdk/upstream/bin/:/emsdk/upstream/emscripten:${PATH} | ||||||
| ENV CC=/emsdk/upstream/emscripten/emcc \ | ENV CC=/emsdk/upstream/emscripten/emcc \ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user