Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/Dockerfile.i686-pc-windows-gnu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04 AS cross-base
FROM ubuntu:24.04 AS cross-base
ENV DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand Down
12 changes: 10 additions & 2 deletions docker/Dockerfile.x86_64-pc-windows-gnu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04 AS cross-base
FROM ubuntu:24.04 AS cross-base
ENV DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -17,6 +17,12 @@ RUN /wine.sh

RUN apt-get update && apt-get install --assume-yes --no-install-recommends g++-mingw-w64-x86-64 gfortran-mingw-w64-x86-64

# Ensure we compile with the POSIX versions of mingw
RUN update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix && \
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix && \
update-alternatives --set x86_64-w64-mingw32-gfortran /usr/bin/x86_64-w64-mingw32-gfortran-posix 2>/dev/null || true && \
update-alternatives --set x86_64-w64-mingw32-gcj /usr/bin/x86_64-w64-mingw32-gcj-posix 2>/dev/null || true

# run-detectors are responsible for calling the correct interpreter for exe
# files. For some reason it does not work inside a docker container (it works
# fine in the host). So we replace the usual paths of run-detectors to run wine
Expand Down Expand Up @@ -49,4 +55,6 @@ ENV CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc"$CROS
CROSS_CMAKE_SYSTEM_NAME=Windows \
CROSS_CMAKE_SYSTEM_PROCESSOR=AMD64 \
CROSS_CMAKE_CRT=gnu \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -m64"
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -m64" \
PKG_CONFIG_ALLOW_CROSS=1 \
PKG_CONFIG_PATH="/usr/x86_64-w64-mingw32/lib/pkgconfig/"
133 changes: 81 additions & 52 deletions docker/mingw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ main() {
# that are compatible with rust.

# Enable source
sed -i 's/# deb-src/deb-src/g' /etc/apt/sources.list
sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
apt-get update

# Install mingw (with sjlj exceptions) to get the dependencies right
Expand All @@ -30,90 +30,123 @@ main() {

pushd "${td}"

apt-get source gcc-mingw-w64-i686
apt-get source gcc-mingw-w64
pushd gcc-mingw-w64-*

# We are using dwarf exceptions instead of sjlj
sed -i -e 's/libgcc_s_sjlj-1/libgcc_s_dw2-1/g' debian/gcc-mingw-w64-i686.install.in

# Only build i686 packages (disable x86_64)
patch -p0 <<'EOF'
--- debian/control.template.ori 2018-03-12 16:25:30.000000000 +0000
+++ debian/control.template 2018-03-12 16:25:30.000000000 +0000
--- debian/control.template.ori 2026-03-11 11:58:47.868983007 +0000
+++ debian/control.template 2026-03-11 11:59:56.789698095 +0000
@@ -1,7 +1,6 @@
Package: @@PACKAGE@@-mingw-w64
Architecture: all
Depends: @@PACKAGE@@-mingw-w64-i686,
- @@PACKAGE@@-mingw-w64-x86-64,
${misc:Depends}
Recommends: @@RECOMMENDS@@
Built-Using: gcc-@@VERSION@@ (= ${gcc:Version})
@@ -32,22 +31,3 @@
This package contains the @@LANGUAGE@@ compiler, supporting
cross-compiling to 32-bit MinGW-w64 targets.
Description: GNU @@LANGUAGE@@ compiler for MinGW-w64
@@ -66,57 +65,3 @@
cross-compiling to 32-bit MinGW-w64 targets, using the Win32
threading model.
Build-Profiles: <!stage1>
-
-Package: @@PACKAGE@@-mingw-w64-x86-64
-Architecture: any
-Depends: @@DEPENDS64@@,
-Architecture: all
-Depends: @@PACKAGE@@-mingw-w64-x86-64-posix,
- @@PACKAGE@@-mingw-w64-x86-64-win32,
- ${misc:Depends}
-Description: GNU @@LANGUAGE@@ compiler for MinGW-w64 targeting Win64
- MinGW-w64 provides a development and runtime environment for 32- and
- 64-bit (x86 and x64) Windows applications using the Windows API and
- the GNU Compiler Collection (gcc).
- .
- This metapackage provides the @@LANGUAGE@@ compiler, supporting
- cross-compiling to 64-bit MinGW-w64 targets.
-Build-Profiles: <!stage1>
-
-Package: @@PACKAGE@@-mingw-w64-x86-64-posix
-Architecture: @@ARCH@@
-Depends: @@DEPENDS64P@@,
- ${misc:Depends},
- ${shlibs:Depends}
-Suggests: gcc-@@VERSION@@-locales (>= ${local:Version})
-Breaks: @@BREAKS64@@
-Conflicts: @@CONFLICTS64@@
-Replaces: @@REPLACES64@@
-Built-Using: gcc-@@VERSION@@ (= ${gcc:Version})
-Description: GNU @@LANGUAGE@@ compiler for MinGW-w64 targeting Win64
-Description: GNU @@LANGUAGE@@ compiler for MinGW-w64, Win64/POSIX
- MinGW-w64 provides a development and runtime environment for 32- and
- 64-bit (x86 and x64) Windows applications using the Windows API and
- the GNU Compiler Collection (gcc).
- .
- This package contains the @@LANGUAGE@@ compiler, supporting
- cross-compiling to 64-bit MinGW-w64 targets.
- cross-compiling to 64-bit MinGW-w64 targets, using the POSIX
- threading model.
-Build-Profiles: <!stage1>
-
-Package: @@PACKAGE@@-mingw-w64-x86-64-win32
-Architecture: @@ARCH@@
-Depends: @@DEPENDS64W@@,
- ${misc:Depends},
- ${shlibs:Depends}
-Suggests: gcc-@@VERSION@@-locales (>= ${local:Version})
-Breaks: @@BREAKS64@@
-Conflicts: @@CONFLICTS64@@
-Replaces: @@REPLACES64@@
-Built-Using: gcc-@@VERSION@@ (= ${gcc:Version})
-Description: GNU @@LANGUAGE@@ compiler for MinGW-w64, Win64/Win32
- MinGW-w64 provides a development and runtime environment for 32- and
- 64-bit (x86 and x64) Windows applications using the Windows API and
- the GNU Compiler Collection (gcc).
- .
- This package contains the @@LANGUAGE@@ compiler, supporting
- cross-compiling to 64-bit MinGW-w64 targets, using the Win32
- threading model.
-Build-Profiles: <!stage1>
EOF

# Disable build of fortran,objc,obj-c++ and use configure options
# --disable-sjlj-exceptions --with-dwarf2
patch -p0 <<'EOF'
--- debian/rules.ori 2018-03-12 16:25:30.000000000 +0000
+++ debian/rules 2018-03-12 16:25:30.000000000 +0000
@@ -58,7 +58,7 @@
INSTALL_TARGET := install-gcc
--- debian/rules.ori 2026-03-11 12:43:35.486834587 +0000
+++ debian/rules 2026-03-11 12:43:55.873331683 +0000
@@ -26,7 +26,7 @@
target_version := 13
target32 := i686-w64-mingw32
target64 := x86_64-w64-mingw32
-targets := $(target32) $(target64)
+targets := $(target32)
threads := posix win32
gnat_arches := alpha amd64 arm64 armel armhf hppa i386 mips64el mipsel ppc64 ppc64el riscv64 s390x sh4 sparc64 x32

@@ -289,11 +289,6 @@
-B$(build_dir)/$(target32)-$$threads \
-D$(upstream_dir) -- \
$(CONFFLAGS) --disable-sjlj-exceptions --with-dwarf2; \
- target=$(target64); \
- dh_auto_configure \
- -B$(build_dir)/$(target64)-$$threads \
- -D$(upstream_dir) -- \
- $(CONFFLAGS); \
done
else
# Build the full GCC.
- languages := c,c++,fortran,objc,obj-c++,ada
+ languages := c,c++
BUILD_TARGET :=
INSTALL_TARGET := install install-lto-plugin
set -e; \
@@ -301,12 +296,7 @@
dh_auto_configure \
-B$(build_dir)/$(target32) \
-D$(upstream_dir) -- \
- $(CONFFLAGS) --disable-sjlj-exceptions --with-dwarf2; \
- target=$(target64); \
- dh_auto_configure \
- -B$(build_dir)/$(target64) \
- -D$(upstream_dir) -- \
- $(CONFFLAGS)
+ $(CONFFLAGS) --disable-sjlj-exceptions --with-dwarf2;
endif
@@ -85,7 +85,7 @@
sed -i 's/@@VERSION@@/$(target_version)/g' debian/control
touch $@

-targets := i686-w64-mingw32 x86_64-w64-mingw32
+targets := i686-w64-mingw32
threads := posix win32

# Hardening on the host, none on the target
@@ -220,6 +220,10 @@
# Enable libatomic
CONFFLAGS += \
--enable-libatomic
+# Enable dwarf exceptions
+CONFFLAGS += \
+ --disable-sjlj-exceptions \
+ --with-dwarf2
# Enable experimental::filesystem and std::filesystem
CONFFLAGS += \
--enable-libstdcxx-filesystem-ts=yes

EOF

# Need symlinks for specific autoconf versions, since it
# attempts to use autoconf2.69 and autom4te2.69.
ln -s /usr/bin/autoconf /usr/bin/autoconf2.69
ln -s /usr/bin/autom4te /usr/bin/autom4te2.69

# Build the modified mingw packages
MAKEFLAGS=--silent dpkg-buildpackage -nc -B --jobs=auto

Expand All @@ -127,10 +160,6 @@ EOF

rm -rf "${td}"
rm "${0}"

# Unlink our temporary aliases
unlink /usr/bin/autoconf2.69
unlink /usr/bin/autom4te2.69
}

main "${@}"
8 changes: 4 additions & 4 deletions docker/wine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -euo pipefail
. lib.sh

main() {
local version="9.0.0.0~focal-1"
local version="11.0.0.0~noble-1"
install_packages wget

dpkg --add-architecture i386
Expand All @@ -23,9 +23,9 @@ main() {
mkdir -p /etc/apt/keyrings
mv winehq.key /etc/apt/keyrings/winehq-archive.key

wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/focal/winehq-focal.sources
mv winehq-focal.sources /etc/apt/sources.list.d/
sed -i s@/usr/share/keyrings/@/etc/apt/keyrings/@ /etc/apt/sources.list.d/winehq-focal.sources || true
wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/noble/winehq-noble.sources
mv winehq-noble.sources /etc/apt/sources.list.d/
sed -i s@/usr/share/keyrings/@/etc/apt/keyrings/@ /etc/apt/sources.list.d/winehq-noble.sources || true

# winehq requires all the dependencies to be manually specified
# if we're not using the latest version of a given major version.
Expand Down
Loading