Skip to content

Commit 01c9f7c

Browse files
committed
Changes needed to build full Cygwin package with cross-compiler
1 parent 6103a96 commit 01c9f7c

File tree

15 files changed

+328
-13
lines changed

15 files changed

+328
-13
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
set(CMAKE_SYSTEM_NAME Windows)
2+
set(CMAKE_SYSTEM_PROCESSOR ARM64)
3+
set(CMAKE_C_COMPILER aarch64-pc-cygwin-gcc)
4+
set(CMAKE_CXX_COMPILER aarch64-pc-cygwin-g++)
5+
set(CMAKE_RC_COMPILER aarch64-pc-cygwin-windres)
6+
set(CMAKE_RANLIB aarch64-pc-cygwin-ranlib)
7+
set(CMAKE_AR aarch64-pc-cygwin-ar)
8+
set(CMAKE_C_FLAGS_INIT "-D_WIN64")
9+
set(CMAKE_CXX_FLAGS_INIT "-D_WIN64")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set(CMAKE_SYSTEM_NAME Windows)
2+
set(CMAKE_SYSTEM_PROCESSOR x86_64)
3+
set(CMAKE_C_COMPILER x86_64-pc-cygwin-gcc)
4+
set(CMAKE_CXX_COMPILER x86_64-pc-cygwin-g++)
5+
set(CMAKE_RC_COMPILER x86_64-pc-cygwin-windres)
6+
set(CMAKE_RANLIB x86_64-pc-cygwin-ranlib)
7+
set(CMAKE_AR x86_64-pc-cygwin-ar)

.github/scripts/binutils/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ if [[ "$RUN_CONFIG" = 1 ]] || [[ ! -f "$BINUTILS_BUILD_PATH/Makefile" ]]; then
2020
*cygwin*)
2121
# Compared to the upstream recipe:
2222
# ADDED: --with-sysroot to avoid using the host sysroot.
23+
# ADDED: --disable-nls to avoid dependency on gettext.
2324
# CHANGED: --enable-shared to --disable-shared to allow easier transfer
2425
# the produced host binaries across different build environments.
2526
TARGET_OPTIONS="$TARGET_OPTIONS \
2627
--enable-static \
2728
--disable-shared \
2829
--enable-host-shared \
2930
--enable-install-libiberty \
31+
--disable-nls \
3032
--with-sysroot=$TOOLCHAIN_PATH \
3133
--with-build-sysroot=$TOOLCHAIN_PATH \
3234
--with-system-zlib \

.github/scripts/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ $ROOT_PATH/.github/scripts/toolchain/build-gcc.sh
5454
if [[ "$PLATFORM" =~ mingw ]]; then
5555
$ROOT_PATH/.github/scripts/toolchain/build-mingw.sh
5656
fi
57+
if [[ "$PLATFORM" =~ (mingw|cygwin) ]]; then
58+
$ROOT_PATH/.github/scripts/toolchain/build-zlib.sh
59+
fi
5760
if [[ "$PLATFORM" =~ cygwin ]]; then
61+
$ROOT_PATH/.github/scripts/toolchain/build-intl.sh
62+
$ROOT_PATH/.github/scripts/toolchain/build-iconv.sh
63+
$ROOT_PATH/.github/scripts/toolchain/build-binutils-libs.sh
5864
$ROOT_PATH/.github/scripts/toolchain/build-cygwin.sh 2
5965
fi
6066

.github/scripts/config.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ DEJAGNU_FILE=${DEJAGNU_FILE:-$ROOT_PATH/.github/scripts/toolchain/site.exp}
6969
OPENBLAS_REPO=${OPENBLAS_REPO:-OpenMathLib/OpenBLAS}
7070
OPENBLAS_BRANCH=${OPENBLAS_BRANCH:-develop}
7171

72-
ZLIB_REPO=${ZLIB_REPO:-madler/zlib}
73-
ZLIB_BRANCH=${ZLIB_BRANCH:-master}
72+
ZLIB_REPO=${ZLIB_REPO:-Windows-on-ARM-Experiments/zlib}
73+
ZLIB_BRANCH=${ZLIB_BRANCH:-woarm64}
7474
ZLIB_PATH=${ZLIB_PATH:-~/zlib}
7575
ZLIB_TESTS_PATH=${ZLIB_TESTS_PATH:-~/zlib-tests}
7676

@@ -97,6 +97,14 @@ BASH_REPO=${BASH_REPO:-Windows-on-ARM-Experiments/bash}
9797
BASH_BRANCH=${BASH_BRANCH:-woarm64}
9898
BASH_PATH=${BASH_PATH:-~/$TARGET/bash}
9999

100+
GETTEXT_REPO=${GETTEXT_REPO:-Windows-on-ARM-Experiments/gettext}
101+
GETTEXT_BRANCH=${GETTEXT_BRANCH:-woarm64}
102+
GETTEXT_PATH=${GETTEXT_PATH:-~/gettext}
103+
104+
ICONV_REPO=${ICONV_REPO:-Windows-on-ARM-Experiments/libiconv}
105+
ICONV_BRANCH=${ICONV_BRANCH:-woarm64}
106+
ICONV_PATH=${ICONV_PATH:-~/libiconv}
107+
100108
TESTS_PATH=${TESTS_PATH:-$ROOT_PATH/tests/build/bin/}
101109
TESTS_PACKAGE_NAME=${TESTS_PACKAGE_NAME:-$TOOLCHAIN_NAME-tests.tar.gz}
102110

.github/scripts/install-dependencies.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ echo "::group::Install Dependencies"
1414
build-essential \
1515
busybox \
1616
ccache \
17+
cmake \
1718
dejagnu \
1819
docbook2x \
1920
flex \
21+
gettext \
2022
gdc \
23+
gperf \
24+
groff \
2125
jq \
2226
libc6-dev-arm64-cross \
2327
libc6-dev-amd64-cross \
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
3+
source `dirname ${BASH_SOURCE[0]}`/../config.sh
4+
5+
# Should be maintaned as close to https://cygwin.com/cgit/cygwin-packages/binutils/tree/binutils.cygport as possible.
6+
7+
BINUTILS_SOURCE_PATH=$SOURCE_PATH/binutils
8+
BINUTILS_BUILD_PATH=$BUILD_PATH/binutils-libs
9+
10+
mkdir -p $BINUTILS_BUILD_PATH
11+
cd $BINUTILS_BUILD_PATH
12+
13+
if [[ "$RUN_CONFIG" = 1 ]] || [[ ! -f "$BINUTILS_BUILD_PATH/Makefile" ]]; then
14+
echo "::group::Configure binutils libraries"
15+
rm -rf $BINUTILS_BUILD_PATH/*
16+
17+
if [[ "$DEBUG" = 1 ]]; then
18+
HOST_OPTIONS="$HOST_OPTIONS \
19+
--enable-debug"
20+
fi
21+
22+
# ADDED: Disabling all binaries:
23+
# --disable-gdbserver
24+
# --disable-binutils
25+
# --disable-ld
26+
# --disable-gas
27+
# --disable-gprof
28+
# --disable-gold
29+
$BINUTILS_SOURCE_PATH/configure \
30+
--prefix=$TOOLCHAIN_PATH/$TARGET \
31+
--build=$BUILD \
32+
--host=$TARGET \
33+
--target=$TARGET \
34+
--disable-gdb \
35+
--disable-libdecnumber \
36+
--disable-readline \
37+
--disable-sim \
38+
--enable-install-libiberty \
39+
--with-system-zlib \
40+
--with-gcc-major-version-only \
41+
--disable-shared \
42+
--disable-host-shared \
43+
--disable-gdbserver \
44+
--disable-binutils \
45+
--disable-ld \
46+
--disable-gas \
47+
--disable-gprof \
48+
--disable-gold \
49+
$HOST_OPTIONS \
50+
$TARGET_OPTIONS
51+
echo "::endgroup::"
52+
fi
53+
54+
echo "::group::Build binutils libraries"
55+
make $BUILD_MAKE_OPTIONS
56+
echo "::endgroup::"
57+
58+
if [[ "$RUN_INSTALL" = 1 ]]; then
59+
echo "::group::Install binutils libraries"
60+
make install
61+
62+
if [[ "$DELETE_BUILD" = 1 ]]; then
63+
rm -rf $BINUTILS_BUILD_PATH
64+
fi
65+
echo "::endgroup::"
66+
fi
67+
68+
echo 'Success!'
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
source `dirname ${BASH_SOURCE[0]}`/../config.sh
4+
5+
ICONV_SOURCE_PATH=$SOURCE_PATH/iconv
6+
ICONV_BUILD_PATH=$BUILD_PATH/iconv
7+
8+
mkdir -p $ICONV_BUILD_PATH
9+
cd $ICONV_BUILD_PATH
10+
11+
if [[ "$RUN_CONFIG" = 1 ]] || [[ ! -f "$ICONV_BUILD_PATH/Makefile" ]]; then
12+
echo "::group::Configure iconv"
13+
rm -rf $ICONV_BUILD_PATH/*
14+
15+
(cd $ICONV_SOURCE_PATH && ./autopull.sh && ./autogen.sh)
16+
17+
if [[ "$DEBUG" = 1 ]]; then
18+
HOST_OPTIONS="$HOST_OPTIONS \
19+
--enable-debug"
20+
fi
21+
22+
$ICONV_SOURCE_PATH/configure \
23+
--prefix=$TOOLCHAIN_PATH \
24+
--build=$BUILD \
25+
--host=$TARGET \
26+
--enable-static \
27+
$HOST_OPTIONS \
28+
$TARGET_OPTIONS
29+
echo "::endgroup::"
30+
fi
31+
32+
echo "::group::Build iconv"
33+
(cd $ICONV_BUILD_PATH && make $BUILD_MAKE_OPTIONS)
34+
echo "::endgroup::"
35+
36+
if [[ "$RUN_INSTALL" = 1 ]]; then
37+
echo "::group::Install iconv"
38+
(cd $ICONV_BUILD_PATH && make install)
39+
if [[ "$DELETE_BUILD" = 1 ]]; then
40+
rm -rf $ICONV_BUILD_PATH
41+
fi
42+
echo "::endgroup::"
43+
fi
44+
45+
echo 'Success!'
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
source `dirname ${BASH_SOURCE[0]}`/../config.sh
4+
5+
GETTEXT_SOURCE_PATH=$SOURCE_PATH/gettext
6+
INTL_BUILD_PATH=$BUILD_PATH/intl
7+
8+
mkdir -p $INTL_BUILD_PATH
9+
cd $INTL_BUILD_PATH
10+
11+
if [[ "$RUN_CONFIG" = 1 ]] || [[ ! -f "$INTL_BUILD_PATH/Makefile" ]]; then
12+
echo "::group::Configure gettext"
13+
rm -rf $INTL_BUILD_PATH/*
14+
15+
(cd $GETTEXT_SOURCE_PATH && ./autopull.sh && ./autogen.sh)
16+
17+
if [[ "$DEBUG" = 1 ]]; then
18+
HOST_OPTIONS="$HOST_OPTIONS \
19+
--enable-debug"
20+
fi
21+
22+
$GETTEXT_SOURCE_PATH/configure \
23+
--prefix=$TOOLCHAIN_PATH \
24+
--build=$BUILD \
25+
--host=$TARGET \
26+
--with-included-gettext \
27+
$HOST_OPTIONS \
28+
$TARGET_OPTIONS
29+
echo "::endgroup::"
30+
fi
31+
32+
echo "::group::Build intl"
33+
(cd $INTL_BUILD_PATH/gettext-runtime/intl && make $BUILD_MAKE_OPTIONS)
34+
echo "::endgroup::"
35+
36+
if [[ "$RUN_INSTALL" = 1 ]]; then
37+
echo "::group::Install intl"
38+
(cd $INTL_BUILD_PATH/gettext-runtime/intl && make install)
39+
if [[ "$DELETE_BUILD" = 1 ]]; then
40+
rm -rf $INTL_BUILD_PATH
41+
fi
42+
echo "::endgroup::"
43+
fi
44+
45+
echo 'Success!'

.github/scripts/toolchain/build-mingw-crt.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,25 @@ if [[ "$RUN_INSTALL" = 1 ]]; then
7777
case "$PLATFORM" in
7878
*cygwin*)
7979
pushd $TOOLCHAIN_PATH/$TARGET/lib
80-
ln -fs w32api/libkernel32.a .
81-
ln -fs w32api/libuser32.a .
8280
ln -fs w32api/libadvapi32.a .
83-
ln -fs w32api/libshell32.a .
84-
ln -fs w32api/libgdi32.a .
8581
ln -fs w32api/libcomdlg32.a .
86-
ln -fs w32api/libntdll.a .
82+
ln -fs w32api/libdbghelp.a .
83+
ln -fs w32api/libgdi32.a .
84+
ln -fs w32api/libkernel32.a .
8785
ln -fs w32api/libnetapi32.a .
88-
ln -fs w32api/libpsapi.a .
89-
ln -fs w32api/libuserenv.a .
9086
ln -fs w32api/libnetapi32.a .
91-
ln -fs w32api/libdbghelp.a .
87+
ln -fs w32api/libntdll.a .
88+
ln -fs w32api/libole32.a .
89+
ln -fs w32api/liboleaut32.a .
9290
ln -fs w32api/libonecore.a .
9391
ln -fs w32api/libpdh.a .
92+
ln -fs w32api/libpsapi.a .
93+
ln -fs w32api/libshell32.a .
94+
ln -fs w32api/libuser32.a .
95+
ln -fs w32api/libuserenv.a .
96+
ln -fs w32api/libuuid.a .
9497
ln -fs w32api/libwinmm.a .
98+
ln -fs w32api/libwinspool.a .
9599
popd
96100
;;
97101
esac

0 commit comments

Comments
 (0)