diff --git a/Dockerfile b/Dockerfile index 2686875..597d2ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ ENV PREFIX=$PREFIX RUN apt-get update && apt-get install --yes --no-install-recommends \ build-essential cmake libgmp-dev libmpc-dev libmpfr-dev m4 p7zip-full \ - python3 scons + python3 quilt scons COPY src/w64devkit.ico src/alias.c $PREFIX/src/ @@ -237,10 +237,15 @@ ENV ARCH=i686-w64-mingw32 \ FROM variant-${VARIANT} AS cross WORKDIR /dl/binutils -COPY src/binutils-*.patch $PREFIX/src/ +COPY src/binutils/ $PREFIX/src/binutils/ +# Patch queues are applied with quilt, ordered by each queue's series +# file. The .pc/ state is removed after each push: source trees are +# never popped, and a stale .pc would block pushing a second queue +# onto the same tree later (gcc then crossgcc, mingw then gendef). RUN sed -ri 's/(static bool insert_timestamp = )/\1!/' ld/emultempl/pe*.em \ && sed -ri 's/(int pe_enable_stdcall_fixup = )/\1!!/' ld/emultempl/pe*.em \ - && cat $PREFIX/src/binutils-*.patch | patch -p1 + && QUILT_PATCHES=$PREFIX/src/binutils quilt push -a \ + && rm -rf .pc WORKDIR /x-binutils RUN /dl/binutils/configure \ --prefix=/bootstrap \ @@ -256,8 +261,10 @@ RUN /dl/binutils/configure \ # https://sourceforge.net/p/mingw-w64/bugs/821/ RUN sed -i /OpenThreadToken/d /dl/mingw/mingw-w64-crt/lib32/kernel32.def -COPY src/mingw-*.patch $PREFIX/src/ -RUN cat $PREFIX/src/mingw-*.patch | patch -d/dl/mingw -p1 +COPY src/mingw/ $PREFIX/src/mingw/ +RUN cd /dl/mingw \ + && QUILT_PATCHES=$PREFIX/src/mingw quilt push -a \ + && rm -rf .pc WORKDIR /x-mingw-headers RUN printf '#include \n#if __has_include_next()\n#include_next \n#endif\n' \ @@ -273,8 +280,10 @@ WORKDIR /bootstrap RUN ln -s /bootstrap mingw WORKDIR /x-gcc -COPY src/gcc-*.patch $PREFIX/src/ -RUN cat $PREFIX/src/gcc-*.patch | patch -d/dl/gcc -p1 \ +COPY src/gcc/ $PREFIX/src/gcc/ +RUN (cd /dl/gcc \ + && QUILT_PATCHES=$PREFIX/src/gcc quilt push -a \ + && rm -rf .pc) \ && /dl/gcc/configure \ --prefix=/bootstrap \ --with-sysroot=/bootstrap \ @@ -497,8 +506,10 @@ RUN if [ "$GCC_MULTILIB" = enable ]; then \ fi WORKDIR /gcc -COPY src/crossgcc-*.patch $PREFIX/src/ -RUN cat $PREFIX/src/crossgcc-*.patch | patch -d/dl/gcc -p1 \ +COPY src/crossgcc/ $PREFIX/src/crossgcc/ +RUN (cd /dl/gcc \ + && QUILT_PATCHES=$PREFIX/src/crossgcc quilt push -a \ + && rm -rf .pc) \ && /dl/gcc/configure \ --prefix=$PREFIX \ --with-sysroot=$PREFIX \ @@ -608,8 +619,10 @@ RUN if [ "$GCC_MULTILIB" = enable ]; then \ FROM cross AS build-gendef WORKDIR /mingw-tools/gendef -COPY src/gendef-*.patch $PREFIX/src/ -RUN cat $PREFIX/src/gendef-*.patch | patch -d/dl/mingw -p1 \ +COPY src/gendef/ $PREFIX/src/gendef/ +RUN (cd /dl/mingw \ + && QUILT_PATCHES=$PREFIX/src/gendef quilt push -a \ + && rm -rf .pc) \ && /dl/mingw/mingw-w64-tools/gendef/configure \ --host=$ARCH \ CFLAGS="-O2" \ @@ -678,8 +691,10 @@ RUN /dl/libiconv/configure \ && make install WORKDIR /gdb -COPY src/gdb-*.patch $PREFIX/src/ -RUN cat $PREFIX/src/gdb-*.patch | patch -d/dl/gdb -p1 \ +COPY src/gdb/ $PREFIX/src/gdb/ +RUN (cd /dl/gdb \ + && QUILT_PATCHES=$PREFIX/src/gdb quilt push -a \ + && rm -rf .pc) \ && sed -i 's/quiet = 0/quiet = 1/' /dl/gdb/gdb/main.c \ && /dl/gdb/configure \ --host=$ARCH \ @@ -695,8 +710,10 @@ FROM cross AS build-make COPY --from=dl-make /dl/ /dl/ WORKDIR /make -COPY src/make-*.patch $PREFIX/src/ -RUN cat $PREFIX/src/make-*.patch | patch -d/dl/make -p1 \ +COPY src/make/ $PREFIX/src/make/ +RUN (cd /dl/make \ + && QUILT_PATCHES=$PREFIX/src/make quilt push -a \ + && rm -rf .pc) \ && /dl/make/configure \ --host=$ARCH \ --disable-nls \ @@ -714,8 +731,10 @@ FROM cross AS build-busybox COPY --from=dl-busybox /dl/ /dl/ WORKDIR /dl/busybox -COPY src/busybox-* $PREFIX/src/ -RUN cat $PREFIX/src/busybox-*.patch | patch -p1 \ +COPY src/busybox/ $PREFIX/src/busybox/ +COPY src/busybox-alias.c $PREFIX/src/ +RUN QUILT_PATCHES=$PREFIX/src/busybox quilt push -a \ + && rm -rf .pc \ && make $BUSYBOX_CONFIG \ && sed -ri 's/^(CONFIG_AR)=y/\1=n/' .config \ && sed -ri 's/^(CONFIG_ASCII)=y/\1=n/' .config \ @@ -764,8 +783,10 @@ FROM cross AS build-vim COPY --from=dl-vim /dl/ /dl/ WORKDIR /dl/vim -COPY src/rexxd.c src/vim-*.patch $PREFIX/src/ -RUN cat $PREFIX/src/vim-*.patch | patch -p1 \ +COPY src/rexxd.c $PREFIX/src/ +COPY src/vim/ $PREFIX/src/vim/ +RUN QUILT_PATCHES=$PREFIX/src/vim quilt push -a \ + && rm -rf .pc \ && ARCH= make -C src -j$(nproc) -f Make_ming.mak CC="$ARCH-gcc -std=gnu17" \ OPTIMIZE=SPEED STATIC_STDCPLUS=yes HAS_GCC_EH=no \ UNDER_CYGWIN=yes CROSS=yes CROSS_COMPILE=$ARCH- \ @@ -791,8 +812,9 @@ FROM cross AS build-ctags COPY --from=dl-ctags /dl/ /dl/ WORKDIR /dl/ctags -COPY src/ctags-*.patch $PREFIX/src/ -RUN cat $PREFIX/src/ctags-*.patch | patch -p1 \ +COPY src/ctags/ $PREFIX/src/ctags/ +RUN QUILT_PATCHES=$PREFIX/src/ctags quilt push -a \ + && rm -rf .pc \ && sed -i /RT_MANIFEST/d win32/ctags.rc \ && make -j$(nproc) -f mk_mingw.mak CC=gcc packcc.exe \ && make -j$(nproc) -f mk_mingw.mak \ @@ -821,8 +843,10 @@ RUN make -j$(nproc) -C programs zstd \ FROM cross AS build-ccache COPY --from=dl-ccache /dl/ /dl/ COPY --from=build-zstd /deps/ /deps/ -COPY src/ccache-*.patch $PREFIX/src/ -RUN cat $PREFIX/src/ccache-*.patch | patch -d/dl/ccache -p1 +COPY src/ccache/ $PREFIX/src/ccache/ +RUN cd /dl/ccache \ + && QUILT_PATCHES=$PREFIX/src/ccache quilt push -a \ + && rm -rf .pc WORKDIR /dl/xxhash RUN make -j$(nproc) CC=$ARCH-gcc AR=$ARCH-ar CFLAGS="-O2" libxxhash.a \ @@ -870,10 +894,12 @@ RUN $ARCH-gcc -DEXE=ccache.exe -DCMD=gcc \ FROM cross AS build-ninja COPY --from=dl-ninja /dl/ /dl/ -COPY src/ninja-*.patch $PREFIX/src/ +COPY src/ninja/ $PREFIX/src/ninja/ WORKDIR /ninja -RUN cat $PREFIX/src/ninja-*.patch | patch -d/dl/ninja -p1 \ +RUN (cd /dl/ninja \ + && QUILT_PATCHES=$PREFIX/src/ninja quilt push -a \ + && rm -rf .pc) \ && cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_SYSTEM_NAME=Windows \ -DCMAKE_CXX_COMPILER=$ARCH-g++ \ @@ -904,8 +930,10 @@ COPY --from=build-pdcurses /deps/lib/libcurses.a /deps/lib/ COPY --from=build-pdcurses /deps/include/curses.h /deps/include/ WORKDIR /cmake -COPY src/cmake-*.patch $PREFIX/src/ -RUN cat $PREFIX/src/cmake-*.patch | patch -d/dl/cmake -p1 \ +COPY src/cmake/ $PREFIX/src/cmake/ +RUN (cd /dl/cmake \ + && QUILT_PATCHES=$PREFIX/src/cmake quilt push -a \ + && rm -rf .pc) \ && cmake -DCMAKE_C_FLAGS="$CMAKE_WINNT_C_FLAGS" \ -DCMAKE_CXX_FLAGS="$CMAKE_WINNT_CXX_FLAGS" \ -DCMAKE_BUILD_TYPE=Release \ @@ -965,12 +993,13 @@ RUN cmake -B /aas-sign-build-w32 -S /dl/aas-sign \ FROM cross AS build-nsis COPY --from=dl-nsis /dl/nsis /dl/nsis -COPY src/nsis-*.patch $PREFIX/src/ +COPY src/nsis/ $PREFIX/src/nsis/ WORKDIR /dl/nsis # Source/build.cpp ships with CRLF line endings; everything else in # the tree is LF. Strip the carriage returns so our LF patch applies. RUN sed -i 's/\r$//' Source/build.cpp \ - && cat $PREFIX/src/nsis-*.patch | patch -p1 \ + && QUILT_PATCHES=$PREFIX/src/nsis quilt push -a \ + && rm -rf .pc \ && scons -j$(nproc) \ XGCC_W32_PREFIX=$ARCH- \ TARGET_ARCH=$NSIS_ARCH \ diff --git a/src/binutils-dlltool-zero-ordinals.patch b/src/binutils/dlltool-zero-ordinals.patch similarity index 100% rename from src/binutils-dlltool-zero-ordinals.patch rename to src/binutils/dlltool-zero-ordinals.patch diff --git a/src/binutils-exclude-sysroot.patch b/src/binutils/exclude-sysroot.patch similarity index 100% rename from src/binutils-exclude-sysroot.patch rename to src/binutils/exclude-sysroot.patch diff --git a/src/binutils/series b/src/binutils/series new file mode 100644 index 0000000..bd1a6f3 --- /dev/null +++ b/src/binutils/series @@ -0,0 +1,5 @@ +dlltool-zero-ordinals.patch +exclude-sysroot.patch +windmc-bom.patch +windmc-carry-severity-facility.patch +windmc-per-facility-ids.patch diff --git a/src/binutils-windmc-bom.patch b/src/binutils/windmc-bom.patch similarity index 100% rename from src/binutils-windmc-bom.patch rename to src/binutils/windmc-bom.patch diff --git a/src/binutils-windmc-carry-severity-facility.patch b/src/binutils/windmc-carry-severity-facility.patch similarity index 100% rename from src/binutils-windmc-carry-severity-facility.patch rename to src/binutils/windmc-carry-severity-facility.patch diff --git a/src/binutils-windmc-per-facility-ids.patch b/src/binutils/windmc-per-facility-ids.patch similarity index 100% rename from src/binutils-windmc-per-facility-ids.patch rename to src/binutils/windmc-per-facility-ids.patch diff --git a/src/busybox-002-default-noiconify.patch b/src/busybox/default-noiconify.patch similarity index 100% rename from src/busybox-002-default-noiconify.patch rename to src/busybox/default-noiconify.patch diff --git a/src/busybox-000-disable-beep.patch b/src/busybox/disable-beep.patch similarity index 100% rename from src/busybox-000-disable-beep.patch rename to src/busybox/disable-beep.patch diff --git a/src/busybox-001-disable-empty-complete.patch b/src/busybox/disable-empty-complete.patch similarity index 100% rename from src/busybox-001-disable-empty-complete.patch rename to src/busybox/disable-empty-complete.patch diff --git a/src/busybox-007-mkdtemp.patch b/src/busybox/mkdtemp.patch similarity index 100% rename from src/busybox-007-mkdtemp.patch rename to src/busybox/mkdtemp.patch diff --git a/src/busybox/series b/src/busybox/series new file mode 100644 index 0000000..f946a37 --- /dev/null +++ b/src/busybox/series @@ -0,0 +1,6 @@ +disable-beep.patch +disable-empty-complete.patch +default-noiconify.patch +system-profile.patch +zstd.patch +mkdtemp.patch diff --git a/src/busybox-004-system-profile.patch b/src/busybox/system-profile.patch similarity index 100% rename from src/busybox-004-system-profile.patch rename to src/busybox/system-profile.patch diff --git a/src/busybox-006-zstd.patch b/src/busybox/zstd.patch similarity index 100% rename from src/busybox-006-zstd.patch rename to src/busybox/zstd.patch diff --git a/src/ccache-000-handle-diagnostic-colors.patch b/src/ccache/handle-diagnostic-colors.patch similarity index 100% rename from src/ccache-000-handle-diagnostic-colors.patch rename to src/ccache/handle-diagnostic-colors.patch diff --git a/src/ccache/series b/src/ccache/series new file mode 100644 index 0000000..47f254c --- /dev/null +++ b/src/ccache/series @@ -0,0 +1,2 @@ +handle-diagnostic-colors.patch +write-unicode-diagnostics.patch diff --git a/src/ccache-001-write-unicode-diagnostics.patch b/src/ccache/write-unicode-diagnostics.patch similarity index 100% rename from src/ccache-001-write-unicode-diagnostics.patch rename to src/ccache/write-unicode-diagnostics.patch diff --git a/src/cmake-force-ninja.patch b/src/cmake/force-ninja.patch similarity index 100% rename from src/cmake-force-ninja.patch rename to src/cmake/force-ninja.patch diff --git a/src/cmake/series b/src/cmake/series new file mode 100644 index 0000000..3cb2050 --- /dev/null +++ b/src/cmake/series @@ -0,0 +1 @@ +force-ninja.patch diff --git a/src/crossgcc-Os-no-declone-ctor-dtor.patch b/src/crossgcc/Os-no-declone-ctor-dtor.patch similarity index 100% rename from src/crossgcc-Os-no-declone-ctor-dtor.patch rename to src/crossgcc/Os-no-declone-ctor-dtor.patch diff --git a/src/crossgcc-driver-self-locate.patch b/src/crossgcc/driver-self-locate.patch similarity index 100% rename from src/crossgcc-driver-self-locate.patch rename to src/crossgcc/driver-self-locate.patch diff --git a/src/crossgcc-i686-dumpmachine.patch b/src/crossgcc/i686-dumpmachine.patch similarity index 100% rename from src/crossgcc-i686-dumpmachine.patch rename to src/crossgcc/i686-dumpmachine.patch diff --git a/src/crossgcc-libgomp-gfortran-path.patch b/src/crossgcc/libgomp-gfortran-path.patch similarity index 100% rename from src/crossgcc-libgomp-gfortran-path.patch rename to src/crossgcc/libgomp-gfortran-path.patch diff --git a/src/crossgcc-relocatable.patch b/src/crossgcc/relocatable.patch similarity index 100% rename from src/crossgcc-relocatable.patch rename to src/crossgcc/relocatable.patch diff --git a/src/crossgcc/series b/src/crossgcc/series new file mode 100644 index 0000000..62553e6 --- /dev/null +++ b/src/crossgcc/series @@ -0,0 +1,5 @@ +Os-no-declone-ctor-dtor.patch +driver-self-locate.patch +i686-dumpmachine.patch +libgomp-gfortran-path.patch +relocatable.patch diff --git a/src/ctags-fix-trailing-slash.patch b/src/ctags/fix-trailing-slash.patch similarity index 100% rename from src/ctags-fix-trailing-slash.patch rename to src/ctags/fix-trailing-slash.patch diff --git a/src/ctags-qml.patch b/src/ctags/qml.patch similarity index 100% rename from src/ctags-qml.patch rename to src/ctags/qml.patch diff --git a/src/ctags/series b/src/ctags/series new file mode 100644 index 0000000..83aee5c --- /dev/null +++ b/src/ctags/series @@ -0,0 +1,3 @@ +fix-trailing-slash.patch +qml.patch +silence-warnings.patch diff --git a/src/ctags-silence-warnings.patch b/src/ctags/silence-warnings.patch similarity index 100% rename from src/ctags-silence-warnings.patch rename to src/ctags/silence-warnings.patch diff --git a/src/gcc-avx-misaligned.patch b/src/gcc/avx-misaligned.patch similarity index 100% rename from src/gcc-avx-misaligned.patch rename to src/gcc/avx-misaligned.patch diff --git a/src/gcc-dynamic-load-tzdb.patch b/src/gcc/dynamic-load-tzdb.patch similarity index 100% rename from src/gcc-dynamic-load-tzdb.patch rename to src/gcc/dynamic-load-tzdb.patch diff --git a/src/gcc-libgfortran-mapview.patch b/src/gcc/libgfortran-mapview.patch similarity index 100% rename from src/gcc-libgfortran-mapview.patch rename to src/gcc/libgfortran-mapview.patch diff --git a/src/gcc/series b/src/gcc/series new file mode 100644 index 0000000..7598d77 --- /dev/null +++ b/src/gcc/series @@ -0,0 +1,4 @@ +avx-misaligned.patch +dynamic-load-tzdb.patch +libgfortran-mapview.patch +trap-terminate.patch diff --git a/src/gcc-trap-terminate.patch b/src/gcc/trap-terminate.patch similarity index 100% rename from src/gcc-trap-terminate.patch rename to src/gcc/trap-terminate.patch diff --git a/src/gdb-000-alternate-main.patch b/src/gdb/alternate-main.patch similarity index 100% rename from src/gdb-000-alternate-main.patch rename to src/gdb/alternate-main.patch diff --git a/src/gdb-001-confirm-off.patch b/src/gdb/confirm-off.patch similarity index 100% rename from src/gdb-001-confirm-off.patch rename to src/gdb/confirm-off.patch diff --git a/src/gdb/series b/src/gdb/series new file mode 100644 index 0000000..2482b58 --- /dev/null +++ b/src/gdb/series @@ -0,0 +1,2 @@ +alternate-main.patch +confirm-off.patch diff --git a/src/gendef/series b/src/gendef/series new file mode 100644 index 0000000..1c344c1 --- /dev/null +++ b/src/gendef/series @@ -0,0 +1 @@ +silent.patch diff --git a/src/gendef-silent.patch b/src/gendef/silent.patch similarity index 100% rename from src/gendef-silent.patch rename to src/gendef/silent.patch diff --git a/src/make-force-slow.patch b/src/make/force-slow.patch similarity index 100% rename from src/make-force-slow.patch rename to src/make/force-slow.patch diff --git a/src/make/series b/src/make/series new file mode 100644 index 0000000..5fd1c71 --- /dev/null +++ b/src/make/series @@ -0,0 +1,2 @@ +force-slow.patch +shell-space.patch diff --git a/src/make-shell-space.patch b/src/make/shell-space.patch similarity index 100% rename from src/make-shell-space.patch rename to src/make/shell-space.patch diff --git a/src/mingw-default-win32-winnt.patch b/src/mingw/default-win32-winnt.patch similarity index 100% rename from src/mingw-default-win32-winnt.patch rename to src/mingw/default-win32-winnt.patch diff --git a/src/mingw-imp-strtof_l.patch b/src/mingw/imp-strtof_l.patch similarity index 100% rename from src/mingw-imp-strtof_l.patch rename to src/mingw/imp-strtof_l.patch diff --git a/src/mingw/series b/src/mingw/series new file mode 100644 index 0000000..502c0e6 --- /dev/null +++ b/src/mingw/series @@ -0,0 +1,2 @@ +default-win32-winnt.patch +imp-strtof_l.patch diff --git a/src/ninja-fix-recovery.patch b/src/ninja/fix-recovery.patch similarity index 100% rename from src/ninja-fix-recovery.patch rename to src/ninja/fix-recovery.patch diff --git a/src/ninja/series b/src/ninja/series new file mode 100644 index 0000000..d52efb6 --- /dev/null +++ b/src/ninja/series @@ -0,0 +1 @@ +fix-recovery.patch diff --git a/src/nsis-cross-makensis.patch b/src/nsis/cross-makensis.patch similarity index 100% rename from src/nsis-cross-makensis.patch rename to src/nsis/cross-makensis.patch diff --git a/src/nsis-no-ansi.patch b/src/nsis/no-ansi.patch similarity index 100% rename from src/nsis-no-ansi.patch rename to src/nsis/no-ansi.patch diff --git a/src/nsis/series b/src/nsis/series new file mode 100644 index 0000000..afd4fae --- /dev/null +++ b/src/nsis/series @@ -0,0 +1,2 @@ +cross-makensis.patch +no-ansi.patch diff --git a/src/vim-guifont.patch b/src/vim/guifont.patch similarity index 100% rename from src/vim-guifont.patch rename to src/vim/guifont.patch diff --git a/src/vim-qml.patch b/src/vim/qml.patch similarity index 100% rename from src/vim-qml.patch rename to src/vim/qml.patch diff --git a/src/vim/series b/src/vim/series new file mode 100644 index 0000000..be5000c --- /dev/null +++ b/src/vim/series @@ -0,0 +1,2 @@ +guifont.patch +qml.patch