Wed, 14 Jan 2009 15:59:12 +0100
Correct and improve many buildconf and code logic blocks. In particular:
1. Document potential problems building with current binutils releases.
2. Document the flawed webkit and explain its temporary exclusion.
3. Document the edition of Qt which is built and installed.
4. Remove the Solaris x11_supdir logic as it is no longer found.
5. Correct several .pr[io] files including QMAKE_CXXFLAGS and INCPATH,
which previously caused preexisting Qt installations to deliver
erroneous old include and library logic instead of relying on
that of the currently building package. -I/opkg/include is now
placed at the end of the compile statements.
6. Don't trust the QMAKE_[INC|LIB]DIR_X11 identifiers in qmake.conf.
7. Allow more 64-bit builds and more properly identify the platform.
8. Place plugins (which are shared objects) in lib instead of share.
9. Build components as plugins when possible if with_shared is enabled.
10. Translate German text to English to be more consistent.
11. Instead of removing the pkgconfig directory of with_shared builds,
place it in a child directory useful for shared building.
12. Document the nonstandard shared build directory structure,
including using the hidden pkgconfig directory (PKG_CONFIG_PATH.)
13. Change %doc to specify files rather than directories in the RPM DB.
michael@13 | 1 | #!/bin/sh |
michael@13 | 2 | ## |
michael@13 | 3 | ## OpenPKG Binary Bootstrap Package (self-extracting shell script) |
michael@13 | 4 | ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@13 | 5 | ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> |
michael@13 | 6 | ## |
michael@13 | 7 | ## Permission to use, copy, modify, and distribute this software for |
michael@13 | 8 | ## any purpose with or without fee is hereby granted, provided that |
michael@13 | 9 | ## the above copyright notice and this permission notice appear in all |
michael@13 | 10 | ## copies. |
michael@13 | 11 | ## |
michael@13 | 12 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@13 | 13 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@13 | 14 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@13 | 15 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@13 | 16 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@13 | 17 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@13 | 18 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@13 | 19 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@13 | 20 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@13 | 21 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@13 | 22 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@13 | 23 | ## SUCH DAMAGE. |
michael@13 | 24 | ## |
michael@13 | 25 | |
michael@13 | 26 | # configuration |
michael@13 | 27 | l_me="$0" |
michael@13 | 28 | o_help=no |
michael@13 | 29 | o_version=no |
michael@13 | 30 | o_tar=no |
michael@13 | 31 | l_prefix='@l_prefix@' |
michael@13 | 32 | l_musr='@MUSR@' |
michael@13 | 33 | l_mgrp='@MGRP@' |
michael@13 | 34 | l_platform="@l_platform@" |
michael@13 | 35 | l_release="@l_release@" |
michael@13 | 36 | l_version="@l_version@" |
michael@13 | 37 | |
michael@13 | 38 | # establish standard environment |
michael@13 | 39 | PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin" |
michael@13 | 40 | LC_CTYPE=C |
michael@13 | 41 | export LC_CTYPE |
michael@13 | 42 | umask 022 |
michael@13 | 43 | |
michael@13 | 44 | # parse command line options |
michael@13 | 45 | for opt |
michael@13 | 46 | do |
michael@13 | 47 | case $opt in |
michael@13 | 48 | -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;; |
michael@13 | 49 | *) arg='' ;; |
michael@13 | 50 | esac |
michael@13 | 51 | case $opt in |
michael@13 | 52 | -h | --help ) o_help=yes ;; |
michael@13 | 53 | -v | --version ) o_version=yes ;; |
michael@13 | 54 | -t | --tar ) o_tar=yes ;; |
michael@13 | 55 | --prefix=* ) l_prefix=$arg ;; |
michael@13 | 56 | * ) o_help=yes ;; |
michael@13 | 57 | esac |
michael@13 | 58 | done |
michael@13 | 59 | if [ ".$o_version" = .no -a ".$l_prefix" = . ]; then |
michael@13 | 60 | o_help=yes |
michael@13 | 61 | fi |
michael@13 | 62 | if [ ".$o_help" = .yes ]; then |
michael@13 | 63 | echo "Usage: sh $l_me" 2>&1 |
michael@13 | 64 | echo " [--prefix=<prefix>] [-t|--tar]" 2>&1 |
michael@13 | 65 | echo " [-h|--help] [-v|--version]" 2>&1 |
michael@13 | 66 | exit 1 |
michael@13 | 67 | fi |
michael@13 | 68 | |
michael@13 | 69 | # make sure all essential installation tools are available |
michael@13 | 70 | for tool in sed mkdir dd tar chown chgrp; do |
michael@13 | 71 | found=no |
michael@13 | 72 | case $tool in |
michael@13 | 73 | /* ) |
michael@13 | 74 | if [ -f $tool ]; then |
michael@13 | 75 | found=yes |
michael@13 | 76 | fi |
michael@13 | 77 | ;; |
michael@13 | 78 | * ) |
michael@13 | 79 | for p in `IFS=:; echo $PATH`; do |
michael@13 | 80 | if [ -f "$p/$tool" ]; then |
michael@13 | 81 | found=yes |
michael@13 | 82 | break |
michael@13 | 83 | fi |
michael@13 | 84 | done |
michael@13 | 85 | ;; |
michael@13 | 86 | esac |
michael@13 | 87 | if [ ".$found" = .no ]; then |
michael@13 | 88 | echo "$l_me:ERROR: unable to find installation tool \"$tool\"" 1>&2 |
michael@13 | 89 | exit 1 |
michael@13 | 90 | fi |
michael@13 | 91 | done |
michael@13 | 92 | |
michael@13 | 93 | # optionally extract the embedded tarball only |
michael@13 | 94 | if [ ".$o_tar" = .yes ]; then |
michael@13 | 95 | tmpdir="${TMPDIR-/tmp}/openpkg.$$" |
michael@13 | 96 | ( umask 077 && mkdir $tmpdir) || exit 1 |
michael@13 | 97 | dd if=$l_me bs=8192 skip=8 2>/dev/null |\ |
michael@13 | 98 | ( cd $tmpdir || exit 1 |
michael@13 | 99 | tar xf - 2>/dev/null || exit 1 |
michael@13 | 100 | ./openpkg.bzip2 -d -c openpkg.tar.bz2 |
michael@13 | 101 | ) || exit 1 |
michael@13 | 102 | rm -rf $tmpdir |
michael@13 | 103 | exit 0 |
michael@13 | 104 | fi |
michael@13 | 105 | |
michael@13 | 106 | # display version and copyright header |
michael@13 | 107 | echo "OpenPKG ${l_release} Binary Bootstrap Package, version ${l_version}" |
michael@13 | 108 | echo "Built for prefix ${l_prefix} on target platform ${l_platform}" |
michael@13 | 109 | if [ ".$o_version" = .yes ]; then |
michael@13 | 110 | exit 0 |
michael@13 | 111 | fi |
michael@13 | 112 | |
michael@13 | 113 | # determine current username |
michael@13 | 114 | cusr=`(id -un) 2>/dev/null ||\ |
michael@13 | 115 | (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ |
michael@13 | 116 | (whoami) 2>/dev/null ||\ |
michael@13 | 117 | (who am i | cut "-d " -f1) 2>/dev/null ||\ |
michael@13 | 118 | echo ${LOGNAME-"NN"}` |
michael@13 | 119 | |
michael@13 | 120 | # running the embedded %pre script for hooking into the system environment |
michael@13 | 121 | echo "++ hooking OpenPKG instance into system environment" |
michael@13 | 122 | prefix="$l_prefix" |
michael@13 | 123 | susr='@SUSR@'; sgrp='@SGRP@' |
michael@13 | 124 | musr='@MUSR@'; mgrp='@MGRP@' |
michael@13 | 125 | rusr='@RUSR@'; rgrp='@RGRP@' |
michael@13 | 126 | nusr='@NUSR@'; ngrp='@NGRP@' |
michael@13 | 127 | suid='@SUID@'; sgid='@SGID@' |
michael@13 | 128 | muid='@MUID@'; mgid='@MGID@' |
michael@13 | 129 | ruid='@RUID@'; rgid='@RGID@' |
michael@13 | 130 | nuid='@NUID@'; ngid='@NGID@' |
michael@13 | 131 | set -- 1 # emulate RPM's $1 when executing scripts |
michael@13 | 132 | # ---- BEGIN EMBEDDED %pre SCRIPT ---- |
michael@13 | 133 | @PRE@ |
michael@13 | 134 | # ---- END EMBEDDED %pre SCRIPT ---- |
michael@13 | 135 | |
michael@13 | 136 | # make sure prefix/root directory exists |
michael@13 | 137 | # and has correct permissions and owner/group |
michael@13 | 138 | if [ ! -d $l_prefix ]; then |
michael@13 | 139 | # create prefix/root directory from scratch |
michael@13 | 140 | echo "++ creating OpenPKG instance root directory \"$l_prefix\"" |
michael@13 | 141 | d='' |
michael@13 | 142 | for c in `IFS=/; echo $l_prefix`; do |
michael@13 | 143 | d="$d/$c" |
michael@13 | 144 | if [ ! -d $d ]; then |
michael@13 | 145 | mkdir $d || exit 1 |
michael@13 | 146 | chmod 755 $d || exit 1 |
michael@13 | 147 | if [ ".$cusr" = .root ]; then |
michael@13 | 148 | chown $musr $d >/dev/null 2>&1 || true |
michael@13 | 149 | chgrp $mgrp $d >/dev/null 2>&1 || true |
michael@13 | 150 | fi |
michael@13 | 151 | fi |
michael@13 | 152 | done |
michael@13 | 153 | else |
michael@13 | 154 | # adjust already existing prefix/root directory |
michael@13 | 155 | echo "++ fixating OpenPKG instance root directory \"$l_prefix\"" |
michael@13 | 156 | ( cd $l_prefix || exit 1 |
michael@13 | 157 | chmod 755 . || exit 1 |
michael@13 | 158 | if [ ".$cusr" = .root ]; then |
michael@13 | 159 | chown $musr . >/dev/null 2>&1 || true |
michael@13 | 160 | chgrp $mgrp . >/dev/null 2>&1 || true |
michael@13 | 161 | fi |
michael@13 | 162 | ) || exit 1 |
michael@13 | 163 | fi |
michael@13 | 164 | |
michael@13 | 165 | # extract and install binary distribution files |
michael@13 | 166 | echo "++ extracting OpenPKG binary distribution" |
michael@13 | 167 | dd if=$l_me bs=8192 skip=8 2>/dev/null |\ |
michael@13 | 168 | (cd $l_prefix; tar xf - 2>/dev/null) |
michael@13 | 169 | echo "++ installing OpenPKG binary distribution" |
michael@13 | 170 | ( cd $l_prefix || exit 1 |
michael@13 | 171 | ./openpkg.bzip2 -d -c openpkg.tar.bz2 | ./openpkg.tar xf - 2>/dev/null |
michael@13 | 172 | rm -f openpkg.tar openpkg.bzip2 openpkg.tar.bz2 >/dev/null 2>&1 || true |
michael@13 | 173 | ) || exit 1 |
michael@13 | 174 | |
michael@13 | 175 | # fixate installation files |
michael@13 | 176 | # (ATTENTION: order of chgrp/chown and chmod is important because of "set-UID" bits) |
michael@13 | 177 | echo "++ fixating OpenPKG instance filesystem hierarchy" |
michael@13 | 178 | ( echo 'fixate () {' |
michael@13 | 179 | echo ' chgrp "$3" "$4"' |
michael@13 | 180 | echo ' chown "$2" "$4"' |
michael@13 | 181 | echo ' chmod "$1" "$4"' |
michael@13 | 182 | echo '}' |
michael@13 | 183 | $l_prefix/bin/openpkg --keep-privileges rpm -q openpkg \ |
michael@13 | 184 | --qf '[fixate %7.7{FILEMODES:octal} %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape} ::%{FILENAMES:shescape}\n]' |\ |
michael@13 | 185 | grep -v '(none)' | sed 's/^fixate .../fixate /' | sed -e "s; ::\\(.\\)@l_prefix@; \\1$l_prefix;" |
michael@13 | 186 | ) | sh 2>/dev/null || true |
michael@13 | 187 | |
michael@13 | 188 | # running the embedded %post script |
michael@13 | 189 | echo "++ post-processing OpenPKG bootstrap installation" |
michael@13 | 190 | prefix="$l_prefix" |
michael@13 | 191 | susr='@SUSR@'; sgrp='@SGRP@' |
michael@13 | 192 | musr='@MUSR@'; mgrp='@MGRP@' |
michael@13 | 193 | rusr='@RUSR@'; rgrp='@RGRP@' |
michael@13 | 194 | nusr='@NUSR@'; ngrp='@NGRP@' |
michael@13 | 195 | suid='@SUID@'; sgid='@SGID@' |
michael@13 | 196 | muid='@MUID@'; mgid='@MGID@' |
michael@13 | 197 | ruid='@RUID@'; rgid='@RGID@' |
michael@13 | 198 | nuid='@NUID@'; ngid='@NGID@' |
michael@13 | 199 | set -- 1 # emulate RPM's $1 when executing scripts |
michael@13 | 200 | # ---- BEGIN EMBEDDED %post SCRIPT ---- |
michael@13 | 201 | @POST@ |
michael@13 | 202 | # ---- END EMBEDDED %post SCRIPT ---- |
michael@13 | 203 | |
michael@13 | 204 | # display final information |
michael@13 | 205 | ( echo "Congratulations!" |
michael@13 | 206 | echo "" |
michael@13 | 207 | echo "You have successfully installed an OpenPKG ${l_release} instance" |
michael@13 | 208 | echo "under prefix ${l_prefix} on target platform ${l_platform}." |
michael@13 | 209 | echo "" |
michael@13 | 210 | echo "For details about this OpenPKG instance, run any of the" |
michael@13 | 211 | echo "following typical OpenPKG RPM query commands:" |
michael@13 | 212 | echo "" |
michael@13 | 213 | echo " \$ ${l_prefix}/bin/openpkg rpm -qa" |
michael@13 | 214 | echo " \$ ${l_prefix}/bin/openpkg rpm -qi openpkg" |
michael@13 | 215 | echo " \$ ${l_prefix}/bin/openpkg rpm -qlv openpkg" |
michael@13 | 216 | echo "" |
michael@13 | 217 | echo "To check the integrity of the entire OpenPKG instance," |
michael@13 | 218 | echo "run the following OpenPKG RPM verify command:" |
michael@13 | 219 | echo "" |
michael@13 | 220 | echo " \$ ${l_prefix}/bin/openpkg rpm -Va" |
michael@13 | 221 | echo "" |
michael@13 | 222 | echo "To install software packages into this OpenPKG instance, run" |
michael@13 | 223 | echo "the following two OpenPKG RPM build commands for each package:" |
michael@13 | 224 | echo "" |
michael@13 | 225 | echo " \$ ${l_prefix}/bin/openpkg rpm --rebuild /path/to/foo-*.src.rpm" |
michael@13 | 226 | echo " \$ ${l_prefix}/bin/openpkg rpm -Uvh ${l_prefix}/RPM/PKG/foo-*.rpm" |
michael@13 | 227 | echo "" |
michael@13 | 228 | echo "To remove a software package later, just run:" |
michael@13 | 229 | echo "" |
michael@13 | 230 | echo " \$ ${l_prefix}/bin/openpkg rpm -e foo" |
michael@13 | 231 | echo "" |
michael@13 | 232 | echo "To remove the whole OpenPKG instance under prefix ${l_prefix}," |
michael@13 | 233 | echo "just remove every package as shown above. As you finally" |
michael@13 | 234 | echo "remove the package \"openpkg\", the OpenPKG instance itself" |
michael@13 | 235 | echo "will be unlinked from the system and removed as well." |
michael@13 | 236 | echo "" |
michael@13 | 237 | echo "Thank you for flying OpenPKG..." |
michael@13 | 238 | echo " Ralf S. Engelschall" |
michael@13 | 239 | echo " The OpenPKG Project" |
michael@13 | 240 | echo " openpkg@openpkg.org" |
michael@13 | 241 | ) | $l_prefix/lib/openpkg/rpmtool msg -b -t info |
michael@13 | 242 | |
michael@13 | 243 | # die explicitly just before the shell would discover |
michael@13 | 244 | # that we carry mega-bytes of data with us... ;-) |
michael@13 | 245 | exit 0 |
michael@13 | 246 | |
michael@13 | 247 | # the distribution tarball is appended in raw format directly to the |
michael@13 | 248 | # end of this script, just leaded by padding whitespaces which make |
michael@13 | 249 | # sure that the tarball data starts at the pre-defined offset of 64KB. |
michael@13 | 250 | # This allows us to unpack the tarball by just skipping the leading |
michael@13 | 251 | # 64KB (= 8192*8, see above). |
michael@13 | 252 |