mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Ability to download capstone git as zip
This commit is contained in:
parent
18b069ccf4
commit
36e9d25068
@ -32,7 +32,9 @@ CS_TAR=https://codeload.github.com/aquynh/capstone/tar.gz/$(CS_VER)
|
||||
CS_PATCHES=0
|
||||
else
|
||||
CS_TAR=
|
||||
CS_URL=$(GIT_PREFIX)github.com/aquynh/capstone.git
|
||||
CS_URL_BASE=github.com/aquynh/capstone
|
||||
CS_URL=$(GIT_PREFIX)$(CS_URL_BASE).git
|
||||
CS_ARCHIVE=https://$(CS_URL_BASE)/archive
|
||||
CS_UPD=20190506
|
||||
ifeq ($(CS_NEXT),1)
|
||||
CS_TIP=d59d1e75d1f261e938fc23130a5bffdc56d1af74
|
||||
@ -41,6 +43,11 @@ else
|
||||
CS_TIP=7090f081b17a5293a2c185a06513fede18065d3c
|
||||
CS_BRA=v4
|
||||
endif
|
||||
ifeq ($(CS_COMMIT_ARCHIVE),1)
|
||||
CS_ARCHIVE_URL=$(CS_ARCHIVE)/$(CS_TIP).zip
|
||||
else
|
||||
CS_ARCHIVE_URL=
|
||||
endif
|
||||
# NOTE: when you update CS_TIP or CS_BRA, also update them in shlr/meson.build
|
||||
#CS_BRA=next
|
||||
#CS_TIP=38607453f3de85733f9604dffc27778db3b53766
|
||||
@ -281,7 +288,7 @@ capstone-sync:
|
||||
ifeq ($(WITHOUT_PULL),1)
|
||||
@echo "Nothing to sync because of --without-pull"
|
||||
else
|
||||
"$(SHELL)" capstone.sh "${CS_URL}" "${CS_BRA}" "${CS_TIP}" "${CS_REV}"
|
||||
"$(SHELL)" capstone.sh "${CS_URL}" "${CS_BRA}" "${CS_TIP}" "${CS_REV}" "${CS_ARCHIVE_URL}"
|
||||
@echo "[capstone] Applying patches"
|
||||
ifeq ($(CS_PATCHES),1)
|
||||
-cd capstone ; if [ -d .git ]; then $(GIT) reset --hard ; fi
|
||||
|
@ -3,6 +3,7 @@ CS_URL="$1" # url
|
||||
CS_BRA="$2" # branch name
|
||||
CS_TIP="$3" # tip commit
|
||||
CS_REV="$4" # revert
|
||||
CS_ARCHIVE="$5" # download archived tip
|
||||
CS_DEPTH_CLONE=512
|
||||
|
||||
git --help > /dev/null 2>&1
|
||||
@ -32,11 +33,27 @@ parse_capstone_tip() {
|
||||
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||
}
|
||||
|
||||
clone_capstone() {
|
||||
download_archive() {
|
||||
echo '[capstone] Downloading capstone snapshot...' >&2
|
||||
wget -O .cs_tmp.zip "$CS_ARCHIVE" || fatal_msg 'Cannot download archived capstone'
|
||||
unzip .cs_tmp.zip
|
||||
mv "capstone-$CS_TIP" capstone
|
||||
}
|
||||
|
||||
git_clone() {
|
||||
echo '[capstone] Cloning capstone from git...' >&2
|
||||
git clone --quiet --single-branch --branch "${CS_BRA}" \
|
||||
--depth "$CS_DEPTH_CLONE" "${CS_URL}" capstone \
|
||||
|| fatal_msg 'Cannot clone capstone from git'
|
||||
}
|
||||
|
||||
get_capstone() {
|
||||
if [ ! -d capstone ]; then
|
||||
git clone --quiet --single-branch --branch "${CS_BRA}" \
|
||||
--depth "$CS_DEPTH_CLONE" "${CS_URL}" capstone \
|
||||
|| fatal_msg 'Cannot clone capstone from git'
|
||||
if [ -n "${CS_ARCHIVE}" ]; then
|
||||
download_archive
|
||||
else
|
||||
git_clone
|
||||
fi
|
||||
fi
|
||||
cd capstone && parse_capstone_tip
|
||||
cd - || fatal_msg 'Cannot change working directory'
|
||||
@ -71,12 +88,12 @@ if [ -d capstone ] && [ ! -d capstone/.git ]; then
|
||||
#patch_capstone
|
||||
cd -
|
||||
else
|
||||
clone_capstone
|
||||
get_capstone
|
||||
|
||||
if [ "${BRANCH}" != "${CS_BRA}" ]; then
|
||||
echo '[capstone] Reset capstone' >&2
|
||||
rm -rf capstone
|
||||
clone_capstone
|
||||
get_capstone
|
||||
fi
|
||||
|
||||
# if [ "${HEAD}" = "${CS_TIP}" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user