diff options
author | Heikki Lindholm <holin@iki.fi> | 2008-06-25 18:28:14 +0000 |
---|---|---|
committer | Heikki Lindholm <holin@iki.fi> | 2008-06-25 18:28:14 +0000 |
commit | 22bc008d69362681802b4870f4f2a7c4b1a3dd64 (patch) | |
tree | 32f15a94d9aaa813c873a5fe9e25b00a3e23f24e /contrib | |
parent | ebd9e75ff1d538636ba595649e72537906ea842e (diff) | |
download | libextractor-22bc008d69362681802b4870f4f2a7c4b1a3dd64.tar.gz libextractor-22bc008d69362681802b4870f4f2a7c4b1a3dd64.zip |
better error checking, support for security patches to deps
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/macosx/build-osx-framework.sh | 174 |
1 files changed, 120 insertions, 54 deletions
diff --git a/contrib/macosx/build-osx-framework.sh b/contrib/macosx/build-osx-framework.sh index c130e10..838ec75 100755 --- a/contrib/macosx/build-osx-framework.sh +++ b/contrib/macosx/build-osx-framework.sh | |||
@@ -36,7 +36,7 @@ GETTEXT_NAME=gettext-0.16.1 | |||
36 | LIBOGG_URL=http://downloads.xiph.org/releases/ogg | 36 | LIBOGG_URL=http://downloads.xiph.org/releases/ogg |
37 | LIBOGG_NAME=libogg-1.1.3 | 37 | LIBOGG_NAME=libogg-1.1.3 |
38 | LIBVORBIS_URL=http://downloads.xiph.org/releases/vorbis | 38 | LIBVORBIS_URL=http://downloads.xiph.org/releases/vorbis |
39 | LIBVORBIS_NAME=libvorbis-1.1.2 | 39 | LIBVORBIS_NAME=libvorbis-1.2.0 |
40 | LIBFLAC_URL=http://switch.dl.sourceforge.net/sourceforge/flac | 40 | LIBFLAC_URL=http://switch.dl.sourceforge.net/sourceforge/flac |
41 | LIBFLAC_NAME=flac-1.2.1 | 41 | LIBFLAC_NAME=flac-1.2.1 |
42 | LIBMPEG2_URL=http://libmpeg2.sourceforge.net/files | 42 | LIBMPEG2_URL=http://libmpeg2.sourceforge.net/files |
@@ -52,16 +52,19 @@ export PATH=${BUILD_DIR}/toolchain/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/s | |||
52 | # $2 = base url | 52 | # $2 = base url |
53 | fetch_package() | 53 | fetch_package() |
54 | { | 54 | { |
55 | cd contrib | 55 | if ! cd contrib |
56 | if [ ! -e "$1.tar.gz" ] | ||
57 | then | 56 | then |
58 | echo "fetching $1..." | 57 | echo "missing 'contrib' dir" |
59 | curl -O --url "$2/$1.tar.gz" | 58 | exit 1 |
60 | fi | 59 | fi |
61 | if [ ! -e "$1.tar.gz" ] | 60 | if [ ! -e "$1.tar.gz" ] |
62 | then | 61 | then |
63 | echo "Could not fetch package: $1" | 62 | echo "fetching $1..." |
64 | exit 1 | 63 | if ! ( curl -O --url "$2/$1.tar.gz" ) |
64 | then | ||
65 | echo "error fetching $1" | ||
66 | exit 1 | ||
67 | fi | ||
65 | fi | 68 | fi |
66 | cd .. | 69 | cd .. |
67 | } | 70 | } |
@@ -159,32 +162,44 @@ prepare_sdk() | |||
159 | { | 162 | { |
160 | if [ ! -e "${BUILD_DIR}" ] | 163 | if [ ! -e "${BUILD_DIR}" ] |
161 | then | 164 | then |
162 | mkdir -p "${BUILD_DIR}" | 165 | if ! ( mkdir -p "${BUILD_DIR}" ) |
163 | fi | 166 | then |
164 | 167 | echo "error creating build dir" | |
165 | if [ ! -e "${SDK_PATH}" ] | 168 | exit 1 |
166 | then | 169 | fi |
167 | cp -ipPR "${ORIG_SDK}" "${BUILD_DIR}" | ||
168 | fi | 170 | fi |
169 | 171 | ||
170 | if [ ! -e "${SDK_PATH}" ] | 172 | if [ ! -e "${SDK_PATH}" ] |
171 | then | 173 | then |
172 | echo "error preparing sdk" | 174 | echo "copying SDK to build dir..." |
173 | exit 1 | 175 | if ! ( cp -ipPR "${ORIG_SDK}" "${BUILD_DIR}" ) |
176 | then | ||
177 | echo "error preparing SDK" | ||
178 | exit 1 | ||
179 | fi | ||
174 | fi | 180 | fi |
175 | 181 | ||
176 | if [ -h "${SDK_PATH}/Library/Frameworks" ] | 182 | if [ -h "${SDK_PATH}/Library/Frameworks" ] |
177 | then | 183 | then |
178 | rm -f "${SDK_PATH}/Library/Frameworks" | 184 | if ! ( rm -f "${SDK_PATH}/Library/Frameworks" ) |
185 | then | ||
186 | echo "error removing SDK 'Frameworks' symlink" | ||
187 | exit 1 | ||
188 | fi | ||
179 | fi | 189 | fi |
180 | } | 190 | } |
181 | 191 | ||
182 | prepare_package() | 192 | prepare_package() |
183 | { | 193 | { |
184 | prepare_retval=0 | 194 | local prepare_retval=0 |
185 | if [ ! -e "${BUILD_DIR}/built-$1-${ARCH_NAME}" ] | 195 | if [ ! -e "${BUILD_DIR}/built-$1-${ARCH_NAME}" ] |
186 | then | 196 | then |
187 | cd contrib | 197 | if ! cd contrib |
198 | then | ||
199 | echo "missing 'contrib' dir" | ||
200 | exit 1 | ||
201 | fi | ||
202 | |||
188 | if [ ! -e "$1" ] | 203 | if [ ! -e "$1" ] |
189 | then | 204 | then |
190 | if ! ( tar xzf "$1.tar.gz" ) | 205 | if ! ( tar xzf "$1.tar.gz" ) |
@@ -193,6 +208,16 @@ prepare_package() | |||
193 | prepare_retval=1 | 208 | prepare_retval=1 |
194 | fi | 209 | fi |
195 | fi | 210 | fi |
211 | for patchfile in $( ls $1-patch-* 2> /dev/null | sort ) | ||
212 | do | ||
213 | echo "applying $patchfile..." | ||
214 | if ! ( cd $1 && cat "../$patchfile" | patch -p0 && cd .. ) | ||
215 | then | ||
216 | echo "error patching $1" | ||
217 | prepare_retval=1 | ||
218 | fi | ||
219 | done | ||
220 | |||
196 | cd .. | 221 | cd .. |
197 | if [ $prepare_retval -eq 1 ] | 222 | if [ $prepare_retval -eq 1 ] |
198 | then | 223 | then |
@@ -205,12 +230,15 @@ prepare_package() | |||
205 | # $2 = configure options | 230 | # $2 = configure options |
206 | build_package() | 231 | build_package() |
207 | { | 232 | { |
208 | build_retval=0 | 233 | local build_retval=0 |
209 | if [ ! -e "${BUILD_DIR}/built-$1-${ARCH_NAME}" ] | 234 | if [ ! -e "${BUILD_DIR}/built-$1-${ARCH_NAME}" ] |
210 | then | 235 | then |
211 | echo "building $1 for ${ARCH_NAME}..." | 236 | echo "building $1 for ${ARCH_NAME}..." |
212 | cd contrib | 237 | if ! cd contrib/"$1" |
213 | cd "$1" | 238 | then |
239 | echo "missing \'contrib/$1\' dir" | ||
240 | exit 1 | ||
241 | fi | ||
214 | CC="${ARCH_CC}" | 242 | CC="${ARCH_CC}" |
215 | CXX="${ARCH_CXX}" | 243 | CXX="${ARCH_CXX}" |
216 | CPPFLAGS="${ARCH_CPPFLAGS}" | 244 | CPPFLAGS="${ARCH_CPPFLAGS}" |
@@ -302,7 +330,7 @@ build_dependencies() | |||
302 | # | 330 | # |
303 | build_extractor() | 331 | build_extractor() |
304 | { | 332 | { |
305 | build_retval=0 | 333 | local build_retval=0 |
306 | if [ ! -e "${BUILD_DIR}/built-Extractor-${ARCH_NAME}" ] | 334 | if [ ! -e "${BUILD_DIR}/built-Extractor-${ARCH_NAME}" ] |
307 | then | 335 | then |
308 | echo "building libextractor for ${ARCH_NAME}..." | 336 | echo "building libextractor for ${ARCH_NAME}..." |
@@ -361,13 +389,17 @@ finalize_arch_build() | |||
361 | { | 389 | { |
362 | if [ ! -e "${SDK_PATH}/${FW_BASE_DIR}-${ARCH_NAME}" ] | 390 | if [ ! -e "${SDK_PATH}/${FW_BASE_DIR}-${ARCH_NAME}" ] |
363 | then | 391 | then |
364 | mv "${SDK_PATH}/${FW_BASE_DIR}" "${SDK_PATH}/${FW_BASE_DIR}-${ARCH_NAME}" | 392 | if ! ( mv "${SDK_PATH}/${FW_BASE_DIR}" "${SDK_PATH}/${FW_BASE_DIR}-${ARCH_NAME}" ) |
393 | then | ||
394 | echo "error finalizing arch build" | ||
395 | exit 1 | ||
396 | fi | ||
365 | fi | 397 | fi |
366 | } | 398 | } |
367 | 399 | ||
368 | create_directory_for() | 400 | create_directory_for() |
369 | { | 401 | { |
370 | dst_dir=$(dirname "$1") | 402 | local dst_dir=$(dirname "$1") |
371 | if [ ! -e "${dst_dir}" ] | 403 | if [ ! -e "${dst_dir}" ] |
372 | then | 404 | then |
373 | echo "MKDIR ${dst_dir}" | 405 | echo "MKDIR ${dst_dir}" |
@@ -377,18 +409,22 @@ create_directory_for() | |||
377 | exit 1 | 409 | exit 1 |
378 | fi | 410 | fi |
379 | # fix dir permissions | 411 | # fix dir permissions |
380 | chmod 0755 `find ${FINAL_FW_BASE_DIR} -type d` | 412 | if ! ( chmod 0755 `find ${FINAL_FW_BASE_DIR} -type d` ) |
413 | then | ||
414 | echo "error setting permissions" | ||
415 | exit 1 | ||
416 | fi | ||
381 | fi | 417 | fi |
382 | } | 418 | } |
383 | 419 | ||
384 | install_executable_to_framework() | 420 | install_executable_to_framework() |
385 | { | 421 | { |
386 | src_name="$1" | 422 | local src_name="$1" |
387 | src_files="" | 423 | local src_files="" |
388 | dst_file="${FINAL_FW_DIR}/${src_name}" | 424 | local dst_file="${FINAL_FW_DIR}/${src_name}" |
389 | for arch in $BUILD_ARCHS_LIST | 425 | for arch in $BUILD_ARCHS_LIST |
390 | do | 426 | do |
391 | tmpfile="${SDK_PATH}/${FW_BASE_DIR}-${arch}/${FW_VERSION_DIR}/${src_name}" | 427 | local tmpfile="${SDK_PATH}/${FW_BASE_DIR}-${arch}/${FW_VERSION_DIR}/${src_name}" |
392 | if [ -h "${tmpfile}" ] | 428 | if [ -h "${tmpfile}" ] |
393 | then | 429 | then |
394 | install_file_to_framework $1 | 430 | install_file_to_framework $1 |
@@ -406,31 +442,51 @@ install_executable_to_framework() | |||
406 | if [ ! -e "${dst_file}" ] && [ ! -h "${dst_file}" ] | 442 | if [ ! -e "${dst_file}" ] && [ ! -h "${dst_file}" ] |
407 | then | 443 | then |
408 | echo "LIPO ${dst_file}" | 444 | echo "LIPO ${dst_file}" |
409 | lipo -create -o "${dst_file}" ${src_files} | 445 | if ! ( lipo -create -o "${dst_file}" ${src_files} ) |
410 | chmod 0755 "${dst_file}" | 446 | then |
447 | echo "error creating fat binary" | ||
448 | exit 1 | ||
449 | fi | ||
450 | if ! ( chmod 0755 "${dst_file}" ) | ||
451 | then | ||
452 | echo "error settings permissions" | ||
453 | exit 1 | ||
454 | fi | ||
411 | fi | 455 | fi |
412 | fi | 456 | fi |
413 | } | 457 | } |
414 | 458 | ||
415 | install_file_to_framework() | 459 | install_file_to_framework() |
416 | { | 460 | { |
417 | src_name="$1" | 461 | local src_name="$1" |
418 | for arch in $BUILD_ARCHS_LIST | 462 | for arch in $BUILD_ARCHS_LIST |
419 | do | 463 | do |
420 | src_file="${SDK_PATH}/${FW_BASE_DIR}-${arch}/${FW_VERSION_DIR}/${src_name}" | 464 | local src_file="${SDK_PATH}/${FW_BASE_DIR}-${arch}/${FW_VERSION_DIR}/${src_name}" |
421 | dst_file="${FINAL_FW_DIR}/${src_name}" | 465 | local dst_file="${FINAL_FW_DIR}/${src_name}" |
422 | create_directory_for "${dst_file}" | 466 | create_directory_for "${dst_file}" |
423 | if [ ! -e "${dst_file}" ] && [ ! -h "${dst_file}" ] | 467 | if [ ! -e "${dst_file}" ] && [ ! -h "${dst_file}" ] |
424 | then | 468 | then |
425 | if [ -h "${src_file}" ] | 469 | if [ -h "${src_file}" ] |
426 | then | 470 | then |
427 | echo "CP ${dst_file}" | 471 | echo "CP ${dst_file}" |
428 | cp -PpR "${src_file}" "${dst_file}" | 472 | if ! ( cp -PpR "${src_file}" "${dst_file}" ) |
429 | chmod 0755 "${dst_file}" | 473 | then |
474 | echo "error copying file" | ||
475 | exit 1 | ||
476 | fi | ||
477 | if ! ( chmod 0755 "${dst_file}" ) | ||
478 | then | ||
479 | echo "error setting permissions" | ||
480 | exit 1 | ||
481 | fi | ||
430 | elif [ -f "${src_file}" ] | 482 | elif [ -f "${src_file}" ] |
431 | then | 483 | then |
432 | echo "INSTALL ${dst_file}" | 484 | echo "INSTALL ${dst_file}" |
433 | install -m 0644 "${src_file}" "${dst_file}" | 485 | if ! ( install -m 0644 "${src_file}" "${dst_file}" ) |
486 | then | ||
487 | echo "error installing file" | ||
488 | exit 1 | ||
489 | fi | ||
434 | else | 490 | else |
435 | echo "no such file: ${src_file}" | 491 | echo "no such file: ${src_file}" |
436 | exit 1 | 492 | exit 1 |
@@ -446,37 +502,47 @@ install_file_to_framework() | |||
446 | 502 | ||
447 | copy_file_to_framework() | 503 | copy_file_to_framework() |
448 | { | 504 | { |
449 | src_file="$1" | 505 | local src_file="$1" |
450 | dst_file="${FINAL_FW_DIR}/$2" | 506 | local dst_file="${FINAL_FW_DIR}/$2" |
451 | if [ ! -e "$dst_file" ] | 507 | if [ ! -e "$dst_file" ] |
452 | then | 508 | then |
453 | create_directory_for "$dst_file" | 509 | create_directory_for "$dst_file" |
454 | install -m 0644 "$src_file" "$dst_file" | 510 | if ! ( install -m 0644 "$src_file" "$dst_file" ) |
511 | then | ||
512 | echo "error installing file" | ||
513 | exit 1 | ||
514 | fi | ||
455 | fi | 515 | fi |
456 | } | 516 | } |
457 | 517 | ||
458 | make_framework_link() | 518 | make_framework_link() |
459 | { | 519 | { |
460 | link_target="$1" | 520 | local link_target="$1" |
461 | link_name="$2" | 521 | local link_name="$2" |
462 | orig_dir=$(pwd) | 522 | local orig_dir=$(pwd) |
463 | cd "${FINAL_FW_DIR}" | ||
464 | echo "LN $link_name" | 523 | echo "LN $link_name" |
465 | ln -sf "$link_target" "$link_name" | 524 | if ! ( cd "${FINAL_FW_DIR}" && ln -sf "$link_target" "$link_name" && cd "${orig_dir}" ) |
466 | cd "${orig_dir}" | 525 | then |
526 | echo "error creating link" | ||
527 | exit 1 | ||
528 | fi | ||
467 | } | 529 | } |
468 | 530 | ||
469 | make_framework_version_links() | 531 | make_framework_version_links() |
470 | { | 532 | { |
471 | orig_dir=$(pwd) | 533 | orig_dir=$(pwd) |
472 | cd "${FINAL_FW_BASE_DIR}/Versions" | 534 | if ! ( cd "${FINAL_FW_BASE_DIR}/Versions" && \ |
473 | ln -sf "${FW_VERSION}" "Current" | 535 | ln -sf "${FW_VERSION}" "Current" && \ |
474 | cd "${FINAL_FW_BASE_DIR}" | 536 | cd "${FINAL_FW_BASE_DIR}" && \ |
475 | ln -sf "Versions/Current/Headers" "Headers" | 537 | ln -sf "Versions/Current/Headers" "Headers" && \ |
476 | ln -sf "Versions/Current/Extractor" "Extractor" | 538 | ln -sf "Versions/Current/Extractor" "Extractor" && \ |
477 | ln -sf "Versions/Current/PlugIns" "PlugIns" | 539 | ln -sf "Versions/Current/PlugIns" "PlugIns" && \ |
478 | ln -sf "Versions/Current/Resources" "Resources" | 540 | ln -sf "Versions/Current/Resources" "Resources" && \ |
479 | cd "${orig_dir}" | 541 | cd "${orig_dir}" ) |
542 | then | ||
543 | echo "error creating standard framework links" | ||
544 | exit 1 | ||
545 | fi | ||
480 | } | 546 | } |
481 | 547 | ||
482 | FW_VERSION=`grep "LIB_VERSION_CURRENT=[0123456789]*" ./configure | cut -d= -f2` | 548 | FW_VERSION=`grep "LIB_VERSION_CURRENT=[0123456789]*" ./configure | cut -d= -f2` |