From 9609a835ca2eb3089e35269a05369833e9ec0ba2 Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Mon, 21 Dec 2020 16:19:22 +0100 Subject: [PATCH] Squashed 'gitstatus/' changes from 630915cc..6d00edd0 6d00edd0 use a native binary on darwin-arm64 4994f160 add a build server for darwin-arm64 0e922813 invoke port with sudo 576571c7 support macports in addition to homebrew when building on macos b476570a remove trailing whitespace git-subtree-dir: gitstatus git-subtree-split: 6d00edd0bfd1d65a3cbcebfc6e679e8c43726acc --- build | 35 ++++++++++++++++++++++------------- install | 22 ++-------------------- install.info | 8 ++++---- mbuild | 7 ++++--- 4 files changed, 32 insertions(+), 40 deletions(-) diff --git a/build b/build index cbd8ce1f..ad1d1484 100755 --- a/build +++ b/build @@ -98,17 +98,20 @@ if [ -n "$gitstatus_install_tools" ]; then >&2 echo "[error] please run 'xcode-select --install' and retry" exit 1 fi - if ! command -v brew >/dev/null 2>&1; then - >&2 echo "[error] please install homebrew from https://brew.sh/ and retry" + if command -v port >/dev/null 2>&1; then + sudo port -N install libiconv cmake wget + elif command -v brew >/dev/null 2>&1; then + for formula in libiconv cmake git wget; do + if command brew list "$formula" &>/dev/null; then + command brew upgrade "$formula" + else + command brew install "$formula" + fi + done + else + >&2 echo "[error] please install MacPorts or Homebrew and retry" exit 1 fi - for formula in libiconv cmake git wget; do - if command brew list "$formula" &>/dev/null; then - command brew upgrade "$formula" - else - command brew install "$formula" - fi - done ;; msys*|mingw*) command pacman -Syu --noconfirm @@ -165,11 +168,17 @@ case "$gitstatus_kernel" in ;; darwin) command mkdir -- "$workdir"/lib - brew_prefix="$(command brew --prefix)" - command ln -s -- "$brew_prefix"/opt/libiconv/lib/libiconv.a "$workdir"/lib + if [ -e /opt/local/lib/libiconv.a ]; then + command ln -s -- /opt/local/lib/libiconv.a "$workdir"/lib + libgit2_cflags="$libgit2_cflags -I/opt/local/include" + gitstatus_cxxflags="$gitstatus_cxxflags -I/opt/local/include" + else + brew_prefix="$(command brew --prefix)" + command ln -s -- "$brew_prefix"/opt/libiconv/lib/libiconv.a "$workdir"/lib + libgit2_cflags="$libgit2_cflags -I"$brew_prefix"/opt/libiconv/include" + gitstatus_cxxflags="$gitstatus_cxxflags -I"$brew_prefix"/opt/libiconv/include" + fi libgit2_cmake_flags="$libgit2_cmake_flags -DUSE_ICONV=ON" - libgit2_cflags="$libgit2_cflags -I"$brew_prefix"/opt/libiconv/include" - gitstatus_cxxflags="$gitstatus_cxxflags -I"$brew_prefix"/opt/libiconv/include" gitstatus_ldlibs="$gitstatus_ldlibs -liconv" gitstatus_ldflags="$gitstatus_ldflags -L${workdir}/lib" libgit2_cmake_flags="$libgit2_cmake_flags -DENABLE_REPRODUCIBLE_BUILDS=OFF" diff --git a/install b/install index 23501b9c..86824ece 100755 --- a/install +++ b/install @@ -5,24 +5,6 @@ _gitstatus_install_daemon_found() { local installed="$1" shift - - case "$daemon" in - *-darwin-x86_64) - if [ "$uname_m" = arm64 ] && - [ ! -e /Library/Apple/System/Library/LaunchDaemons/com.apple.oahd.plist ] && - [ -x /usr/sbin/softwareupdate ]; then - >&"$e" printf 'Please run the following command to install Rosetta:\n' - >&"$e" printf '\n' - >&"$e" printf ' \033[32m/usr/sbin/softwareupdate\033[0m --install-rosetta\n' - >&"$e" printf '\n' - >&"$e" printf 'See for details: \033[4mhttps://support.apple.com/en-us/HT211861\033[0m\n' - >&"$e" printf '\n' - >&"$e" printf 'Once Rosetta is installed, restart your shell.\n' - return 1 - fi - ;; - esac - [ $# = 0 ] || "$@" "$daemon" "$version" "$installed" } @@ -386,9 +368,9 @@ END local trapped= trap 'trapped=1' $sig - fetch 1 "$url1" & + fetch 1 "$url1" & local pid1="$!" - fetch 2 "$url2" & + fetch 2 "$url2" & local pid2="$!" local die="trap - $sig; kill -- $pid1 $pid2 2>/dev/null; wait -- $pid1 $pid2 2>/dev/null; exit 1" diff --git a/install.info b/install.info index 2f9c2e2f..e71a03ef 100644 --- a/install.info +++ b/install.info @@ -1,15 +1,16 @@ -# 6a3d54a5a44abb4ee46ce72a8097389364746c6a +# 0 # # This file is used by ./install and indirectly by shell bindings. # # The first line is read by powerlevel10k instant prompt. It must # be updated whenever the content of this file changes. The actual -# value doesn't matter as long as it's unique. You can use the output -# of `git rev-parse HEAD`. +# value doesn't matter as long as it's unique. Consecutive integers +# work fine. # Official gitstatusd binaries. uname_s_glob="cygwin_nt-10.0"; uname_m_glob="i686"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.3.1"; sha256="c96baef70b81b5a1d46adcc9e93721eaf4bdc295562bdd2baf210a6b416b9911"; uname_s_glob="cygwin_nt-10.0"; uname_m_glob="x86_64"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.3.1"; sha256="18b5be49f6eb9ff1cf25e76d6f2333c7402e686e05ce5b88ca107c80504210d8"; +uname_s_glob="darwin"; uname_m_glob="arm64"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.3.1"; sha256="0394e2ac880c1e190ace0346499d4670861297ecc2f84315ecb8ba3c98aa68d9"; uname_s_glob="darwin"; uname_m_glob="x86_64"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.3.1"; sha256="26d582fe9a0b2090c28e84e5e32a6d42d6988cedff51e41ec5f789512c53b0fc"; uname_s_glob="freebsd"; uname_m_glob="amd64"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.3.1"; sha256="54a823373458a0908187ba8d1c5b8921015c844811916451674cc09fbdff88bb"; uname_s_glob="linux"; uname_m_glob="aarch64"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.3.1"; sha256="4e0a506eafb14b009cf6670f0e11399ac7e765cad17b9fcf38ef65516d248bfa"; @@ -25,7 +26,6 @@ uname_s_glob="msys_nt-10.0"; uname_m_glob="x86_64"; file="gitstatusd-${uname_ # Fallbacks to official gitstatusd binaries. uname_s_glob="cygwin_nt-*"; uname_m_glob="i686"; file="gitstatusd-cygwin_nt-10.0-${uname_m}"; version="v1.3.1"; sha256="c96baef70b81b5a1d46adcc9e93721eaf4bdc295562bdd2baf210a6b416b9911"; uname_s_glob="cygwin_nt-*"; uname_m_glob="x86_64"; file="gitstatusd-cygwin_nt-10.0-${uname_m}"; version="v1.3.1"; sha256="18b5be49f6eb9ff1cf25e76d6f2333c7402e686e05ce5b88ca107c80504210d8"; -uname_s_glob="darwin"; uname_m_glob="arm64"; file="gitstatusd-${uname_s}-x86_64"; version="v1.3.1"; sha256="26d582fe9a0b2090c28e84e5e32a6d42d6988cedff51e41ec5f789512c53b0fc"; uname_s_glob="mingw32_nt-*"; uname_m_glob="i686"; file="gitstatusd-msys_nt-10.0-${uname_m}"; version="v1.3.1"; sha256="618d2425c6a22fa3762fe6fe252f9ddb4ed9138df1377e48b2f119cd4875f400"; uname_s_glob="mingw32_nt-*"; uname_m_glob="x86_64"; file="gitstatusd-msys_nt-10.0-${uname_m}"; version="v1.3.1"; sha256="bdfae7a7c0fd83d0214a7eabde3b7d8709336bd08697a74d48bea4a04c352676"; uname_s_glob="mingw64_nt-*"; uname_m_glob="i686"; file="gitstatusd-msys_nt-10.0-${uname_m}"; version="v1.3.1"; sha256="618d2425c6a22fa3762fe6fe252f9ddb4ed9138df1377e48b2f119cd4875f400"; diff --git a/mbuild b/mbuild index 02408802..608e3aba 100755 --- a/mbuild +++ b/mbuild @@ -5,7 +5,7 @@ # Usage: mbuild [-b git-ref] [kernel-arch]... # # Builds a bunch of gitstatusd-* binaries. Without arguments builds binaries -# for all platforms. git-ref defaults to src. +# for all platforms. git-ref defaults to master. # # Before using this script you need to set up build servers and list them # in ~/.ssh/config. There should be a Host entry for every value of `assets` @@ -111,6 +111,7 @@ local -rA assets=( cygwin_nt-10.0-x86_64 build-windows-x86_64 msys_nt-10.0-i686 build-windows-x86_64 msys_nt-10.0-x86_64 build-windows-x86_64 + darwin-arm64 build-macos-arm64 darwin-x86_64 build-macos-x86_64 freebsd-amd64 build-freebsd-amd64 linux-aarch64 build-linux-aarch64 @@ -138,7 +139,7 @@ function usage() { print -r -- 'usage: mbuild [-b REF] [KERNEL-ARCH]...' } -local OPTARG opt git_ref=src +local OPTARG opt git_ref=master local -i OPTIND while getopts ":b:h" opt; do case $opt in @@ -183,7 +184,7 @@ function build-unix() { case $2 in linux-ppc64le) ;; linux-*) flags+=(-d docker);; - darwin-arm64) intro='PATH="/opt/homebrew/bin:$PATH"';; + darwin-arm64) intro='PATH="/opt/local/bin:$PATH"';; darwin-*) intro='PATH="/usr/local/bin:$PATH"';; esac ssh $1 -- /bin/sh -uex <<<"