3 # Builds a Solaris IPS package called "valgrind" from the project sources.
4 # Sources are cloned and updated to the tag found in solaris/valgrind.p5m
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 TMPDIR
=/var
/tmp
/valgrind-solaris-build
26 SRCDIR
=$TMPDIR/sources
27 INSTALLDIR
=$TMPDIR/install
28 PROJECT_URL
=https
://bitbucket.org
/iraisr
/valgrind-solaris
29 IPS_MANIFEST
=solaris
/valgrind.p5m
33 echo "build_solaris_package -s repo_uri [-r lint_repo_uri]"
34 echo "\t-s repo_uri publishes to the repository located at the given URI"
35 echo "\t or file system path"
36 echo "\t-r lint_repo_uri location of lint reference repository"
43 echo "Additional information could be found in directory $TMPDIR"
53 (( $?
!= 0 )) && fail
"Failed to create directory $TMPDIR"
56 (( $?
!= 0 )) && fail
"Failed to create directory $INSTALLDIR"
60 printf "Cloning valgrind-solaris sources... "
61 hg
--quiet clone
--insecure $PROJECT_URL $SRCDIR 2> $TMPDIR/hg-clone.log.stderr
62 (( $?
!= 0 )) && fail
"Failed to clone repo from $PROJECT_URL"
66 update_sources_to_revision
() {
68 tag
=$
( grep "pkg.fmri" $IPS_MANIFEST |
tr -s ' ' | \
69 sed -e 's/^.*developer\/debug\/valgrind@.*,//' )
70 [[ -z $tag ]] && fail
"Failed to find revision tag in $IPS_MANIFEST"
72 printf "Updating cloned sources to revision tag $tag... "
73 hg
--quiet update
-r $tag
74 (( $?
!= 0 )) && fail
"Failed to update cloned sources to tag $tag"
79 printf "Creating autotools support files... "
80 .
/autogen.sh
> $TMPDIR/autogen.log.stdout
2> $TMPDIR/autogen.log.stderr
81 (( $?
!= 0 )) && fail
"Failed to generate autotools support files"
86 printf "Running configure... "
87 .
/configure CC
='gcc -m64' CXX
='g++ -m64' --prefix=/usr
> $TMPDIR/configure.log
88 (( $?
!= 0 )) && fail
"Failed to run configure"
93 printf "Making docs... "
94 make --directory=docs html-docs
> $TMPDIR/make-docs.log.stdout
2> $TMPDIR/make-docs.log.stderr
95 (( $?
!= 0 )) && fail
"Failed to make html-docs"
99 run_make_man_pages
() {
100 printf "Making man pages... "
101 make --directory=docs man-pages
> $TMPDIR/make-man-pages.log.stdout
2> $TMPDIR/make-man-pages.log.stderr
102 (( $?
!= 0 )) && fail
"Failed to make man-pages"
107 printf "Running make... "
108 make --quiet > $TMPDIR/make.log
109 (( $?
!= 0 )) && fail
"Failed to run make"
114 printf "Running 'make install'... "
115 make --quiet install DESTDIR
=$INSTALLDIR > $TMPDIR/make-install.log
116 (( $?
!= 0 )) && fail
"Failed to run 'make install'"
118 cp AUTHORS COPYING
* NEWS NEWS.old README
* $INSTALLDIR/usr
/share
/doc
/valgrind
119 (( $?
!= 0 )) && fail
"Failed to copy additional files to $INSTALLDIR"
125 printf "Running pkglint... "
126 pkglint
-c $TMPDIR/lint-cache
-r $lint_repo_uri $SRCDIR/$IPS_MANIFEST > $TMPDIR/pkglint.log
127 (( $?
!= 0 )) && fail
"pkglint failed"
132 printf "Publishing package... "
133 pkgsend publish
-s $repo_uri -d $INSTALLDIR $SRCDIR/solaris
/valgrind.p5m
> $TMPDIR/pkgsend.log
134 (( $?
!= 0 )) && fail
"Failed to publish the package"
138 while getopts "r:s:" args
; do
144 lint_repo_uri
=$OPTARG
153 if [[ -z $repo_uri ]]; then
154 echo "No repo_uri specified.\n"
159 # Determine the lint repo_uri to use from the current 'solaris' one
160 # if not specified explicitly.
161 if [[ -z $lint_repo_uri ]]; then
162 publisher
=$
( pkg publisher |
grep solaris |
tr -s ' ' )
163 if [[ $publisher == *sticky
* ]]; then
164 lint_repo_uri
=$
( echo "$publisher" | cut
-d ' ' -f 6 )
166 lint_repo_uri
=$
( echo "$publisher" | cut
-d ' ' -f 5 )
168 [[ -z $lint_repo_uri ]] && fail
"Failed to determine solaris IPS publisher"
169 echo "lint_repo_uri determined as $lint_repo_uri"
178 update_sources_to_revision