skeeto / w64devkit

Portable C and C++ Development Kit for x64 (and x86) Windows
The Unlicense
2.94k stars 205 forks source link

old versions fail to build - dead links (expat) #164

Open FunkyFr3sh opened 3 weeks ago

FunkyFr3sh commented 3 weeks ago

Source code of old versions are not kept on fossies.org and therefore older versions of w64devkit fail to build

Example: https://fossies.org/linux/www/expat-2.5.0.tar.xz

May want to download off github instead? https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.xz

skeeto commented 3 weeks ago

My main problem with their GitHub releases is that, as that URL shows, they use an unconventional tagging scheme, e.g. R_2_5_0 instead of 2.5.0 or v2.5.0. The Dockerfile language doesn't have the tools to translate between R_2_5_0 and 2.5.0, so I'd need to list/maintain both together.

I expect at least some of these hosts to change over time. For instance, ftp.vim.org is unmaintained and will quietly disappear someday, after which there will be no official host for Vim releases prior to 9.1. My solution for building old releases is the source.tar artifact on every w64dk release. Not only does that fulfill any license obligations (GPL, etc.), it makes older releases reproducible independent of source tarball hosts. Though it requires manually changing "RUN curl" to "COPY" and it must still download a bootstrap compiler from Debian.

skeeto commented 3 weeks ago

Using 1.21.0 as an example, grab any release ZIP and source.tar. Releases contain Dockerfile and src/ so you can rebuild from them without the w64dk Git repository! Unpack source.tar next to Dockerfile, then this change:

--- a/Dockerfile
+++ b/Dockerfile
@@ -26,19 +26,19 @@

-RUN curl --insecure --location --remote-name-all --remote-header-name \
-    https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.xz \
-    https://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz \
-    https://ftp.gnu.org/gnu/gdb/gdb-$GDB_VERSION.tar.xz \
-    https://fossies.org/linux/www/expat-$EXPAT_VERSION.tar.xz \
-    https://ftp.gnu.org/gnu/gmp/gmp-$GMP_VERSION.tar.xz \
-    https://ftp.gnu.org/gnu/mpc/mpc-$MPC_VERSION.tar.gz \
-    https://ftp.gnu.org/gnu/mpfr/mpfr-$MPFR_VERSION.tar.xz \
-    https://ftp.gnu.org/gnu/make/make-$MAKE_VERSION.tar.gz \
-    https://ftp.gnu.org/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz \
-    https://frippery.org/files/busybox/busybox-w32-$BUSYBOX_VERSION.tgz \
-    http://ftp.vim.org/pub/vim/unix/vim-$VIM_VERSION.tar.bz2 \
-    https://www.nasm.us/pub/nasm/releasebuilds/$NASM_VERSION/nasm-$NASM_VERSION.tar.xz \
-    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
+COPY source/gmp-6.2.1.tar.xz \
+     source/nasm-2.15.05.tar.xz \
+     source/make-4.4.tar.gz \
+     source/cppcheck-2.10.tar.gz \
+     source/busybox-w32-FRP-5181-g5c1a3b00e.tgz \
+     source/libiconv-1.17.tar.gz \
+     source/gcc-13.2.0.tar.xz \
+     source/binutils-2.40.tar.xz \
+     source/ctags-6.0.0.tar.gz \
+     source/mpfr-4.1.0.tar.xz \
+     source/PDCurses-3.9.tar.gz \
+     source/expat-2.5.0.tar.xz \
+     source/vim-9.0.tar.bz2 \
+     source/mingw-w64-v11.0.1.tar.bz2 \
+     source/gdb-13.1.tar.xz \
+     source/mpc-1.2.1.tar.gz \
+     /
 COPY src/SHA256SUMS $PREFIX/src/

(Note: COPY doesn't support $-interpolation on source paths for some reason.) Then you can recreate the ZIP you chose, whether 32-bit or 64-bit, with a docker build and docker run. It will only need to download the bootstrap compiler from Debian.

Note to self: Perhaps I should have set it up so that RUN curl could be replaced with a simple ADD