Skip to content

Commit 3371eae

Browse files
author
Filippo Cremonese
committed
Update toolchain/win{32,64}/mingw64
1 parent 3ed87db commit 3371eae

File tree

5 files changed

+115
-63
lines changed

5 files changed

+115
-63
lines changed

.orchestra/config/components/llvm.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ builds:
5858
if test "$RUN_TESTS" -eq 1; then
5959
(@= ninja @) check-all
6060
fi
61-
(@- if platform == "windows": @)
62-
ln -s ../../x86_64-w64-mingw32/usr/bin/libwinpthread-1.dll "${TMP_ROOT}${ORCHESTRA_ROOT}/win64/bin/"
63-
(@ end -@)
6461
build_dependencies:
6562
- cmake
6663
- host-cxx-toolchain

.orchestra/config/components/toolchain/arch/win64.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extra_gcc_configure_options:
1414
- --disable-libsanitizer
1515
- --disable-libssp
1616
- --disable-shared
17+
extra_gcc_stage2_configure_options: " --enable-threads=posix --enable-libstdcxx-threads=yes"
1718
dynamic: "0"
1819
#@ end
1920

.orchestra/config/components/toolchain/lib/gcc.lib.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
#@ def gcc_dependencies(stage, toolchain_name, musl_version, uclibc_version, linux_version, mingw64_version):
1313
#@ if stage == 1:
1414
#@ suffixes = ["-headers"]
15-
#@ mingw_builds = ["@headers"]
15+
#@ mingw_suffixes = ["-headers"]
1616
#@ elif stage == 2:
1717
#@ suffixes = ["-headers", "-extra-libraries"]
18-
#@ mingw_builds = [""]
18+
#@ mingw_suffixes = ["-headers", "-base", "-extra-libraries"]
1919
#@ else:
2020
#@ fail("GCC stage must be 1 or 2")
2121
#@ end
@@ -38,8 +38,8 @@
3838
#@ end
3939

4040
#@ if mingw64_version:
41-
#@ for build in mingw_builds:
42-
- toolchain/(@= toolchain_name @)/mingw64(@= build @)
41+
#@ for suffix in mingw_suffixes:
42+
- toolchain/(@= toolchain_name @)/mingw64(@= suffix @)
4343
#@ end
4444
#@ end
4545

@@ -76,6 +76,7 @@
7676
#@ linux_version=None,
7777
#@ mingw64_version=None,
7878
#@ extra_gcc_configure_options="",
79+
#@ extra_gcc_stage2_configure_options="",
7980
#@ gcc_sysroot = None,
8081
#@ extra_gcc_make_variables = "",
8182
#@ ):
@@ -87,7 +88,8 @@
8788
#@ if stage == 1:
8889
#@ build_specific_configure_options = "--enable-languages=c"
8990
#@ elif stage == 2:
90-
#@ build_specific_configure_options = "--enable-languages=c,c++"
91+
#@ build_specific_configure_options = "--enable-languages=c,c++ " + extra_gcc_stage2_configure_options
92+
#@ build_specific_configure_options = build_specific_configure_options.strip()
9193
#@ else:
9294
#@ fail("GCC stage must be 1 or 2")
9395
#@ end

.orchestra/config/components/toolchain/lib/mingw64.lib.yml

Lines changed: 103 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,74 +3,125 @@
33
#@ load("/lib/make.lib.yml", "make")
44
#@ load("/lib/fn_args.lib.yml", "mandatory")
55
#@ load("/lib/assert.lib.yml", "assert")
6+
#@ load("/lib/create_component.lib.yml", "single_build_component")
67

78
#@ load("/components/toolchain/lib/common.lib.yml", "new_gcc_path")
89

910

1011
#@yaml/text-templated-strings
1112
---
12-
#@ def mingw64_build(
13+
#@ def common_install_script(triple=mandatory):
14+
- |
15+
(@= make @)
16+
(@= make @) install
17+
rm -f "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/mingw"
18+
ln -s . "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/mingw"
19+
rm -f "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/(@= triple @)"
20+
ln -s . "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/(@= triple @)"
21+
rm -f "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/sys-include"
22+
ln -s ./include "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/sys-include"
23+
#@ end
24+
25+
#@yaml/text-templated-strings
26+
---
27+
#@ def mingw64_flavors(
28+
#@ toolchain_name=mandatory,
1329
#@ triple=mandatory,
1430
#@ gcc_version=mandatory,
1531
#@ mingw64_version=mandatory,
1632
#@ build_type=mandatory,
17-
#@ ):
18-
19-
#@ assert(build_type in ["headers", "default"])
33+
#@ ):
2034
#@ source_url = "https://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v" + mingw64_version + ".tar.bz2"
35+
headers:
36+
configure: |
37+
extract.sh --into "$BUILD_DIR" "(@= source_url @)"
38+
cd "$BUILD_DIR/mingw-w64-headers"
39+
./configure \
40+
--disable-silent-rules \
41+
--target=(@= triple @) \
42+
--host=(@= triple @) \
43+
--build=x86_64-gentoo-linux-musl \
44+
--prefix="$ORCHESTRA_ROOT/(@= triple @)" \
45+
--enable-sdk \
46+
--enable-secure-api
47+
install: |
48+
cd "$BUILD_DIR/mingw-w64-headers"
49+
(@= common_install_script(triple)[0] @)
2150
22-
configure: |
23-
extract.sh --into "$BUILD_DIR" "(@= source_url @)"
24-
cd "$BUILD_DIR"
25-
(@ if build_type == "default": @)
26-
NEW_GCC_PATH="(@= new_gcc_path(triple=triple, gcc_version=gcc_version) @)"
27-
NEW_GCC=${NEW_GCC_PATH}/(@= triple @)-gcc
28-
export CC="${NEW_GCC}"
29-
export CPPFLAGS="-I${ORCHESTRA_ROOT}/(@= triple @)/usr/include"
30-
export CHOST="(@= triple @)"
31-
(@ end -@)
32-
"$BUILD_DIR/configure" \
33-
--disable-silent-rules \
34-
--target=(@= triple @) \
35-
--with-sysroot=no \
36-
--prefix="$ORCHESTRA_ROOT/(@= triple @)/usr" \
37-
--with-headers \
38-
--enable-sdk \
39-
--without-libraries \
40-
--without-tools \
41-
(@- if build_type == "default": @)
42-
--with-crt \
43-
--host=(@= triple @) \
44-
--disable-idl \
45-
$($NEW_GCC -E -dM - < /dev/null | grep -q __MINGW64__ && echo --disable-lib32 --enable-lib64 || echo --enable-lib32 --disable-lib64)
46-
(@- elif build_type == "headers": @)
47-
--without-crt \
48-
--without-idl
49-
(@- end @)
50-
install: |
51-
cd "$BUILD_DIR"
52-
(@= make @)
53-
(@= make @) install
54-
rm -f "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/mingw"
55-
ln -s usr "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/mingw"
56-
rm -f "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/(@= triple @)"
57-
ln -s usr "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/(@= triple @)"
58-
rm -f usr/include "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/sys-include"
59-
ln -s usr/include "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/sys-include"
51+
base:
52+
configure: |
53+
extract.sh --into "$BUILD_DIR" "(@= source_url @)"
54+
cd "$BUILD_DIR"
55+
NEW_GCC_PATH="(@= new_gcc_path(triple=triple, gcc_version=gcc_version) @)"
56+
NEW_GCC=${NEW_GCC_PATH}/(@= triple @)-gcc
57+
export CC="${NEW_GCC}"
58+
export CPPFLAGS="-I${ORCHESTRA_ROOT}/(@= triple @)/include"
59+
export CHOST="(@= triple @)"
6060
61-
#@ if/end build_type == "default":
62-
dependencies:
63-
- toolchain/win64/gcc~stage1
64-
- toolchain/win64/mingw64~headers
61+
./configure \
62+
--disable-silent-rules \
63+
--target=(@= triple @) \
64+
--host=(@= triple @) \
65+
--build=x86_64-gentoo-linux-musl \
66+
--prefix="$ORCHESTRA_ROOT/(@= triple @)" \
67+
--enable-sdk \
68+
--enable-secure-api \
69+
--with-sysroot=no \
70+
--with-headers \
71+
--with-crt \
72+
--without-libraries \
73+
$($NEW_GCC -E -dM - < /dev/null | grep -q __MINGW64__ && echo --disable-lib32 --enable-lib64 || echo --enable-lib32 --disable-lib64)
74+
install: |
75+
cd "$BUILD_DIR"
76+
(@= common_install_script(triple)[0] @)
77+
# Remove files already installed by mingw64-headers
78+
remove-files-from-other-component.sh "toolchain/(@= toolchain_name @)/mingw64-headers" "${TMP_ROOT}${ORCHESTRA_ROOT}"
79+
dependencies:
80+
- toolchain/(@= toolchain_name @)/gcc~stage1
81+
- toolchain/(@= toolchain_name @)/mingw64-headers
6582

83+
extra-libraries:
84+
configure: |
85+
extract.sh --into "$BUILD_DIR" "(@= source_url @)"
86+
cd "$BUILD_DIR"
87+
NEW_GCC_PATH="(@= new_gcc_path(triple=triple, gcc_version=gcc_version) @)"
88+
NEW_GCC=${NEW_GCC_PATH}/(@= triple @)-gcc
89+
export CC="${NEW_GCC}"
90+
export CPPFLAGS="-I${ORCHESTRA_ROOT}/(@= triple @)/include"
91+
export CHOST="(@= triple @)"
92+
93+
./configure \
94+
--disable-silent-rules \
95+
--target=(@= triple @) \
96+
--host=(@= triple @) \
97+
--build=x86_64-gentoo-linux-musl \
98+
--prefix="$ORCHESTRA_ROOT/(@= triple @)" \
99+
--enable-sdk \
100+
--enable-secure-api \
101+
--with-sysroot=no \
102+
--with-headers \
103+
--with-crt \
104+
--with-libraries=winpthreads \
105+
$($NEW_GCC -E -dM - < /dev/null | grep -q __MINGW64__ && echo --disable-lib32 --enable-lib64 || echo --enable-lib32 --disable-lib64)
106+
install: |
107+
cd "$BUILD_DIR"
108+
(@= common_install_script(triple)[0] @)
109+
110+
mkdir -p "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= toolchain_name @)/bin/"
111+
ln -s ../../(@= triple @)/usr/bin/libwinpthread-1.dll "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= toolchain_name @)/bin/"
112+
113+
# Remove files already installed by mingw64-headers and mingw64-base
114+
remove-files-from-other-component.sh "toolchain/(@= toolchain_name @)/mingw64-headers" "${TMP_ROOT}${ORCHESTRA_ROOT}"
115+
remove-files-from-other-component.sh "toolchain/(@= toolchain_name @)/mingw64-base" "${TMP_ROOT}${ORCHESTRA_ROOT}"
116+
dependencies:
117+
- toolchain/(@= toolchain_name @)/gcc~stage1
118+
- toolchain/(@= toolchain_name @)/mingw64-base
66119
#@ end
67120

68121
#@yaml/text-templated-strings
69122
---
70-
#@ def create_mingw64_component(toolchain_name=mandatory, **kwargs):
71-
license: COPYING
72-
default_build: default
73-
builds:
74-
headers: #@ mingw64_build(build_type="headers", **kwargs)
75-
default: #@ mingw64_build(build_type="default", **kwargs)
123+
#@ def create_mingw64_components(toolchain_name=mandatory, **kwargs):
124+
#@ for type, options in dict(mingw64_flavors(toolchain_name=toolchain_name, **kwargs)).items():
125+
(@= "toolchain/" + toolchain_name + "/mingw64-" + type @): #@ single_build_component(license="COPYING", **options)
126+
#@ end
76127
#@ end

.orchestra/config/components/toolchain/lib/toolchain.lib.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#@ load("/components/toolchain/lib/musl.lib.yml", "create_musl_components")
1010
#@ load("/components/toolchain/lib/uclibc.lib.yml", "create_uclibc_components")
1111
#@ load("/components/toolchain/lib/coreutils.lib.yml", "create_coreutils_component")
12-
#@ load("/components/toolchain/lib/mingw64.lib.yml", "create_mingw64_component")
12+
#@ load("/components/toolchain/lib/mingw64.lib.yml", "create_mingw64_components")
1313
#@ load("/components/toolchain/lib/spec.lib.yml", "create_spec_components")
1414

1515
#@yaml/text-templated-strings
@@ -30,6 +30,7 @@
3030
#@ binutils_sysroot=None,
3131
#@ mingw64_version=None,
3232
#@ extra_gcc_configure_options=None,
33+
#@ extra_gcc_stage2_configure_options="",
3334
#@ extra_binutils_configure_options=None,
3435
#@ extra_gcc_make_variables="",
3536
#@ dynamic=None,
@@ -46,10 +47,10 @@
4647
(@= "toolchain/" + toolchain_name + "/linux-headers" @): #@ create_linux_headers_component(triple=triple, linux_version=linux_version, arch_name=linux_arch_name)
4748

4849
#@ if/end gcc_version:
49-
(@= "toolchain/" + toolchain_name + "/gcc" @): #@ create_gcc_component(toolchain_name=toolchain_name, triple=triple, gcc_sysroot=gcc_sysroot, gcc_version=gcc_version, extra_gcc_configure_options=extra_gcc_configure_options, extra_gcc_make_variables=extra_gcc_make_variables, musl_version=musl_version, uclibc_version=uclibc_version, linux_version=linux_version, mingw64_version=mingw64_version)
50+
(@= "toolchain/" + toolchain_name + "/gcc" @): #@ create_gcc_component(toolchain_name=toolchain_name, triple=triple, gcc_sysroot=gcc_sysroot, gcc_version=gcc_version, extra_gcc_configure_options=extra_gcc_configure_options, extra_gcc_stage2_configure_options=extra_gcc_stage2_configure_options, extra_gcc_make_variables=extra_gcc_make_variables, musl_version=musl_version, uclibc_version=uclibc_version, linux_version=linux_version, mingw64_version=mingw64_version)
5051

5152
#@ if/end mingw64_version:
52-
(@= "toolchain/" + toolchain_name + "/mingw64" @): #@ create_mingw64_component(toolchain_name=toolchain_name, triple=triple, mingw64_version=mingw64_version, gcc_version=gcc_version)
53+
_: #@ template.replace(create_mingw64_components(toolchain_name=toolchain_name, triple=triple, mingw64_version=mingw64_version, gcc_version=gcc_version))
5354

5455
#@ if/end musl_version:
5556
_: #@ template.replace(create_musl_components(triple=triple, musl_version=musl_version, toolchain_name=toolchain_name, gcc_version=gcc_version))

0 commit comments

Comments
 (0)