3 # Builds a Solaris IPS package called "valgrind" from the source
4 # directory. The Valgrind revision is taken from that
5 # source directory and written to solaris/valgrind.p5m IPS manifest.
7 # Requires the following packages to be installed on Solaris 11:
8 # - data/xml-common (install first before any docbook ones!)
9 # - data/docbook/docbook-style-xsl
10 # - data/docbook/docbook-dtds
11 # - developer/build/autoconf
12 # - developer/build/automake-111
13 # - developer/debug/gdb
14 # - developer/gnu-binutils
15 # - developer/versioning/mercurial
17 # - and the latest developer/gcc package.
19 # Requires a pre-established IPS repository.
20 # For example to create a file-based repository, do:
21 # - pkgrepo create $repo_uri
22 # - pkgrepo set -s $repo_uri publisher/prefix=valgrind
25 GITREPO
=https
://sourceware.org
/git
/valgrind.git
/
26 TMPDIR
=/var
/tmp
/valgrind-build
27 SRCDIR
=$TMPDIR/sources
28 INSTALLDIR
=$TMPDIR/install
29 IPS_MANIFEST
=solaris
/valgrind.p5m
33 echo "build_solaris_package -p source_dir -s repo_uri [-r lint_repo_uri]"
34 echo "\t-p source_dir contains working copy of the Valgrind sources"
35 echo "\t-s repo_uri publishes to the repository located at the given URI"
36 echo "\t or file system path"
37 echo "\t-r lint_repo_uri location of lint reference repository"
44 echo "Additional information could be found in directory $TMPDIR."
54 (( $?
!= 0 )) && fail
"Failed to create directory $TMPDIR."
57 (( $?
!= 0 )) && fail
"Failed to create directory $INSTALLDIR."
62 git_commit
=$
( cd $source_directory; git rev-parse HEAD
)
63 echo "Valgrind git commit: $git_commit."
65 printf "Exporting sources... "
66 git clone
${GITREPO} ${SRCDIR} 2> $TMPDIR/git-clone-valgrind.log.stderr
67 (( $?
!= 0 )) && fail
"Failed to clone git repo from $source_directory."
69 git checkout
${git_commit} 2> $TMPDIR/git-checkout-valgrind.log.stderr
70 (( $?
!= 0 )) && fail
"Failed to checkout git commit ${git_commit}."
75 modify_ips_manifest
() {
76 current_date
=$
( date '+%Y%m%d' )
77 [[ -z $current_date ]] && fail
"Failed to determine current date."
79 sed -i -e "s/VVVVV/${current_date}/" $SRCDIR/$IPS_MANIFEST
83 printf "Creating autotools support files... "
84 .
/autogen.sh
> $TMPDIR/autogen.log.stdout
2> $TMPDIR/autogen.log.stderr
85 (( $?
!= 0 )) && fail
"Failed to generate autotools support files."
90 printf "Running configure... "
91 .
/configure CC
='gcc -m64' CXX
='g++ -m64' --prefix=/usr
> $TMPDIR/configure.log
92 (( $?
!= 0 )) && fail
"Failed to run configure."
97 printf "Making docs... "
98 make --directory=docs html-docs
> $TMPDIR/make-docs.log.stdout
2> $TMPDIR/make-docs.log.stderr
99 (( $?
!= 0 )) && fail
"Failed to make html-docs."
103 run_make_man_pages
() {
104 printf "Making man pages... "
105 make --directory=docs man-pages
> $TMPDIR/make-man-pages.log.stdout
2> $TMPDIR/make-man-pages.log.stderr
106 (( $?
!= 0 )) && fail
"Failed to make man-pages."
111 printf "Running make... "
112 make --quiet > $TMPDIR/make.log
113 (( $?
!= 0 )) && fail
"Failed to run make."
118 printf "Running 'make install'... "
119 make --quiet install DESTDIR
=$INSTALLDIR > $TMPDIR/make-install.log
120 (( $?
!= 0 )) && fail
"Failed to run 'make install'."
122 cp AUTHORS COPYING
* NEWS NEWS.old README
* $INSTALLDIR/usr
/share
/doc
/valgrind
123 (( $?
!= 0 )) && fail
"Failed to copy additional files to $INSTALLDIR."
129 printf "Running pkglint... "
130 pkglint
-c $TMPDIR/lint-cache
-r $lint_repo_uri $SRCDIR/$IPS_MANIFEST > $TMPDIR/pkglint.log
131 (( $?
!= 0 )) && fail
"pkglint failed."
136 printf "Publishing package... "
137 pkgsend publish
-s $repo_uri -d $INSTALLDIR $SRCDIR/solaris
/valgrind.p5m
> $TMPDIR/pkgsend.log
138 (( $?
!= 0 )) && fail
"Failed to publish the package."
142 while getopts "p:r:s:" args
; do
145 source_directory
=$OPTARG
148 lint_repo_uri
=$OPTARG
160 if [[ -z $source_directory ]]; then
161 echo "No source directory specified.\n"
166 if [[ -z $repo_uri ]]; then
167 echo "No repo_uri specified.\n"
172 # Determine the lint repo_uri to use from the current 'solaris' one
173 # if not specified explicitly.
174 if [[ -z $lint_repo_uri ]]; then
175 publisher
=$
( pkg publisher |
grep solaris |
tr -s ' ' )
176 if [[ $publisher == *sticky
* ]]; then
177 lint_repo_uri
=$
( echo "$publisher" | cut
-d ' ' -f 6 )
179 lint_repo_uri
=$
( echo "$publisher" | cut
-d ' ' -f 5 )
181 [[ -z $lint_repo_uri ]] && fail
"Failed to determine solaris IPS publisher."
182 echo "lint_repo_uri determined as $lint_repo_uri"