2
0

Get libscrypt from the official GIT repo or package + El Capitan build fixes + GIT checkout fixes.

This commit is contained in:
Maarten Billemont 2015-11-05 10:33:30 -05:00
parent b932f132ef
commit cdaf8f99d5
2 changed files with 58 additions and 57 deletions

View File

@ -41,6 +41,13 @@ fi
# Optional features. # Optional features.
mpw_color=1 # Colorized Identicon, requires libncurses-dev mpw_color=1 # Colorized Identicon, requires libncurses-dev
# Distribution specific configuration.
# Homebrew
if hash brew 2>/dev/null; then
opensslPath=$(brew --prefix openssl)
export CFLAGS="$CFLAGS -I$opensslPath/include"
export LDFLAGS="$LDFLAGS -L$opensslPath/lib"
fi
### DEPENDENCIES ### DEPENDENCIES
@ -84,6 +91,7 @@ unpack() {
touch .unpacked touch .unpacked
} }
fetchSource() ( fetchSource() (
local name=${PWD##*/}
source .source source .source
if [[ -e .unpacked ]]; then if [[ -e .unpacked ]]; then
@ -93,41 +101,41 @@ fetchSource() (
files=( !("${pkg##*/}") ) files=( !("${pkg##*/}") )
[[ -e $files ]] || { [[ -e $files ]] || {
echo echo
echo "Unpacking: ${PWD##*/}, using package..." echo "Unpacking: $name, using package..."
unpack "${pkg##*/}" "$pkg_sha256" ( mkdir src && cd src && unpack "${pkg##*/}" "$pkg_sha256" )
} }
elif [[ $git ]] && hash git 2>/dev/null; then elif [[ $git ]] && hash git 2>/dev/null; then
[[ -e .git ]] || { [[ -e .git ]] || {
echo echo
echo "Fetching: ${PWD##*/}, using git..." echo "Fetching: $name, using git..."
git clone "$svn" . git clone "$git" src
printf '%s' "$(git describe --always)" > "${PWD##*/}-version" printf '%s' "$(git describe --always)" > "$name-version"
} }
elif [[ $svn ]] && hash git 2>/dev/null && [[ -x "$(git --exec-path)/git-svn" ]]; then elif [[ $svn ]] && hash git 2>/dev/null && [[ -x "$(git --exec-path)/git-svn" ]]; then
[[ -e .git ]] || { [[ -e .git ]] || {
echo echo
echo "Fetching: ${PWD##*/}, using git-svn..." echo "Fetching: $name, using git-svn..."
git svn clone --prefix=origin/ --stdlayout "$svn" . git svn clone --prefix=origin/ --stdlayout "$svn" src
printf '%s' "$(git describe --always)" > "${PWD##*/}-version" printf '%s' "$(git describe --always)" > "$name-version"
} }
elif [[ $svn ]] && hash svn 2>/dev/null; then elif [[ $svn ]] && hash svn 2>/dev/null; then
[[ -e .svn ]] || { [[ -e .svn ]] || {
echo echo
echo "Fetching: ${PWD##*/}, using svn..." echo "Fetching: $name, using svn..."
svn checkout "$svn/trunk" . svn checkout "$svn/trunk" src
printf 'r%s' "$(svn info | awk '/^Revision:/{ print $2 }')" > "${PWD##*/}-version" printf 'r%s' "$(svn info | awk '/^Revision:/{ print $2 }')" > "$name-version"
} }
elif [[ $pkg ]]; then elif [[ $pkg ]]; then
files=( !("${pkg##*/}") ) files=( !("${pkg##*/}") )
[[ -e $files ]] || { [[ -e $files ]] || {
echo echo
echo "Fetching: ${PWD##*/}, using package..." echo "Fetching: $name, using package..."
fetch "$pkg" fetch "$pkg"
unpack "${pkg##*/}" "$pkg_sha256" ( mkdir src && cd src && unpack "${pkg##*/}" "$pkg_sha256" )
} }
else else
@ -135,35 +143,39 @@ fetchSource() (
echo >&2 "error: Missing git-svn or svn." echo >&2 "error: Missing git-svn or svn."
echo >&2 "error: Please install either or manually check out the sources" echo >&2 "error: Please install either or manually check out the sources"
echo >&2 "error: from: $home" echo >&2 "error: from: $home"
echo >&2 "error: into: $PWD" echo >&2 "error: into: $PWD/src"
exit 1 exit 1
fi fi
if [[ ! -e .patched ]] && (( ${#patches[@]} )); then if [[ ! -e .patched ]] && (( ${#patches[@]} )); then
pushd src
for patch in "${patches[@]}"; do for patch in "${patches[@]}"; do
echo echo
echo "Patching: ${PWD##*/}, for $patch..." echo "Patching: $name, for $patch..."
patch -p0 < ../"${PWD##*/}-$patch.patch" patch -p0 < "../../$name-$patch.patch"
done done
popd
touch .patched touch .patched
fi fi
) )
depend() { depend() {
local name=$1
echo echo
echo "Checking dependency: $1..." echo "Checking dependency: $name..."
[[ -e "lib/include/$1" ]] && return [[ -e "lib/include/$name" ]] && return
pushd "lib/$1" pushd "lib/$name"
fetchSource [[ -e "src" ]] || fetchSource
pushd "src"
echo echo
echo "Configuring dependency: $1..." echo "Configuring dependency: $name..."
if [[ -e configure.ac ]]; then if [[ -e configure.ac ]]; then
if [[ ! -e configure ]]; then if [[ ! -e configure ]]; then
# create configure using autotools. # create configure using autotools.
if ! hash aclocal || ! hash automake; then if ! hash aclocal || ! hash automake; then
echo >&2 "Need autotools to build $1. Please install automake and autoconf." echo >&2 "Need autotools to build $name. Please install automake and autoconf."
exit 1 exit 1
fi fi
@ -180,21 +192,22 @@ depend() {
fi fi
echo echo
echo "Building dependency: $1..." echo "Building dependency: $name..."
if [[ -e Makefile ]]; then if [[ -e Makefile ]]; then
if ! hash make; then if ! hash make; then
echo >&2 "Need make to build $1. Please install GNU make." echo >&2 "Need make to build $name. Please install GNU make."
exit 1 exit 1
fi fi
make make
install -d "../include/$1/" install -d "../../include/$name/"
find . -name '*.h' -exec install -m 444 {} "../include/$1/" \; find . -name '*.h' -exec install -m 444 {} "../../include/$name/" \;
else else
echo >&2 "error: Don't know how to build: $1" echo >&2 "error: Don't know how to build: $name"
exit 1 exit 1
fi fi
popd popd
popd
} }
@ -210,14 +223,10 @@ mpw() {
) )
local LDFLAGS=( local LDFLAGS=(
# scrypt # scrypt
"lib/scrypt/scrypt-crypto_aesctr.o" "lib/scrypt/src/libcperciva/"*/*.o
"lib/scrypt/scrypt-sha256.o" "lib/scrypt/src/lib/crypto/"*.o
"lib/scrypt/scrypt-crypto_scrypt-nosse.o"
"lib/scrypt/scrypt-memlimit.o"
"lib/scrypt/scrypt-scryptenc_cpuperf.o"
"lib/scrypt/scrypt-scryptenc.o"
# library paths # library paths
-L"." -L"lib/scrypt" -L"." -L"lib/scrypt/src"
# link libraries # link libraries
-l"crypto" -l"crypto"
) )
@ -246,20 +255,16 @@ mpw-bench() {
) )
local LDFLAGS=( local LDFLAGS=(
# scrypt # scrypt
"lib/scrypt/scrypt-crypto_aesctr.o" "lib/scrypt/src/libcperciva/"*/*.o
"lib/scrypt/scrypt-sha256.o" "lib/scrypt/src/lib/crypto/"*.o
"lib/scrypt/scrypt-crypto_scrypt-nosse.o"
"lib/scrypt/scrypt-memlimit.o"
"lib/scrypt/scrypt-scryptenc_cpuperf.o"
"lib/scrypt/scrypt-scryptenc.o"
# bcrypt # bcrypt
"lib/bcrypt/crypt_blowfish.o" "lib/bcrypt/src/crypt_blowfish.o"
"lib/bcrypt/crypt_gensalt.o" "lib/bcrypt/src/crypt_gensalt.o"
"lib/bcrypt/wrapper.o" "lib/bcrypt/src/wrapper.o"
"lib/bcrypt/x86.o" "lib/bcrypt/src/x86.o"
# library paths # library paths
-L"." -L"lib/scrypt" -L"." -L"lib/scrypt/src"
-L"lib/bcrypt" -L"lib/bcrypt/src"
# link libraries # link libraries
-l"crypto" -l"crypto"
) )
@ -287,14 +292,10 @@ mpw-tests() {
) )
local LDFLAGS=( local LDFLAGS=(
# scrypt # scrypt
"lib/scrypt/scrypt-crypto_aesctr.o" "lib/scrypt/src/libcperciva/"*/*.o
"lib/scrypt/scrypt-sha256.o" "lib/scrypt/src/lib/crypto/"*.o
"lib/scrypt/scrypt-crypto_scrypt-nosse.o"
"lib/scrypt/scrypt-memlimit.o"
"lib/scrypt/scrypt-scryptenc_cpuperf.o"
"lib/scrypt/scrypt-scryptenc.o"
# library paths # library paths
-L"." -L"lib/scrypt" -L"." -L"lib/scrypt/src"
# link libraries # link libraries
-l"crypto" -l"xml2" -l"crypto" -l"xml2"
) )

View File

@ -1,4 +1,4 @@
home=https://code.google.com/p/scrypt/ home=http://www.tarsnap.com/scrypt.html
svn=http://scrypt.googlecode.com/svn git=https://github.com/Tarsnap/scrypt.git
pkg=http://masterpasswordapp.com/libscrypt-b12b554.tar.gz pkg=http://www.tarsnap.com/scrypt/scrypt-1.2.0.tgz
pkg_sha256=c726daec68a345e420896f005394a948dc5a6924713ed94b684c856d4c247f0b pkg_sha256=1754bc89405277c8ac14220377a4c240ddc34b1ce70882aa92cd01bfdc8569d4