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
61 changes: 59 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ ARG NASM_VERSION=2.15.05
ARG PDCURSES_VERSION=3.9
ARG CPPCHECK_VERSION=2.10
ARG VIM_VERSION=9.0
ARG GIT_VERSION=2.41.0
ARG CURL_VERSION=8.1.2
ARG ZLIB_VERSION=1.2.13

RUN apt-get update && apt-get install --yes --no-install-recommends \
build-essential curl libgmp-dev libmpc-dev libmpfr-dev m4 zip
Expand All @@ -40,7 +43,10 @@ RUN curl --insecure --location --remote-name-all --remote-header-name \
https://github.com/universal-ctags/ctags/archive/refs/tags/v$CTAGS_VERSION.tar.gz \
https://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v$MINGW_VERSION.tar.bz2 \
https://downloads.sourceforge.net/project/pdcurses/pdcurses/$PDCURSES_VERSION/PDCurses-$PDCURSES_VERSION.tar.gz \
https://github.com/danmar/cppcheck/archive/$CPPCHECK_VERSION.tar.gz
https://github.com/danmar/cppcheck/archive/$CPPCHECK_VERSION.tar.gz \
https://mirrors.edge.kernel.org/pub/software/scm/git/git-$GIT_VERSION.tar.xz \
https://curl.se/download/curl-$CURL_VERSION.tar.bz2 \
https://zlib.net/zlib-$ZLIB_VERSION.tar.xz
COPY src/SHA256SUMS $PREFIX/src/
RUN sha256sum -c $PREFIX/src/SHA256SUMS \
&& tar xJf binutils-$BINUTILS_VERSION.tar.xz \
Expand All @@ -58,7 +64,10 @@ RUN sha256sum -c $PREFIX/src/SHA256SUMS \
&& tar xzf PDCurses-$PDCURSES_VERSION.tar.gz \
&& tar xJf nasm-$NASM_VERSION.tar.xz \
&& tar xjf vim-$VIM_VERSION.tar.bz2 \
&& tar xzf cppcheck-$CPPCHECK_VERSION.tar.gz
&& tar xzf cppcheck-$CPPCHECK_VERSION.tar.gz \
&& tar xJf git-$GIT_VERSION.tar.xz \
&& tar xjf curl-$CURL_VERSION.tar.bz2 \
&& tar xJf zlib-$ZLIB_VERSION.tar.xz
COPY src/w64devkit.c src/w64devkit.ico \
src/alias.c src/debugbreak.c src/pkg-config.c \
$PREFIX/src/
Expand Down Expand Up @@ -464,6 +473,54 @@ RUN cat $PREFIX/src/cppcheck-*.patch | patch -p1 \
-o $PREFIX/bin/cppcheck.exe \
$PREFIX/src/alias.c -lkernel32

WORKDIR /zlib-$ZLIB_VERSION
RUN CC=$ARCH-gcc AR=$ARCH-ar RANLIB=$ARCH-ranlib CFLAGS="-Os" LDFLAGS="-s" \
./configure --prefix=/ --static \
&& make -j$(nproc) \
&& make install DESTDIR=/deps \
&& make install DESTDIR=tmp \
&& mkdir -p $PREFIX/lib/ \
&& cp -r tmp/lib/* $PREFIX/lib/

WORKDIR /curl-$CURL_VERSION
RUN ./configure \
--host=$ARCH \
--prefix=/deps \
--with-schannel \
CFLAGS="-Os" \
LDFLAGS="-s" \
&& make -j$(nproc) \
&& make install \
&& cp /deps/bin/libcurl* $PREFIX/bin/

WORKDIR /git-$GIT_VERSION
COPY src/git-*.patch $PREFIX/src/
# Make and install at the same time to avoid repeating arguments
RUN cat $PREFIX/src/git-*.patch | patch -p1 \
&& make \
CC=$ARCH-gcc \
WINDRES=$ARCH-windres \
CURL_CONFIG=/deps/bin/curl-config \
INSTALL=/usr/bin/install \
DEFAULT_PAGER=less.exe \
DEFAULT_EDITOR=vi.bat \
NO_OPENSSL=1 \
NO_ICONV=1 \
NO_REGEX=1 \
NO_GETTEXT=1 \
NO_TCLTK=1 \
NO_GITWEB=1 \
MSYSTEM=MINGW64 \
CFLAGS="-Os -I/deps/include/" \
LDFLAGS="-s -L/deps/lib/" \
prefix=/ \
DESTDIR=$PREFIX \
install -j$(nproc)

# Git creates one 3Mb executable for each command; they should be symlinks.
WORKDIR $PREFIX/libexec/git-core
RUN bash -c 'for i in $(md5sum git-*.exe | grep "$(md5sum git.exe | cut -f 1 -d " ")" | cut -d " " -f 3); do rm $i; $ARCH-gcc -DEXE=git.exe -DCMD=$i -Os -fno-asynchronous-unwind-tables -Wl,--gc-sections -s -nostdlib -o $i $PREFIX/src/alias.c -lkernel32; done'

# Pack up a release

WORKDIR /
Expand Down
3 changes: 3 additions & 0 deletions src/SHA256SUMS
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
44321f9b4d8af0eb68152c2e5d9ae4d8d72fd118e2f135040a92f68d174b32b3 busybox-w32-FRP-5007-g82accfc19.tgz
785dcbf711048dfe43ae920b6eff2eeebb4a096e88188a40e173ca4c030f57c3 cppcheck-2.10.tar.gz
71229a73f25529c9e3dabb2cb7310c55405d31caee8e8a9ab5c71b2406d4005a ctags-6.0.0.tar.gz
b54974d32fd610acace92e3df1f643144015ac65847f0a041fdc17db6f43f243 curl-8.1.2.tar.bz2
ef2420f0232c087801abf705e89ae65f6257df6b7931d37846a193ef2e8cdcbe expat-2.5.0.tar.xz
61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86 gcc-13.1.0.tar.xz
115ad5c18d69a6be2ab15882d365dda2a2211c14f480b3502c6eba576e2e95a0 gdb-13.1.tar.xz
e748bafd424cfe80b212cbc6f1bbccc3a47d4862fb1eb7988877750478568040 git-2.41.0.tar.xz
fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2 gmp-6.2.1.tar.xz
8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313 libiconv-1.17.tar.gz
581f4d4e872da74b3941c874215898a7d35802f03732bdccee1d4a7979105d18 make-4.4.tar.gz
Expand All @@ -14,3 +16,4 @@ bd0ea1633bd830204cc23a696889335e9d4a32b8619439ee17f22188695fcc5f mingw-w64-v11.
3caf6729c1073bf96629b57cee31eeb54f4f8129b01902c73428836550b30a3f nasm-2.15.05.tar.xz
590dbe0f5835f66992df096d3602d0271103f90cf8557a5d124f693c2b40d7ec PDCurses-3.9.tar.gz
a6456bc154999d83d0c20d968ac7ba6e7df0d02f3cb6427fb248660bacfb336e vim-9.0.tar.bz2
d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98 zlib-1.2.13.tar.xz
74 changes: 74 additions & 0 deletions src/git-mingw.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
diff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c
index a4e33768f4..438af8f818 100644
--- a/compat/win32/trace2_win32_process_info.c
+++ b/compat/win32/trace2_win32_process_info.c
@@ -3,8 +3,8 @@
#include "../../repository.h"
#include "../../trace2.h"
#include "lazyload.h"
-#include <Psapi.h>
-#include <tlHelp32.h>
+#include <psapi.h>
+#include <tlhelp32.h>

/*
* An arbitrarily chosen value to limit the size of the ancestor
diff --git a/config.mak.uname b/config.mak.uname
index 64c44db805..0dd2b673f2 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -4,7 +4,7 @@
# Microsoft's Safe Exception Handling in libraries (such as zlib).
# Typically required for VS2013+/32-bit compilation on Vista+ versions.

-uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
+uname_S := MINGW
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
@@ -677,7 +677,7 @@ ifeq ($(uname_S),MINGW)
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
- RC = windres -O coff
+ RC = $(WINDRES) -O coff
NATIVE_CRLF = YesPlease
X = .exe
# MSys2
@@ -689,12 +689,12 @@ ifeq ($(uname_S),MINGW)
BASIC_LDFLAGS += -Wl,--dynamicbase
endif
ifeq (MINGW32,$(MSYSTEM))
- prefix = /mingw32
+ #prefix = /mingw32
HOST_CPU = i686
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
endif
ifeq (MINGW64,$(MSYSTEM))
- prefix = /mingw64
+ #prefix = /mingw64
HOST_CPU = x86_64
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
else
@@ -709,7 +709,7 @@ ifeq ($(uname_S),MINGW)
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
USE_GETTEXT_SCHEME = fallthrough
- USE_LIBPCRE = YesPlease
+ #USE_LIBPCRE = YesPlease
USE_NED_ALLOCATOR = YesPlease
ifeq (/mingw64,$(subst 32,64,$(prefix)))
# Move system config into top-level /etc/
diff --git a/wrapper.c b/wrapper.c
index 67f5f5dbe1..5dc48e815a 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -17,7 +17,7 @@ static intmax_t count_fsync_hardware_flush;
#ifdef HAVE_RTLGENRANDOM
/* This is required to get access to RtlGenRandom. */
#define SystemFunction036 NTAPI SystemFunction036
-#include <NTSecAPI.h>
+#include <ntsecapi.h>
#undef SystemFunction036
#endif

21 changes: 13 additions & 8 deletions src/variant-i686.patch
Original file line number Diff line number Diff line change
@@ -1,43 +1,48 @@
--- a/Dockerfile
+++ b/Dockerfile
@@ -65,3 +65,3 @@ COPY src/w64devkit.c src/w64devkit.ico \
@@ -74,3 +74,3 @@ COPY src/w64devkit.c src/w64devkit.ico \

-ARG ARCH=x86_64-w64-mingw32
+ARG ARCH=i686-w64-mingw32

@@ -93,2 +93,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
@@ -102,2 +102,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
--with-default-msvcrt=msvcrt-os \
+ --with-default-win32-winnt=0x0501 \
&& make -j$(nproc) \
@@ -99,2 +100,5 @@ RUN ln -s $ARCH mingw
@@ -108,2 +109,5 @@ RUN ln -s $ARCH mingw

+# Disable UTF-8 manifest for Windows XP (#58)
+RUN echo >/gcc-$GCC_VERSION/gcc/config/i386/winnt-utf8.manifest
+
WORKDIR /x-gcc
@@ -104,2 +108,3 @@ RUN /gcc-$GCC_VERSION/configure \
@@ -113,2 +117,3 @@ RUN /gcc-$GCC_VERSION/configure \
--target=$ARCH \
+ --with-arch=pentium4 \
--enable-static \
@@ -132,4 +137,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
@@ -141,4 +146,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
--disable-dependency-tracking \
- --disable-lib32 \
- --enable-lib64 \
+ --enable-lib32 \
+ --disable-lib64 \
CFLAGS="-Os" \
@@ -217,2 +222,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
@@ -226,2 +231,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
--with-default-msvcrt=msvcrt-os \
+ --with-default-win32-winnt=0x0501 \
&& make -j$(nproc) \
@@ -227,4 +233,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
@@ -236,4 +242,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
--disable-dependency-tracking \
- --disable-lib32 \
- --enable-lib64 \
+ --enable-lib32 \
+ --disable-lib64 \
CFLAGS="-Os" \
@@ -239,2 +245,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-libraries/winpthreads/configure \
@@ -248,2 +254,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-libraries/winpthreads/configure \
--host=$ARCH \
+ --with-arch=pentium4 \
--enable-static \
@@ -512,3 +519,3 @@ RUN cat $PREFIX/src/git-*.patch | patch -p1 \
NO_GITWEB=1 \
- MSYSTEM=MINGW64 \
+ MSYSTEM=MINGW32 \
CFLAGS="-Os -I/deps/include/" \