source: scripts/get_waf.sh @ 7897b51

feature/crepe
Last change on this file since 7897b51 was b540b22, checked in by Paul Brossier <piem@piem.org>, 3 years ago

[waf] fetch public key matching requested waf version (closes gh-340)

  • Property mode set to 100755
File size: 1017 bytes
RevLine 
[701999c]1#! /usr/bin/env bash
[7858305]2
3set -e
[e561ca7]4#set -x
[7858305]5
[92d40c7]6WAFVERSION=2.0.23
[ee4fc9c]7WAFTARBALL=waf-$WAFVERSION.tar.bz2
8WAFURL=https://waf.io/$WAFTARBALL
[b540b22]9WAFUPSTREAMKEY=https://gitlab.com/ita1024/waf/-/raw/waf-$WAFVERSION/utils/pubkey.asc
[7858305]10
[ee4fc9c]11WAFBUILDDIR=`mktemp -d`
[7858305]12
[ee4fc9c]13function cleanup () {
14  rm -rf $WAFBUILDDIR
15}
16
17trap cleanup SIGINT SIGTERM
18
[e561ca7]19function download () {
20  ( [[ -n `which wget` ]] && wget -qO $1 $2 ) || ( [[ -n `which curl` ]] && curl -so $1 $2 )
21}
22
23function checkwaf () {
24  download $WAFTARBALL.asc $WAFURL.asc
25  if [[ -z `which gpg` ]]
26  then
27    echo "Warning: gpg not found, not verifying signature for $WAFTARBALL"
28  else
29    download - $WAFUPSTREAMKEY | gpg --import
30    gpg --verify $WAFTARBALL.asc || exit 1
31  fi
32}
[ee4fc9c]33
[e561ca7]34function fetchwaf () {
35  download $WAFTARBALL $WAFURL
36  checkwaf
37}
[ee4fc9c]38
[e561ca7]39function buildwaf () {
[ee4fc9c]40  tar xf $WAFTARBALL
41  pushd waf-$WAFVERSION
[bb07c7e]42  NOCLIMB=1 python waf-light --tools=c_emscripten $*
[ee4fc9c]43  popd
44}
45
[e561ca7]46pushd $WAFBUILDDIR
47fetchwaf
[ee4fc9c]48buildwaf
[e561ca7]49popd
50
[63a7a43]51cp -prv $WAFBUILDDIR/waf-$WAFVERSION/waf "$PWD"
[e561ca7]52chmod +x waf
[ee4fc9c]53
54cleanup
Note: See TracBrowser for help on using the repository browser.