diff --git a/README.md b/README.md index 563e145..ec28193 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# emacs-build v0.3 +# emacs-build v0.3.1 Scripts to build a distribution of Emacs from sources, using MSYS2 and Mingw64(32) @@ -155,3 +155,7 @@ Regarding the extensions to Emacs and third-party utilities: - Emacs ships with a `site-start.el` that activates the directories for MSYS2 extensions. - Only one branch of Emacs can be built. - emacs-build no longer uses log files. + +## v0.3.1 + +- Emacs-build upgrades GNU TLS version to at least 3.7.0, to allow safe https to MELPA. diff --git a/emacs-build.sh b/emacs-build.sh index 02e10d0..36fce39 100644 --- a/emacs-build.sh +++ b/emacs-build.sh @@ -33,6 +33,7 @@ . scripts/hunspell.sh . scripts/gzip.sh . scripts/msys2_extra.sh +. scripts/gnutls.sh function write_help () { cat "$emacs_build_root/scripts/help.txt" @@ -190,15 +191,15 @@ function action2_install () # HACK!!! Somehow libgmp is not installed as part of the # standalone Emacs build process. This is weird, but means # we have to copy it by hand. - make -j 4 -C $emacs_build_dir install \ + make -j $emacs_build_threads -C $emacs_build_dir install \ && cp "${mingw_dir}bin/libgmp"*.dll "$emacs_install_dir/bin/" \ + && action2_patch_gnutls \ && rm -f "$emacs_install_dir/bin/emacs-"*.exe \ && find "$emacs_install_dir" -name '*.exe' -exec strip -g --strip-unneeded -X '{}' '+' \ && cp "$emacs_build_root/scripts/site-start.el" "$emacs_install_dir/share/emacs/site-lisp" \ && mkdir -p "$emacs_install_dir/usr/share/emacs/site-lisp/" \ && cp "$emacs_install_dir/share/emacs/site-lisp/subdirs.el" \ "$emacs_install_dir/usr/share/emacs/site-lisp/subdirs.el" - dir "${emacs_install_dir}/bin" fi } @@ -363,11 +364,13 @@ actions="" do_clean="" debug_dependency_list="false" emacs_compress_files=no -emacs_build_version=0.3 +emacs_build_version=0.3.1 emacs_slim_build=yes emacs_nativecomp=no +emacs_build_threads=1 while test -n "$*"; do case $1 in + --threads) shift; emacs_build_threads="$1";; --branch) shift; emacs_branch="$1";; --without-*) delete_feature `echo $1 | sed -e 's,--without-,,'`;; --with-*) add_feature `echo $1 | sed -e 's,--without-,,'`;; @@ -425,7 +428,6 @@ if test -z "$actions"; then actions="action0_clone action1_ensure_packages action2_build action3_package_deps action5_package_all" fi features=`for f in $features; do echo $f; done | sort | uniq` -echo $features # This is needed for pacman to return the right text export LANG=C diff --git a/scripts/gnutls.sh b/scripts/gnutls.sh new file mode 100644 index 0000000..a4fa568 --- /dev/null +++ b/scripts/gnutls.sh @@ -0,0 +1,36 @@ +# +# GNU TLS library below 3.7.0 has problems connecting to MELPA +# via https secure connections. This file downloads a more recent +# version of the library. +# + +function action2_patch_gnutls () +{ + # + # If gnutls is not used or has a recent version, return + if [[ ! "$features" =~ .*gnutls.* ]]; then + return 0 + fi + tls_version=`pacman -Qi mingw-w64-${mingw_prefix}-gnutls | grep Version | sed 's,Version[ ]*:[ ]*\([^ ]*\)$,\1,'` + if [[ ! "$tls_version" < "3.7.0" ]]; then + return 0 + fi + echo Patching gnutls library because version ${tls_version} is too old. + # + # Download the official gnutls distribution and replace the + # existing libraries with this one. We assume this can be done + # because gnutls from mingw pulled the right dependencies + if test "$architecture" = "i686"; then + gnutls_link="https://gitlab.com/gnutls/gnutls/builds/artifacts/3.7.0/download?job=MinGW32.DLLs" + gnutls_dir="win32-build" + else + gnutls_link="https://gitlab.com/gnutls/gnutls/builds/artifacts/3.7.0/download?job=MinGW64.DLLs" + gnutls_dir="win64-build" + fi + (cd "$emacs_install_dir/" \ + && rm -rf "$gnutls_dir" gnutls.zip \ + && curl -L "$gnutls_link" > gnutls.zip \ + && unzip -x gnutls.zip \ + && mv "$gnutls_dir/bin/"* bin/ \ + && rm -rf "$gnutls_dir" gnutls.zip) +}