diff --git a/pacman/PKGBUILD b/pacman/PKGBUILD index 8cbc5712..4cd517a1 100644 --- a/pacman/PKGBUILD +++ b/pacman/PKGBUILD @@ -4,7 +4,7 @@ pkgname=pacman pkgver=5.2.2 -pkgrel=7 +pkgrel=8 pkgdesc="A library-based package manager with dependency support (MSYS2 port)" arch=('i686' 'x86_64') url="https://www.archlinux.org/pacman/" @@ -44,7 +44,6 @@ source=(https://sources.archlinux.org/other/pacman/${pkgname}-${pkgver}.tar.gz{, "makepkg_clang64.conf" "makepkg_mingw32.conf" "makepkg_mingw64.conf" - "makepkg-clang" "makepkg-mingw" "0000-pacman-msysize.patch" "0001-more-debugging-info.patch" @@ -74,8 +73,7 @@ sha256sums=('bb201a9f2fb53c28d011f661d50028efce6eef2c1d2a36728bdd0130189349a0' '13b20f6833df76a34ca38376469e275f93552ef9063d9ca06fc3c9ef5e87aa0b' '0e484f00a427f030c95f7ebcab3e0de1e637e55d01531438de9165d1f520cf81' 'c26dba8f9ac285efa33708e58ca29b4ad0fd9a1d6f4e82cbe433782b180799ee' - 'b50166ba89277459dcf4c18603e57b387b931e5252068fefcb3d2579ebe2dfa4' - '501c38b95fcb6938c79a4cff11913fa257d1751d1f6ea6c482ce95999c3fd3b3' + '041deae4524b7ec52b5b3d867a6988f240cef3e22997acbf46aff2d6e6e8cb01' '2e2dde573b971011abad5340cb2cd5a4b9a0e8470a2ed94d7a969525e0bed0c1' '24ea2c8dca37847e04894ebfd05d1cf5df49dc0c8089f5581c99caa19b77a7ef' 'ee65a0087af1cb7778836855f8b417b4bf2cf9a2141589ca0adff1e57b53af61' @@ -170,7 +168,6 @@ package() { install -m644 ${srcdir}/makepkg_clang64.conf ${pkgdir}/etc/ install -m644 ${srcdir}/makepkg_mingw32.conf ${pkgdir}/etc/ install -m644 ${srcdir}/makepkg_mingw64.conf ${pkgdir}/etc/ - install -m755 ${srcdir}/makepkg-clang ${pkgdir}/usr/bin/ install -m755 ${srcdir}/makepkg-mingw ${pkgdir}/usr/bin/ # set things correctly in the default conf file diff --git a/pacman/makepkg-clang b/pacman/makepkg-clang deleted file mode 100644 index 85ebd1d3..00000000 --- a/pacman/makepkg-clang +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash -# makepkg-mingw - wrapper for makepkg to build mingw-w64 packages under MSYS2 -# -# Copyright (c) 2018 Alexey Pavlov -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -plain() { - local mesg=$1; shift - printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -print_warning() { - local mesg=$1; shift - printf "${YELLOW}=> WARNING:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -print_msg1() { - local mesg=$1; shift - printf "${GREEN}==> ${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -print_msg2() { - local mesg=$1; shift - printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -print_error() { - local mesg=$1; shift - printf "${RED}==> ERROR:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -if /usr/bin/tput setaf 0 &>/dev/null; then - ALL_OFF="$(/usr/bin/tput sgr0)" - BOLD="$(/usr/bin/tput bold)" - BLUE="${BOLD}$(/usr/bin/tput setaf 4)" - GREEN="${BOLD}$(/usr/bin/tput setaf 2)" - RED="${BOLD}$(/usr/bin/tput setaf 1)" - YELLOW="${BOLD}$(/usr/bin/tput setaf 3)" -else - ALL_OFF="\e[1;0m" - BOLD="\e[1;1m" - BLUE="${BOLD}\e[1;34m" - GREEN="${BOLD}\e[1;32m" - RED="${BOLD}\e[1;31m" - YELLOW="${BOLD}\e[1;33m" -fi - -readonly ALL_OFF BOLD BLUE GREEN RED YELLOW -MINGW_INSTALLS="${MINGW_INSTALLS,,}" -MINGW_INSTALLS="${MINGW_INSTALLS:-clang64 clang32}" - -for _mingw in ${MINGW_INSTALLS}; do - if [ ! "${_mingw}" = 'clang32' -a ! "${_mingw}" = 'clang64' ]; then - print_error "Requested mingw installation '${_mingw}', but only 'clang32' and 'clang64' are allowed." - exit 1 - fi -done - -for _arg in "$@"; do - if [ ${_arg} = "--help" -o ${_arg} = "-h" -o ${_arg} = "--version" -o ${_arg} = "-V" ]; then - /usr/bin/makepkg $@ - exit 0 - fi -done - -for _mingw in ${MINGW_INSTALLS}; do - case ${_mingw} in - clang32) - _arch=i686 - _msystem=MINGW32 - ;; - clang64) - _arch=x86_64 - _msystem=MINGW64 - ;; - esac - - if [ -f "/${_mingw}/bin/clang.exe" ]; then - MSYSTEM=${_msystem} \ - PATH=/${_mingw}/bin:$(echo $PATH | tr ':' '\n' | awk '$0 != "/opt/bin"' | paste -sd:) \ - /usr/bin/makepkg --config /etc/makepkg_${_mingw}.conf $@ || exit 1 - else - print_warning "You don't have installed mingw-w64 toolchain for architecture ${_arch}." - print_warning "To install it run: 'pacman -S mingw-w64-${_arch}-toolchain'" - fi -done - -exit 0 diff --git a/pacman/makepkg-mingw b/pacman/makepkg-mingw index df775f7e..796bd505 100644 --- a/pacman/makepkg-mingw +++ b/pacman/makepkg-mingw @@ -17,6 +17,8 @@ # along with this program. If not, see . # +set -e + plain() { local mesg=$1; shift printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 @@ -61,17 +63,18 @@ fi readonly ALL_OFF BOLD BLUE GREEN RED YELLOW MINGW_INSTALLS="${MINGW_INSTALLS,,}" MINGW_INSTALLS="${MINGW_INSTALLS:-mingw64 mingw32}" +MINGW_INSTALLS_ALLOWED=('mingw32' 'mingw64' 'clang32' 'clang64') for _mingw in ${MINGW_INSTALLS}; do - if [ ! "${_mingw}" = 'mingw32' -a ! "${_mingw}" = 'mingw64' ]; then - print_error "Requested mingw installation '${_mingw}', but only 'mingw32' and 'mingw64' are allowed." + if [[ ! " ${MINGW_INSTALLS_ALLOWED[*]} " = *" ${_mingw} "* ]]; then + print_error "Requested mingw installation '${_mingw}' unknown, possible values: ${MINGW_INSTALLS_ALLOWED[*]}" exit 1 fi done for _arg in "$@"; do - if [ ${_arg} = "--help" -o ${_arg} = "-h" -o ${_arg} = "--version" -o ${_arg} = "-V" ]; then - /usr/bin/makepkg $@ + if [ "${_arg}" = "--help" ] || [ "${_arg}" = "-h" ] || [ "${_arg}" = "--version" ] || [ "${_arg}" = "-V" ]; then + /usr/bin/makepkg "$@" exit 0 fi done @@ -79,23 +82,36 @@ done for _mingw in ${MINGW_INSTALLS}; do case ${_mingw} in mingw32) - _arch=i686 _msystem=MINGW32 + _compiler="/${_mingw}/bin/gcc.exe" + _toolchain="mingw-w64-i686-toolchain" ;; mingw64) - _arch=x86_64 _msystem=MINGW64 + _compiler="/${_mingw}/bin/gcc.exe" + _toolchain="mingw-w64-x86_64-toolchain" + ;; + clang32) + _msystem=CLANG32 + _compiler="/${_mingw}/bin/clang.exe" + _toolchain="mingw-w64-i686-toolchain" + ;; + clang64) + _msystem=CLANG64 + _compiler="/${_mingw}/bin/clang.exe" + _toolchain="mingw-w64-x86_64-toolchain" ;; esac - if [ -f "/${_mingw}/bin/gcc.exe" ]; then - MSYSTEM=${_msystem} \ - PATH=/${_mingw}/bin:$(echo $PATH | tr ':' '\n' | awk '$0 != "/opt/bin"' | paste -sd:) \ - /usr/bin/makepkg --config /etc/makepkg_${_mingw}.conf $@ || exit 1 - else - print_warning "You don't have installed mingw-w64 toolchain for architecture ${_arch}." - print_warning "To install it run: 'pacman -S mingw-w64-${_arch}-toolchain'" + if [ ! -f "${_compiler}" ]; then + print_warning "You don't have the required toolchain installed for ${_mingw}." + print_warning "To install it run: 'pacman -S -${_toolchain}'" fi + + MSYSTEM="${_msystem}" \ + CHERE_INVOKING=1 \ + bash -leo pipefail -c "/usr/bin/makepkg --config /etc/makepkg_${_mingw}.conf \"\$@\"" bash "$@" + done exit 0