Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: third_party/JSON/get_and_build_json_pm.sh

Issue 15736030: Add JSON.pm to third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix permissions and shebangs Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/JSON/README.chromium ('k') | third_party/JSON/out/lib/perl5/JSON.pm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2 # Download and build JSON.pm
3 # Homepage:
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'
6 PACKAGE='JSON'
7 VERSION='2.59'
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"
13
14 curl --remote-name "$SRC_URL"
15
16 # Check hash
17 # SHA-1 hash generated via:
18 # shasum JSON-2.59.tar.gz > JSON-2.59.tar.gz.sha1
19 if ! [ -f "$SHA1_FILENAME" ]
20 then
21 echo "SHA-1 hash file $SHA1_FILENAME not found, could not verify archive"
22 exit 1
23 fi
24
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"
29 then
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:'
33 cat "$SHA1_FILENAME"
34 exit 1
35 fi
36
37 if ! shasum --check "$SHA1_FILENAME"
38 then
39 echo 'SHA-1 hash does not match,' \
40 "archive file $FILENAME corrupt or compromised!"
41 exit 1
42 fi
43
44 # Extract and build
45 tar xvzf "$FILENAME"
46 cd "$BUILD_DIR"
47 perl Makefile.PL INSTALL_BASE="$INSTALL_DIR"
48 make
49 make test
50 make install
51 cd ..
52 rm "$FILENAME"
53
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 '*::*')
57 do
58 mv -f "$i" `echo "$i" | sed s/::/__/g`
59 done
60
61 # Fix permissions and shebangs
62 # https://rt.cpan.org/Public/Bug/Display.html?id=85917
63 # Make examples executable
64 cd "$BUILD_DIR"
65 chmod +x eg/*.pl
66 cd t
67
68 # Strip shebangs from test files that have them
69 for i in *.t
70 do
71 if head -1 "$i" | grep --quiet '^#!'
72 then
73 ed -s "$i" <<END
74 # Delete line 1
75 1d
76 # Write and Quit
77 wq
78 END
79 fi
80 done
OLDNEW
« no previous file with comments | « third_party/JSON/README.chromium ('k') | third_party/JSON/out/lib/perl5/JSON.pm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698