mirror of
https://github.com/bensuperpc/dockcross.git
synced 2024-12-22 16:24:27 +01:00
Merge commit '979104089a78e444f8d47d82c68fd5cd60966b5e' into update_crosstool-ng
This commit is contained in:
commit
12b9bd98ca
@ -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.
|
||||||
|
|
||||||
@ -198,14 +198,14 @@ You need to add the image/folder name (**linux-arm64**) to the **STANDARD_IMAGES
|
|||||||
```make
|
```make
|
||||||
# These images are built using the "build implicit rule"
|
# These images are built using the "build implicit rule"
|
||||||
STANDARD_IMAGES = android-arm android-arm64 android-x86 android-x86_64 \
|
STANDARD_IMAGES = android-arm android-arm64 android-x86 android-x86_64 \
|
||||||
linux-x86 linux-x64 linux-x64-clang linux-arm64 linux-arm64-musl linux-arm64-full \
|
linux-x86 linux-x64 linux-x64-clang linux-arm64 linux-arm64-musl linux-arm64-full \
|
||||||
linux-armv5 linux-armv5-musl linux-armv5-uclibc linux-m68k-uclibc linux-s390x linux-x64-tinycc \
|
linux-armv5 linux-armv5-musl linux-armv5-uclibc linux-m68k-uclibc linux-s390x linux-x64-tinycc \
|
||||||
linux-armv6 linux-armv6-lts linux-armv6-musl linux-arm64-lts \
|
linux-armv6 linux-armv6-lts linux-armv6-musl linux-arm64-lts \
|
||||||
linux-armv7l-musl linux-armv7 linux-armv7a linux-armv7-lts linux-x86_64-full \
|
linux-armv7l-musl linux-armv7 linux-armv7a linux-armv7-lts linux-x86_64-full \
|
||||||
linux-mips linux-ppc64le linux-riscv64 linux-riscv32 linux-xtensa-uclibc \
|
linux-mips linux-ppc64le linux-riscv64 linux-riscv32 linux-xtensa-uclibc \
|
||||||
web-wasi \
|
web-wasi \
|
||||||
windows-static-x86 windows-static-x64 windows-static-x64-posix windows-armv7 \
|
windows-static-x86 windows-static-x64 windows-static-x64-posix windows-armv7 \
|
||||||
windows-shared-x86 windows-shared-x64 windows-shared-x64-posix windows-arm64
|
windows-shared-x86 windows-shared-x64 windows-shared-x64-posix windows-arm64
|
||||||
```
|
```
|
||||||
|
|
||||||
You need to add the image/folder name (**linux-arm64**) to the **GEN_IMAGES** variable in the [Makefile](Makefile):
|
You need to add the image/folder name (**linux-arm64**) to the **GEN_IMAGES** variable in the [Makefile](Makefile):
|
||||||
@ -213,18 +213,54 @@ You need to add the image/folder name (**linux-arm64**) to the **GEN_IMAGES** va
|
|||||||
```make
|
```make
|
||||||
# Generated Dockerfiles.
|
# Generated Dockerfiles.
|
||||||
GEN_IMAGES = android-arm android-arm64 \
|
GEN_IMAGES = android-arm android-arm64 \
|
||||||
linux-x86 linux-x64 linux-x64-clang linux-arm64 linux-arm64-musl linux-arm64-full \
|
linux-x86 linux-x64 linux-x64-clang linux-arm64 linux-arm64-musl linux-arm64-full \
|
||||||
manylinux2014-x64 manylinux2014-x86 \
|
manylinux2014-x64 manylinux2014-x86 \
|
||||||
manylinux2014-aarch64 linux-arm64-lts \
|
manylinux2014-aarch64 linux-arm64-lts \
|
||||||
web-wasm web-wasi linux-mips windows-arm64 windows-armv7 \
|
web-wasm web-wasi linux-mips windows-arm64 windows-armv7 \
|
||||||
windows-static-x86 windows-static-x64 windows-static-x64-posix \
|
windows-static-x86 windows-static-x64 windows-static-x64-posix \
|
||||||
windows-shared-x86 windows-shared-x64 windows-shared-x64-posix \
|
windows-shared-x86 windows-shared-x64 windows-shared-x64-posix \
|
||||||
linux-armv7 linux-armv7a linux-armv7l-musl linux-armv7-lts linux-x86_64-full \
|
linux-armv7 linux-armv7a linux-armv7l-musl linux-armv7-lts linux-x86_64-full \
|
||||||
linux-armv6 linux-armv6-lts linux-armv6-musl \
|
linux-armv6 linux-armv6-lts linux-armv6-musl \
|
||||||
linux-armv5 linux-armv5-musl linux-armv5-uclibc linux-ppc64le linux-s390x \
|
linux-armv5 linux-armv5-musl linux-armv5-uclibc linux-ppc64le linux-s390x \
|
||||||
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
|
||||||
|
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user