mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-09-11 12:25:42 +03:00
build git binary
This commit is contained in:
parent
b42db79501
commit
ab7f39353f
@ -5,6 +5,7 @@
|
||||
## setup
|
||||
|
||||
```bash
|
||||
$ cd src-tauri/binaries && make
|
||||
$ pnpm install
|
||||
```
|
||||
|
||||
|
1
src-tauri/binaries/.gitignore
vendored
Normal file
1
src-tauri/binaries/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
git-aarch64-apple-darwin
|
7
src-tauri/binaries/Makefile
Normal file
7
src-tauri/binaries/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
VERSION=2.39.1
|
||||
ARCH=$(shell rustc -Vv | grep host | cut -f2 -d' ')
|
||||
|
||||
git-$(ARCH):
|
||||
./build.sh --dist "$(shell pwd)/git-$(ARCH)" --version "$(VERSION)"
|
||||
|
||||
all: git-$(ARCH)
|
90
src-tauri/binaries/build.sh
Executable file
90
src-tauri/binaries/build.sh
Executable file
@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
PWD="$(dirname $(readlink -f -- $0))"
|
||||
DIST="$PWD/git"
|
||||
VERSION="2.39.1"
|
||||
|
||||
function help() {
|
||||
echo "Usage: $0 <flags>"
|
||||
echo
|
||||
echo "flags:"
|
||||
echo " --version git version to install. (default: $VERSION)"
|
||||
echo " --dist directory to install binaries to. (default: $DIST)"
|
||||
echo " --help display this message."
|
||||
}
|
||||
|
||||
function error() {
|
||||
echo "error: $@"
|
||||
echo
|
||||
help
|
||||
exit 1
|
||||
}
|
||||
|
||||
function info() {
|
||||
echo "$@"
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--help)
|
||||
help
|
||||
exit 1
|
||||
;;
|
||||
--version)
|
||||
VERSION="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--dist)
|
||||
DIST="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
error "unknown flag $1"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
function install_dependencies() {
|
||||
case "$(uname -s)" in
|
||||
Darwin)
|
||||
if [[ -z "$(brew ls --versions gettext)" ]]; then
|
||||
brew install gettext
|
||||
fi
|
||||
|
||||
if [[ -z "$(brew ls --versions automake)" ]]; then
|
||||
brew install automake
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function configure() {
|
||||
case "$(uname -s)" in
|
||||
Darwin)
|
||||
make configure
|
||||
./configure --prefix=/opt/homebrew
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
TMP_DIR=$(mktemp -d -t ci-XXXXXXXXXX)
|
||||
pushd "$TMP_DIR"
|
||||
|
||||
install_dependencies
|
||||
|
||||
curl --location --remote-name "https://www.kernel.org/pub/software/scm/git/git-$VERSION.tar.gz"
|
||||
tar -xzf "git-$VERSION.tar.gz"
|
||||
cd "git-$VERSION"
|
||||
|
||||
configure
|
||||
make
|
||||
|
||||
mv 'git' "$DIST"
|
||||
|
||||
popd
|
||||
rm -rf $TMP_DIR
|
Loading…
Reference in New Issue
Block a user