Skip to content

Commit 8f53043

Browse files
committed
Add Git
1 parent 2b0ae5a commit 8f53043

File tree

4 files changed

+149
-10
lines changed

4 files changed

+149
-10
lines changed

Dockerfile

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ ARG NASM_VERSION=2.15.05
1818
ARG PDCURSES_VERSION=3.9
1919
ARG CPPCHECK_VERSION=2.10
2020
ARG VIM_VERSION=9.0
21+
ARG GIT_VERSION=2.41.0
22+
ARG CURL_VERSION=8.1.2
23+
ARG ZLIB_VERSION=1.2.13
2124

2225
RUN apt-get update && apt-get install --yes --no-install-recommends \
2326
build-essential curl libgmp-dev libmpc-dev libmpfr-dev m4 zip
@@ -40,7 +43,10 @@ RUN curl --insecure --location --remote-name-all --remote-header-name \
4043
https://github.com/universal-ctags/ctags/archive/refs/tags/v$CTAGS_VERSION.tar.gz \
4144
https://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v$MINGW_VERSION.tar.bz2 \
4245
https://downloads.sourceforge.net/project/pdcurses/pdcurses/$PDCURSES_VERSION/PDCurses-$PDCURSES_VERSION.tar.gz \
43-
https://github.com/danmar/cppcheck/archive/$CPPCHECK_VERSION.tar.gz
46+
https://github.com/danmar/cppcheck/archive/$CPPCHECK_VERSION.tar.gz \
47+
https://mirrors.edge.kernel.org/pub/software/scm/git/git-$GIT_VERSION.tar.xz \
48+
https://curl.se/download/curl-$CURL_VERSION.tar.bz2 \
49+
https://zlib.net/zlib-$ZLIB_VERSION.tar.xz
4450
COPY src/SHA256SUMS $PREFIX/src/
4551
RUN sha256sum -c $PREFIX/src/SHA256SUMS \
4652
&& tar xJf binutils-$BINUTILS_VERSION.tar.xz \
@@ -58,7 +64,10 @@ RUN sha256sum -c $PREFIX/src/SHA256SUMS \
5864
&& tar xzf PDCurses-$PDCURSES_VERSION.tar.gz \
5965
&& tar xJf nasm-$NASM_VERSION.tar.xz \
6066
&& tar xjf vim-$VIM_VERSION.tar.bz2 \
61-
&& tar xzf cppcheck-$CPPCHECK_VERSION.tar.gz
67+
&& tar xzf cppcheck-$CPPCHECK_VERSION.tar.gz \
68+
&& tar xJf git-$GIT_VERSION.tar.xz \
69+
&& tar xjf curl-$CURL_VERSION.tar.bz2 \
70+
&& tar xJf zlib-$ZLIB_VERSION.tar.xz
6271
COPY src/w64devkit.c src/w64devkit.ico \
6372
src/alias.c src/debugbreak.c src/pkg-config.c \
6473
$PREFIX/src/
@@ -464,6 +473,54 @@ RUN cat $PREFIX/src/cppcheck-*.patch | patch -p1 \
464473
-o $PREFIX/bin/cppcheck.exe \
465474
$PREFIX/src/alias.c -lkernel32
466475

476+
WORKDIR /zlib-$ZLIB_VERSION
477+
RUN CC=$ARCH-gcc AR=$ARCH-ar RANLIB=$ARCH-ranlib CFLAGS="-Os" LDFLAGS="-s" \
478+
./configure --prefix=/ --static \
479+
&& make -j$(nproc) \
480+
&& make install DESTDIR=/deps \
481+
&& make install DESTDIR=tmp \
482+
&& mkdir -p $PREFIX/lib/ \
483+
&& cp -r tmp/lib/* $PREFIX/lib/
484+
485+
WORKDIR /curl-$CURL_VERSION
486+
RUN ./configure \
487+
--host=$ARCH \
488+
--prefix=/deps \
489+
--with-schannel \
490+
CFLAGS="-Os" \
491+
LDFLAGS="-s" \
492+
&& make -j$(nproc) \
493+
&& make install \
494+
&& cp /deps/bin/libcurl* $PREFIX/bin/
495+
496+
WORKDIR /git-$GIT_VERSION
497+
COPY src/git-*.patch $PREFIX/src/
498+
# Make and install at the same time to avoid repeating arguments
499+
RUN cat $PREFIX/src/git-*.patch | patch -p1 \
500+
&& make \
501+
CC=$ARCH-gcc \
502+
WINDRES=$ARCH-windres \
503+
CURL_CONFIG=/deps/bin/curl-config \
504+
INSTALL=/usr/bin/install \
505+
DEFAULT_PAGER=less.exe \
506+
DEFAULT_EDITOR=vi.bat \
507+
NO_OPENSSL=1 \
508+
NO_ICONV=1 \
509+
NO_REGEX=1 \
510+
NO_GETTEXT=1 \
511+
NO_TCLTK=1 \
512+
NO_GITWEB=1 \
513+
MSYSTEM=MINGW64 \
514+
CFLAGS="-Os -I/deps/include/" \
515+
LDFLAGS="-s -L/deps/lib/" \
516+
prefix=/ \
517+
DESTDIR=$PREFIX \
518+
install -j$(nproc)
519+
520+
# Git creates one 3Mb executable for each command; they should be symlinks.
521+
WORKDIR $PREFIX/libexec/git-core
522+
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'
523+
467524
# Pack up a release
468525

469526
WORKDIR /

src/SHA256SUMS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
44321f9b4d8af0eb68152c2e5d9ae4d8d72fd118e2f135040a92f68d174b32b3 busybox-w32-FRP-5007-g82accfc19.tgz
33
785dcbf711048dfe43ae920b6eff2eeebb4a096e88188a40e173ca4c030f57c3 cppcheck-2.10.tar.gz
44
71229a73f25529c9e3dabb2cb7310c55405d31caee8e8a9ab5c71b2406d4005a ctags-6.0.0.tar.gz
5+
b54974d32fd610acace92e3df1f643144015ac65847f0a041fdc17db6f43f243 curl-8.1.2.tar.bz2
56
ef2420f0232c087801abf705e89ae65f6257df6b7931d37846a193ef2e8cdcbe expat-2.5.0.tar.xz
67
61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86 gcc-13.1.0.tar.xz
78
115ad5c18d69a6be2ab15882d365dda2a2211c14f480b3502c6eba576e2e95a0 gdb-13.1.tar.xz
9+
e748bafd424cfe80b212cbc6f1bbccc3a47d4862fb1eb7988877750478568040 git-2.41.0.tar.xz
810
fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2 gmp-6.2.1.tar.xz
911
8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313 libiconv-1.17.tar.gz
1012
581f4d4e872da74b3941c874215898a7d35802f03732bdccee1d4a7979105d18 make-4.4.tar.gz
@@ -14,3 +16,4 @@ bd0ea1633bd830204cc23a696889335e9d4a32b8619439ee17f22188695fcc5f mingw-w64-v11.
1416
3caf6729c1073bf96629b57cee31eeb54f4f8129b01902c73428836550b30a3f nasm-2.15.05.tar.xz
1517
590dbe0f5835f66992df096d3602d0271103f90cf8557a5d124f693c2b40d7ec PDCurses-3.9.tar.gz
1618
a6456bc154999d83d0c20d968ac7ba6e7df0d02f3cb6427fb248660bacfb336e vim-9.0.tar.bz2
19+
d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98 zlib-1.2.13.tar.xz

src/git-mingw.patch

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
diff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c
2+
index a4e33768f4..438af8f818 100644
3+
--- a/compat/win32/trace2_win32_process_info.c
4+
+++ b/compat/win32/trace2_win32_process_info.c
5+
@@ -3,8 +3,8 @@
6+
#include "../../repository.h"
7+
#include "../../trace2.h"
8+
#include "lazyload.h"
9+
-#include <Psapi.h>
10+
-#include <tlHelp32.h>
11+
+#include <psapi.h>
12+
+#include <tlhelp32.h>
13+
14+
/*
15+
* An arbitrarily chosen value to limit the size of the ancestor
16+
diff --git a/config.mak.uname b/config.mak.uname
17+
index 64c44db805..0dd2b673f2 100644
18+
--- a/config.mak.uname
19+
+++ b/config.mak.uname
20+
@@ -4,7 +4,7 @@
21+
# Microsoft's Safe Exception Handling in libraries (such as zlib).
22+
# Typically required for VS2013+/32-bit compilation on Vista+ versions.
23+
24+
-uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
25+
+uname_S := MINGW
26+
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
27+
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
28+
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
29+
@@ -677,7 +677,7 @@ ifeq ($(uname_S),MINGW)
30+
EXTLIBS += -lws2_32
31+
GITLIBS += git.res
32+
PTHREAD_LIBS =
33+
- RC = windres -O coff
34+
+ RC = $(WINDRES) -O coff
35+
NATIVE_CRLF = YesPlease
36+
X = .exe
37+
# MSys2
38+
@@ -689,12 +689,12 @@ ifeq ($(uname_S),MINGW)
39+
BASIC_LDFLAGS += -Wl,--dynamicbase
40+
endif
41+
ifeq (MINGW32,$(MSYSTEM))
42+
- prefix = /mingw32
43+
+ #prefix = /mingw32
44+
HOST_CPU = i686
45+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
46+
endif
47+
ifeq (MINGW64,$(MSYSTEM))
48+
- prefix = /mingw64
49+
+ #prefix = /mingw64
50+
HOST_CPU = x86_64
51+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
52+
else
53+
@@ -709,7 +709,7 @@ ifeq ($(uname_S),MINGW)
54+
INTERNAL_QSORT = YesPlease
55+
HAVE_LIBCHARSET_H = YesPlease
56+
USE_GETTEXT_SCHEME = fallthrough
57+
- USE_LIBPCRE = YesPlease
58+
+ #USE_LIBPCRE = YesPlease
59+
USE_NED_ALLOCATOR = YesPlease
60+
ifeq (/mingw64,$(subst 32,64,$(prefix)))
61+
# Move system config into top-level /etc/
62+
diff --git a/wrapper.c b/wrapper.c
63+
index 67f5f5dbe1..5dc48e815a 100644
64+
--- a/wrapper.c
65+
+++ b/wrapper.c
66+
@@ -17,7 +17,7 @@ static intmax_t count_fsync_hardware_flush;
67+
#ifdef HAVE_RTLGENRANDOM
68+
/* This is required to get access to RtlGenRandom. */
69+
#define SystemFunction036 NTAPI SystemFunction036
70+
-#include <NTSecAPI.h>
71+
+#include <ntsecapi.h>
72+
#undef SystemFunction036
73+
#endif
74+

src/variant-i686.patch

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,48 @@
11
--- a/Dockerfile
22
+++ b/Dockerfile
3-
@@ -65,3 +65,3 @@ COPY src/w64devkit.c src/w64devkit.ico \
3+
@@ -74,3 +74,3 @@ COPY src/w64devkit.c src/w64devkit.ico \
44

55
-ARG ARCH=x86_64-w64-mingw32
66
+ARG ARCH=i686-w64-mingw32
77

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

1414
+# Disable UTF-8 manifest for Windows XP (#58)
1515
+RUN echo >/gcc-$GCC_VERSION/gcc/config/i386/winnt-utf8.manifest
1616
+
1717
WORKDIR /x-gcc
18-
@@ -104,2 +108,3 @@ RUN /gcc-$GCC_VERSION/configure \
18+
@@ -113,2 +117,3 @@ RUN /gcc-$GCC_VERSION/configure \
1919
--target=$ARCH \
2020
+ --with-arch=pentium4 \
2121
--enable-static \
22-
@@ -132,4 +137,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
22+
@@ -141,4 +146,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
2323
--disable-dependency-tracking \
2424
- --disable-lib32 \
2525
- --enable-lib64 \
2626
+ --enable-lib32 \
2727
+ --disable-lib64 \
2828
CFLAGS="-Os" \
29-
@@ -217,2 +222,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
29+
@@ -226,2 +231,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
3030
--with-default-msvcrt=msvcrt-os \
3131
+ --with-default-win32-winnt=0x0501 \
3232
&& make -j$(nproc) \
33-
@@ -227,4 +233,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
33+
@@ -236,4 +242,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
3434
--disable-dependency-tracking \
3535
- --disable-lib32 \
3636
- --enable-lib64 \
3737
+ --enable-lib32 \
3838
+ --disable-lib64 \
3939
CFLAGS="-Os" \
40-
@@ -239,2 +245,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-libraries/winpthreads/configure \
40+
@@ -248,2 +254,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-libraries/winpthreads/configure \
4141
--host=$ARCH \
4242
+ --with-arch=pentium4 \
4343
--enable-static \
44+
@@ -512,3 +519,3 @@ RUN cat $PREFIX/src/git-*.patch | patch -p1 \
45+
NO_GITWEB=1 \
46+
- MSYSTEM=MINGW64 \
47+
+ MSYSTEM=MINGW32 \
48+
CFLAGS="-Os -I/deps/include/" \

0 commit comments

Comments
 (0)