2 # Download and build JSON.pm
4 # http://search.cpan.org/~makamaka/JSON-2.58/lib/JSON.pm
5 # SRC_URL='http://www.cpan.org/authors/id/M/MA/MAKAMAKA/JSON-2.58.tar.gz'
8 SRC_URL
="http://www.cpan.org/authors/id/M/MA/MAKAMAKA/$PACKAGE-$VERSION.tar.gz"
9 FILENAME
="$(basename $SRC_URL)"
10 SHA1_FILENAME
="$FILENAME.sha1"
11 BUILD_DIR
="$PACKAGE-$VERSION"
12 INSTALL_DIR
="$(pwd)/out"
14 curl
--remote-name "$SRC_URL"
17 # SHA-1 hash generated via:
18 # shasum JSON-2.59.tar.gz > JSON-2.59.tar.gz.sha1
19 if ! [ -f "$SHA1_FILENAME" ]
21 echo "SHA-1 hash file $SHA1_FILENAME not found, could not verify archive"
25 # Check that hash file contains hash for archive
26 HASHFILE_REGEX
="^[0-9a-f]{40} $FILENAME" # 40-digit hash, followed by filename
27 if ! grep --extended-regex --line-regex --silent \
28 "$HASHFILE_REGEX" "$SHA1_FILENAME"
30 echo "SHA-1 hash file $SHA1_FILENAME does not contain hash for $FILENAME," \
31 'could not verify archive'
32 echo 'Hash file contents are:'
37 if ! shasum
--check "$SHA1_FILENAME"
39 echo 'SHA-1 hash does not match,' \
40 "archive file $FILENAME corrupt or compromised!"
47 perl Makefile.PL INSTALL_BASE
="$INSTALL_DIR"
54 # Rename :: to __ because : is reserved in Windows filenames
55 # (only occurs in man pages, which aren't necessary)
56 for i
in $
(find .
-name '*::*')
58 mv -f "$i" `echo "$i" | sed s/::/__/g`
61 # Fix permissions and shebangs
62 # https://rt.cpan.org/Public/Bug/Display.html?id=85917
63 # Make examples executable
68 # Strip shebangs from test files that have them
71 if head -1 "$i" |
grep --quiet '^#!'