Skip to content

Commit 8ba8cda

Browse files
committed
Build libjpeg-turbo, OpenSSL, OpenBLAS, and FFmpeg packages using MSYS2 MinGW toolchain
1 parent 6d9965f commit 8ba8cda

File tree

8 files changed

+165
-1
lines changed

8 files changed

+165
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e # exit on error
4+
set -x # echo on
5+
set -o pipefail # fail of any command in pipeline is an error
6+
7+
pushd /
8+
patch -p1 -i `cygpath "$GITHUB_WORKSPACE"`/patches/makepkg/0001-cross-compilation.patch
9+
cat /etc/makepkg_mingw.conf
10+
cat /etc/profile
11+
cat /usr/share/makepkg/tidy/strip.sh
12+
popd

.github/workflows/build-package.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ jobs:
7474
sparse-checkout: ${{ inputs.package_name }}
7575
path: ${{ github.workspace }}/packages
7676

77+
- name: Setup cross-compilation environment
78+
if: ${{ contains(inputs.packages_repository, 'MINGW') }}
79+
run: |
80+
`cygpath "${{ github.workspace }}"`/.github/scripts/setup-cross-compilation.sh
81+
7782
- name: Enable Ccache
7883
id: enable-ccache
7984
run: |

.github/workflows/ffmpeg.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Build MinGW FFmpeg using MSYS2 toolchain
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
inputs:
7+
mingw_packages_branch:
8+
description: "MINGW-packages branch to build"
9+
type: string
10+
required: false
11+
default: "woarm64"
12+
13+
jobs:
14+
mingw-w64-ffmpeg:
15+
uses: ./.github/workflows/build-package.yml
16+
with:
17+
package_name: mingw-w64-ffmpeg
18+
packages_repository: Windows-on-ARM-Experiments/MINGW-packages
19+
packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }}
20+
cross_compile: true
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Build MinGW libjpeg-turbo using MSYS2 toolchain
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
inputs:
7+
mingw_packages_branch:
8+
description: "MINGW-packages branch to build"
9+
type: string
10+
required: false
11+
default: "woarm64"
12+
13+
jobs:
14+
mingw-w64-libjpeg-turbo:
15+
uses: ./.github/workflows/build-package.yml
16+
with:
17+
package_name: mingw-w64-libjpeg-turbo
18+
packages_repository: Windows-on-ARM-Experiments/MINGW-packages
19+
packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }}
20+
cross_compile: true

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
pull_request:
87
workflow_dispatch:
98
inputs:
109
msys2_packages_branch:

.github/workflows/openblas.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Build MinGW OpenBLAS using MSYS2 toolchain
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
inputs:
7+
mingw_packages_branch:
8+
description: "MINGW-packages branch to build"
9+
type: string
10+
required: false
11+
default: "woarm64"
12+
13+
jobs:
14+
mingw-w64-openblas:
15+
uses: ./.github/workflows/build-package.yml
16+
with:
17+
package_name: mingw-w64-openblas
18+
packages_repository: Windows-on-ARM-Experiments/MINGW-packages
19+
packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }}
20+
cross_compile: true

.github/workflows/openssl.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build MinGW OpenSSL using MSYS2 toolchain
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
inputs:
7+
mingw_packages_branch:
8+
description: "MINGW-packages branch to build"
9+
type: string
10+
required: false
11+
default: "woarm64"
12+
13+
jobs:
14+
mingw-w64-openssl:
15+
uses: ./.github/workflows/build-package.yml
16+
with:
17+
package_name: mingw-w64-openssl
18+
packages_repository: Windows-on-ARM-Experiments/MINGW-packages
19+
packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }}
20+
dependencies: mingw-w64-cross-zlib
21+
cross_compile: true
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
diff --git a/etc/makepkg_mingw.conf b/etc/makepkg_mingw.conf
2+
--- a/etc/makepkg_mingw.conf
3+
+++ b/etc/makepkg_mingw.conf
4+
@@ -34,15 +34,17 @@
5+
#
6+
7+
if [[ "$MSYSTEM" == "MINGW64" ]]; then
8+
- CARCH="x86_64"
9+
+ CARCH="aarch64"
10+
CHOST="x86_64-w64-mingw32"
11+
MINGW_CHOST="x86_64-w64-mingw32"
12+
MINGW_PREFIX="/mingw64"
13+
MINGW_PACKAGE_PREFIX="mingw-w64-x86_64"
14+
- CC="gcc"
15+
- CXX="g++"
16+
+ CC="aarch64-w64-mingw32-gcc"
17+
+ CXX="aarch64-w64-mingw32-g++"
18+
+ STRIP="aarch64-w64-mingw32-strip"
19+
+ OBJDUMP="aarch64-w64-mingw32-objdump"
20+
CPPFLAGS="-D__USE_MINGW_ANSI_STDIO=1"
21+
- CFLAGS="-march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong"
22+
+ CFLAGS="-O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong"
23+
CXXFLAGS="$CFLAGS"
24+
LDFLAGS=""
25+
elif [[ "$MSYSTEM" == "MINGW32" ]]; then
26+
diff --git a/etc/profile b/etc/profile
27+
--- a/etc/profile
28+
+++ b/etc/profile
29+
@@ -49,7 +49,7 @@
30+
case "${MSYSTEM}" in
31+
MINGW*|CLANG*|UCRT*)
32+
MINGW_MOUNT_POINT="${MINGW_PREFIX}"
33+
- PATH="${MINGW_MOUNT_POINT}/bin:${MSYS2_PATH}${ORIGINAL_PATH:+:${ORIGINAL_PATH}}"
34+
+ PATH="/opt/bin:${MINGW_MOUNT_POINT}/bin:${MSYS2_PATH}${ORIGINAL_PATH:+:${ORIGINAL_PATH}}"
35+
PKG_CONFIG_PATH="${MINGW_MOUNT_POINT}/lib/pkgconfig:${MINGW_MOUNT_POINT}/share/pkgconfig"
36+
PKG_CONFIG_SYSTEM_INCLUDE_PATH="${MINGW_MOUNT_POINT}/include"
37+
PKG_CONFIG_SYSTEM_LIBRARY_PATH="${MINGW_MOUNT_POINT}/lib"
38+
diff --git a/usr/share/makepkg/tidy/strip.sh b/usr/share/makepkg/tidy/strip.sh
39+
--- a/usr/share/makepkg/tidy/strip.sh
40+
+++ b/usr/share/makepkg/tidy/strip.sh
41+
@@ -85,7 +85,7 @@
42+
strip_file(){
43+
local binary=$1; shift
44+
local tempfile=$(mktemp "$binary.XXXXXX")
45+
- if strip "$@" "$binary" -o "$tempfile"; then
46+
+ if $STRIP "$@" "$binary" -o "$tempfile"; then
47+
cat "$tempfile" > "$binary"
48+
fi
49+
rm -f "$tempfile"
50+
@@ -95,7 +95,7 @@
51+
local binary=$1;
52+
53+
local tempfile=$(mktemp "$binary.XXXXXX")
54+
- if strip -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 "$binary" -o "$tempfile"; then
55+
+ if $STRIP -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 "$binary" -o "$tempfile"; then
56+
cat "$tempfile" > "$binary"
57+
fi
58+
rm -f "$tempfile"
59+
@@ -176,7 +176,7 @@
60+
case "${binary##*/}" in
61+
*.dll|*.exe|*.sfx|*.so|*.so.[0-9]*|*.oct|*.cmxs) ;;
62+
# make sure this isn't some oddly named DLL
63+
- *) if LANG=en_US.UTF-8 LC_ALL=C objdump -f "${binary}" | grep -Eq '^start address 0x(0000000[01])?00401[0-9a-e][0-9a-e]0'
64+
+ *) if LANG=en_US.UTF-8 LC_ALL=C $OBJDUMP -f "${binary}" | grep -Eq '^start address 0x(0000000[01])?00401[0-9a-e][0-9a-e]0'
65+
then
66+
mv "${binary}" "${binary}.exe"
67+
binary+=.exe

0 commit comments

Comments
 (0)