Changeset 1093
- Timestamp:
- Sep 15, 2011, 8:18:15 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
packaging/CreateZIPs.sh
r1060 r1093 12 12 # 13 13 14 out_dir=" tmp-zip"14 out_dir="." 15 15 16 16 cp="cp -Rdp" … … 34 34 local out_base="$2" # output directory base 35 35 local path="$3" # file path relative to $src_base, may be glob 36 local exclude="$4" # exclude pattern (relative to $src_base), 36 local tgt_path="$4" # target path if differs from path, if ends with slash 37 # only the dir part of path is changed 38 # [optional] 39 local exclude="$5" # exclude pattern (relative to $src_base), 37 40 # case syntax [optional] 38 local ext="$ 5" # additional extension of $path base to copy (e.g. .sym)39 # [optional 41 local ext="$6" # additional extension of $path base to copy (e.g. .sym) 42 # [optional] 40 43 41 44 [ -z "$src_base" -o -z "$out_base" -o -z "$path" ] && \ 42 45 die "cp_files: invalid arguments." 43 46 44 local path_dir="${path%/*}/" 45 [ "$path_dir" = "$path/" ] && path_dir= 46 47 [ -d "$out_base/$path_dir" ] || run mkdir -p "$out_base/$path_dir" 47 local path_dir="${path%/*}" 48 [ "$path_dir" = "$path" ] && path_dir=. 49 local path_file="${path##*/}" 50 51 if [ -n "$tgt_path" ]; then 52 local tgt_path_dir="${tgt_path%/*}" 53 [ "$tgt_path_dir" = "$tgt_path" ] && path_dir=. 54 local tgt_path_file="${tgt_path##*/}" 55 [ -z "$tgt_path_file" ] && tgt_path_file="$path_file" 56 else 57 local tgt_path_dir="$path_dir" 58 local tgt_path_file="$path_file" 59 fi 60 61 [ -d "$out_base/$tgt_path_dir" ] || run mkdir -p "$out_base/$tgt_path_dir" 62 63 # if path_file is a mask, reset tgt_path_file (to cp to just tgt_path_dir) 64 case "$path_file" in 65 *"*"*|*"?"*) tgt_path_file=;; 66 esac 48 67 49 68 # simple case? 50 69 if [ -z "$exclude" -a -z "$ext" ]; then 51 run $cp "$src_base/$path" "$out_base/$ path_dir"70 run $cp "$src_base/$path" "$out_base/$tgt_path_dir/$tgt_path_file" 52 71 return 53 72 fi … … 57 76 [ -z "$exclude" ] || \ 58 77 eval "case ${f#$src_base/} in $exclude) continue;; esac" 59 run $cp "$f" "$out_base/$ path_dir"60 [ -z "$ext" ] || run $cp "${f%.*}.$ext" "$out_base/$ path_dir"78 run $cp "$f" "$out_base/$tgt_path_dir/" 79 [ -z "$ext" ] || run $cp "${f%.*}.$ext" "$out_base/$tgt_path_dir/" 61 80 done 62 81 } 63 82 64 cp_files_inst_out() cp_files "$inst_base" "$out_base" "$1" "$2" "$3" 65 66 cp_exe_files_inst_out() cp_files "$inst_base" "$out_base" "$1" "$2" "sym" 67 68 cmd_cleanup() 69 { 70 [ -d "$out_dir" ] && \ 71 run rm -rf "$out_dir" 72 } 83 cp_files_inst_out() cp_files "$inst_base" "$out_base" "$1" "$2" "$3" "$4" 84 85 cp_exe_files_inst_out() cp_files "$inst_base" "$out_base" "$1" "$2" "$3" "sym" 73 86 74 87 split_out_sym() … … 84 97 for f in $(cd "$out_base" && find -type f -name "*.sym"); do 85 98 local fd="${f%/*}"/ 86 [ "$f p" = "$f/" ] && fd=99 [ "$fd" = "$f/" ] && fd= 87 100 [ -d "$out_base_sym/$fd" ] || run mkdir -p "$out_base_sym/$fd" 88 101 run mv "$out_base/$f" "$out_base_sym/$fd" … … 92 105 } 93 106 107 parse_version() 108 { 109 local spec_file="$start_dir/qt4.spec" 110 111 # get the version info from .spec 112 ver_major=$(sed -nre \ 113 "s/^%define ver_major[[:space:]]+([0-9]+).*$/\1/p" < "$spec_file") 114 ver_minor=$(sed -nre \ 115 "s/^%define ver_minor[[:space:]]+([0-9]+).*$/\1/p" < "$spec_file") 116 ver_patch=$(sed -nre \ 117 "s/^%define ver_patch[[:space:]]+([0-9]+).*$/\1/p" < "$spec_file") 118 os2_release=$(sed -nre \ 119 "s/^%define os2_release[[:space:]]+([0-9]+).*$/\1/p" < "$spec_file") 120 rpm_release=$(sed -nre \ 121 "s/^%define rpm_release[[:space:]]+([0-9]+).*$/\1/p" < "$spec_file") 122 123 [ -z "$ver_major" -o -z "$ver_minor" -o -z "$ver_patch" -o \ 124 -z "$os2_release" -o -z "$rpm_release" ] && \ 125 die "Could not determine version number in '$spec_file'." 126 127 ver_full_spec="$ver_major.$ver_minor.$ver_patch" 128 [ "$os2_release" != "0" ] && ver_full_spec="ver_full_spec.$os2_release" 129 ver_full_spec="$ver_full_spec-$rpm_release" 130 131 ver_full="$ver_full_spec" 132 [ -n "$build_num" ] && ver_full="${ver_full}_${build_num}" 133 } 134 135 cmd_cleanup() 136 { 137 parse_version 138 [ -z "$ver_full" ] && die "Version is not defined." 139 140 [ -d "$out_dir/$ver_full" ] && \ 141 run rm -rf "$out_dir/$ver_full" 142 } 143 94 144 create_zips() 95 145 { … … 98 148 die "create_zips: invalid arguments." 99 149 100 local out_base_sym="$out_dir/$full_pkg_name-debuginfo/$pkg_name-$ver_ dots"150 local out_base_sym="$out_dir/$full_pkg_name-debuginfo/$pkg_name-$ver_full" 101 151 102 152 # .SYM files … … 106 156 107 157 run cd "$out_base/.." 108 run zip -SrX9 "$full_pkg_name-$ver_ dots.zip" "$pkg_name-$ver_dots"109 run mv "$full_pkg_name-$ver_ dots.zip" "$start_dir/"158 run zip -SrX9 "$full_pkg_name-$ver_full.zip" "$pkg_name-$ver_full" 159 run mv "$full_pkg_name-$ver_full.zip" "$out_dir/.." 110 160 111 161 run cd "$out_base_sym/.." 112 run zip -SrX9 "$full_pkg_name-debuginfo-$ver_ dots.zip" "$pkg_name-$ver_dots"113 run mv "$full_pkg_name-debuginfo-$ver_ dots.zip" "$start_dir/"162 run zip -SrX9 "$full_pkg_name-debuginfo-$ver_full.zip" "$pkg_name-$ver_full" 163 run mv "$full_pkg_name-debuginfo-$ver_full.zip" "$out_dir/.." 114 164 115 165 run cd "$cwd" … … 119 169 { 120 170 local inst_base="$1" 121 local build_num="$2" 171 local out_dir="$2" 172 local build_num="$3" 122 173 123 174 [ -d "$inst_base" ] || die "'$inst_base' is not a directory." 124 125 local qconfig_pri="$inst_base/mkspecs/qconfig.pri" 126 127 [ -f "$qconfig_pri" ] || \ 128 die "Could not find file '$qconfig_pri'." 129 130 local ver_major=$(sed -nre \ 131 "s/^[[:space:]]*QT_MAJOR_VERSION[[:space:]]+=[[:space:]]+([0-9]+)[[:space:]]*$/\1/p" < "$qconfig_pri") 132 local ver_minor=$(sed -nre \ 133 "s/^[[:space:]]*QT_MINOR_VERSION[[:space:]]+=[[:space:]]+([0-9]+)[[:space:]]*$/\1/p" < "$qconfig_pri") 134 local ver_patch=$(sed -nre \ 135 "s/^[[:space:]]*QT_PATCH_VERSION[[:space:]]+=[[:space:]]+([0-9]+)[[:space:]]*$/\1/p" < "$qconfig_pri") 136 137 [ -z "$ver_major" -o -z "$ver_minor" -o -z "$ver_patch" ] && \ 138 die "Could not determine Qt version number in '$qconfig_pri'." 139 140 local ver_dots="$ver_major.$ver_minor.$ver_patch" 141 142 echo "Found Qt version: $ver_dots" 143 144 [ -n "$build_num" ] && ver_dots="$ver_dots-$build_num" 145 146 echo "Full version ID: $ver_dots" 175 [ -d "$out_dir" ] || die "'$out_dir' is not a directory." 176 177 parse_version 178 [ -z "$ver_full" ] && die "Version is not defined." 179 180 echo "Spec version: $ver_full_spec" 181 echo "Full version: $ver_full" 182 183 out_dir="$out_dir/tmp-zip-qt4-$ver_full" 147 184 148 185 cmd_cleanup … … 152 189 #-------------------------------------------------------------------------- 153 190 154 local pkg_name="qt" 155 156 local designer_dlls="bin/QtDsg*.dll" 157 local designer_plugin_dirs="designer|qmltooling" 191 local pkg_name="qt4" 192 193 local designer_dlls="QtDsg*.dll" 194 local designer_plugin_dirs="designer" 195 196 usr="@unixroot/usr" 158 197 159 198 #-------------------------------------------------------------------------- … … 161 200 #-------------------------------------------------------------------------- 162 201 163 local full_pkg_name="qt "164 local out_base="$out_dir/$full_pkg_name/$pkg_name-$ver_ dots"202 local full_pkg_name="qt4" 203 local out_base="$out_dir/$full_pkg_name/$pkg_name-$ver_full" 165 204 166 205 # Readmes 167 cp_files_inst_out " LGPL_EXCEPTION.txt"168 cp_files_inst_out " LICENSE.*"169 cp_files_inst_out " README"170 cp_files_inst_out " changes-$ver_major.$ver_minor.$ver_patch"171 cp_files_inst_out " README.OS2"172 cp_files_inst_out " CHANGES.OS2"206 cp_files_inst_out "$usr/share/doc/qt4/LGPL_EXCEPTION.txt" "./" 207 cp_files_inst_out "$usr/share/doc/qt4/LICENSE.*" "./" 208 cp_files_inst_out "$usr/share/doc/qt4/README" "./" 209 cp_files_inst_out "$usr/share/doc/qt4/changes-$ver_major.$ver_minor.$ver_patch" "./" 210 cp_files_inst_out "$usr/share/doc/qt4/README.OS2" "./" 211 cp_files_inst_out "$usr/share/doc/qt4/CHANGES.OS2" "./" 173 212 run $cp "$script_dir/INSTALL.OS2" "$out_base/" 174 213 175 214 # DLLs 176 cp_exe_files_inst_out " bin/Qt*.dll" "$designer_dlls"215 cp_exe_files_inst_out "$usr/lib/Qt*.dll" "bin/" "$usr/lib/$designer_dlls" 177 216 178 217 # Imports 179 cp_files_inst_out " imports"218 cp_files_inst_out "$usr/lib/qt4/imports" "./" 180 219 181 220 # Plugins 182 for d in $inst_base/ plugins/*; do221 for d in $inst_base/$usr/lib/qt4/plugins/*; do 183 222 local dn=${d##*/} 184 223 eval "case $dn in $designer_plugin_dirs) continue;; esac" 185 cp_exe_files_inst_out " plugins/$dn/*.dll"224 cp_exe_files_inst_out "$usr/lib/qt4/plugins/$dn/*.dll" "plugins/$dn/" 186 225 done 187 226 188 227 # Translations 189 cp_files_inst_out "translations/qt_*" 190 cp_files_inst_out "translations/qt_help_*" 191 cp_files_inst_out "translations/qtconfig_*" 228 cp_files_inst_out "$usr/share/qt4/translations/qt_??.qm" "translations/" 229 cp_files_inst_out "$usr/share/qt4/translations/qt_??_??.qm" "translations/" 230 cp_files_inst_out "$usr/share/qt4/translations/qt_help_??.qm" "translations/" 231 cp_files_inst_out "$usr/share/qt4/translations/qt_help_??_??.qm" "translations/" 192 232 193 233 # qt.conf … … 206 246 #-------------------------------------------------------------------------- 207 247 208 local full_pkg_name="qt -develop"209 local out_base="$out_dir/$full_pkg_name/$pkg_name-$ver_ dots"248 local full_pkg_name="qt4-devel-kit" 249 local out_base="$out_dir/$full_pkg_name/$pkg_name-$ver_full" 210 250 211 251 # Readmes 212 cp_files_inst_out " LGPL_EXCEPTION.txt"213 cp_files_inst_out " LICENSE.*"214 cp_files_inst_out " README"215 cp_files_inst_out " changes-$ver_major.$ver_minor.$ver_patch"216 cp_files_inst_out " README.OS2"217 cp_files_inst_out " CHANGES.OS2"252 cp_files_inst_out "$usr/share/doc/qt4/LGPL_EXCEPTION.txt" "./" 253 cp_files_inst_out "$usr/share/doc/qt4/LICENSE.*" "./" 254 cp_files_inst_out "$usr/share/doc/qt4/README" "./" 255 cp_files_inst_out "$usr/share/doc/qt4/changes-$ver_major.$ver_minor.$ver_patch" "./" 256 cp_files_inst_out "$usr/share/doc/qt4/README.OS2" "./" 257 cp_files_inst_out "$usr/share/doc/qt4/CHANGES.OS2" "./" 218 258 run $cp "$script_dir/INSTALL.OS2.develop" "$out_base/" 219 259 220 260 # EXEs & DLLs 221 cp_exe_files_inst_out "bin/*.exe" 222 cp_exe_files_inst_out "$designer_dlls" 261 cp_exe_files_inst_out "$usr/lib/qt4/bin/*.exe" "bin/" "$usr/lib/qt4/bin/qmake.exe" 262 cp_exe_files_inst_out "$usr/bin/*.exe" "bin/" 263 cp_exe_files_inst_out "$usr/lib/$designer_dlls" "bin/" 223 264 224 265 # Demos 225 cp_files_inst_out " demos"266 cp_files_inst_out "$usr/lib/qt4/demos" "./" 226 267 227 268 # Doc (no html, qch only) 228 cp_files_inst_out " doc/qch"229 cp_files_inst_out " q3porting.xml"269 cp_files_inst_out "$usr/share/qt4/doc/qch" "doc/" 270 cp_files_inst_out "$usr/share/qt4/q3porting.xml" "./" 230 271 231 272 # Examples 232 cp_files_inst_out " examples"273 cp_files_inst_out "$usr/lib/qt4/examples" "./" 233 274 234 275 # Includes 235 cp_files_inst_out " include"276 cp_files_inst_out "$usr/include" "./" 236 277 237 278 # Libraries 238 cp_files_inst_out " lib/*.prl"239 cp_files_inst_out " lib/*.lib"279 cp_files_inst_out "$usr/lib/Qt*.prl" "lib/" 280 cp_files_inst_out "$usr/lib/Qt*.lib" "lib/" 240 281 241 282 # Mkspecs 242 cp_files_inst_out " mkspecs"283 cp_files_inst_out "$usr/share/qt4/mkspecs" "./" 243 284 244 285 # Phrasebooks 245 cp_files_inst_out " phrasebooks"286 cp_files_inst_out "$usr/share/qt4/phrasebooks" "./" 246 287 247 288 # Plugins 248 for d in $inst_base/ plugins/*; do289 for d in $inst_base/$usr/lib/qt4/plugins/*; do 249 290 local dn=${d##*/} 250 291 eval "case $dn in $designer_plugin_dirs) ;; *) continue;; esac" 251 cp_exe_files_inst_out " plugins/$dn/*.dll"292 cp_exe_files_inst_out "$usr/lib/qt4/plugins/$dn/*.dll" "plugins/$dn/" 252 293 done 253 294 254 295 # Translations 255 cp_files_inst_out "translations/assistant_*" 256 cp_files_inst_out "translations/designer_*" 257 cp_files_inst_out "translations/linguist_*" 296 cp_files_inst_out "$usr/share/qt4/translations/assistant_??.qm" "translations/" 297 cp_files_inst_out "$usr/share/qt4/translations/assistant_??_??.qm" "translations/" 298 cp_files_inst_out "$usr/share/qt4/translations/designer_??.qm" "translations/" 299 cp_files_inst_out "$usr/share/qt4/translations/designer_??_??.qm" "translations/" 300 cp_files_inst_out "$usr/share/qt4/translations/linguist_??.qm" "translations/" 301 cp_files_inst_out "$usr/share/qt4/translations/linguist_??_??.qm" "translations/" 258 302 259 303 create_zips … … 289 333 Options: 290 334 <instdir> (*) Qt installation tree location 335 <outdir> Destination directory for ZIPs [$out_dir] 291 336 <bldnum> Build number [none] 292 337 " … … 297 342 all) 298 343 if [ -n "$2" ]; then 299 cmd_create $(echo "$2" | tr '\\' '/') "$3" 344 [ -n "$3" ] && out_dir=$(echo "$3" | tr '\\' '/') 345 cmd_create $(echo "$2" | tr '\\' '/') "$out_dir" "$4" 300 346 else 301 347 cmd_help
Note:
See TracChangeset
for help on using the changeset viewer.