| [1061] | 1 | #!/bih/sh
|
|---|
| 2 |
|
|---|
| 3 | #
|
|---|
| 4 | # Qt4 distribution RPM archive creator.
|
|---|
| 5 | #
|
|---|
| 6 | # NOTE: This script requires the basic set of unix tools such as cp, mkdir,
|
|---|
| 7 | # pwd, readlink, find etc.
|
|---|
| 8 | #
|
|---|
| 9 |
|
|---|
| 10 | #
|
|---|
| 11 | # Defaults
|
|---|
| 12 | #
|
|---|
| 13 |
|
|---|
| [1079] | 14 | spec_file=qt4.spec
|
|---|
| [1068] | 15 |
|
|---|
| [1061] | 16 | #
|
|---|
| 17 | # Functions
|
|---|
| 18 | #
|
|---|
| 19 |
|
|---|
| 20 | die() { echo "ERROR: $@"; cd "$start_dir"; exit 1; }
|
|---|
| 21 |
|
|---|
| 22 | run()
|
|---|
| 23 | {
|
|---|
| 24 | echo "$@"
|
|---|
| 25 | "$@" || die \
|
|---|
| 26 | "Last command failed (exit status $?)."
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| [1068] | 29 | cmd_all()
|
|---|
| [1061] | 30 | {
|
|---|
| 31 | local src_base="$1"
|
|---|
| 32 |
|
|---|
| [1068] | 33 | run $env_cmd rpmbuild \
|
|---|
| 34 | -D "QT_SOURCE_TREE $src_base" \
|
|---|
| [1075] | 35 | -ba $spec_file
|
|---|
| [1061] | 36 | }
|
|---|
| 37 |
|
|---|
| [1068] | 38 | cmd_build()
|
|---|
| 39 | {
|
|---|
| 40 | local src_base="$1"
|
|---|
| 41 |
|
|---|
| [1075] | 42 | run $env_cmd rpmbuild \
|
|---|
| 43 | -D "QT_SOURCE_TREE $src_base" \
|
|---|
| 44 | -D "skip_prep_export 1" -D "skip_prep_clean 1" \
|
|---|
| 45 | --short-circuit -bc $spec_file
|
|---|
| 46 | }
|
|---|
| [1068] | 47 |
|
|---|
| [1075] | 48 | cmd_install()
|
|---|
| 49 | {
|
|---|
| 50 | local src_base="$1"
|
|---|
| 51 |
|
|---|
| [1068] | 52 | run $env_cmd rpmbuild \
|
|---|
| [1075] | 53 | -D "QT_SOURCE_TREE $src_base" \
|
|---|
| 54 | -D "skip_prep_export 1" -D "skip_prep_clean 1" \
|
|---|
| 55 | --short-circuit -bi $spec_file
|
|---|
| [1068] | 56 | }
|
|---|
| 57 |
|
|---|
| 58 | cmd_rpm()
|
|---|
| 59 | {
|
|---|
| 60 | run $env_cmd rpmbuild \
|
|---|
| [1075] | 61 | -D "skip_prep_export 1" -D "skip_prep_clean 1" \
|
|---|
| 62 | -D "skip_build 1" -D "skip_install 1" \
|
|---|
| 63 | --short-circuit -bb $spec_file
|
|---|
| [1068] | 64 | }
|
|---|
| 65 |
|
|---|
| [1061] | 66 | #
|
|---|
| 67 | # Main
|
|---|
| 68 | #
|
|---|
| 69 |
|
|---|
| 70 | script_path=$(readlink -e $0)
|
|---|
| 71 | script_dir=${script_path%/*}
|
|---|
| 72 | script_name=$(basename $0)
|
|---|
| 73 |
|
|---|
| 74 | start_dir=$(pwd)
|
|---|
| 75 |
|
|---|
| [1068] | 76 | [ -f "$start_dir/env.sh" ] && . "$start_dir/env.sh"
|
|---|
| 77 |
|
|---|
| 78 | env_cmd=
|
|---|
| 79 | [ -f "$start_dir/env.cmd" ] && env_cmd="cmd /c env.cmd"
|
|---|
| 80 |
|
|---|
| [1061] | 81 | # Parse arguments
|
|---|
| 82 |
|
|---|
| 83 | cmd_help()
|
|---|
| 84 | {
|
|---|
| 85 | echo \
|
|---|
| 86 | "
|
|---|
| 87 | Usage:
|
|---|
| [1068] | 88 | $script_name all <srcdir> Do everything (RPM, SRPM, ZIP)
|
|---|
| [1075] | 89 | $script_name build <srcdir> Build product (in BUILD/<product>)
|
|---|
| 90 | $script_name install <srcdir> Install product (to BUILDROOT/<product>)
|
|---|
| 91 | $script_name rpm Build RPMs only
|
|---|
| [1061] | 92 |
|
|---|
| 93 | Options:
|
|---|
| [1068] | 94 | <srcdir> Qt SVN source tree location
|
|---|
| [1061] | 95 | "
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | case "$1" in
|
|---|
| [1075] | 99 | all|build|install)
|
|---|
| [1061] | 100 | if [ -n "$2" ]; then
|
|---|
| [1075] | 101 | [ -d "$2" ] || die "'$2' is not a directory."
|
|---|
| [1068] | 102 | cmd_$1 $(echo "$2" | tr '\\' '/')
|
|---|
| [1061] | 103 | else
|
|---|
| 104 | cmd_help
|
|---|
| 105 | fi;;
|
|---|
| [1075] | 106 | rpm) cmd_rpm;;
|
|---|
| [1061] | 107 | -h|-?|--help|*) cmd_help;;
|
|---|
| 108 | esac
|
|---|
| 109 |
|
|---|
| 110 | # end of story
|
|---|
| 111 |
|
|---|
| 112 | exit 0
|
|---|