build-osx-framework.sh (17506B)
1 #!/bin/bash 2 3 # 4 # A script to build Extractor.framework for Mac OS X 5 # 6 # Copyright (C) 2008 Heikki Lindholm 7 # 8 # Run from the libextractor top source dir, e.g. 9 # > ./contrib/macosx/build-osx-framework.sh 10 # 11 # - 64-bit archs won't build on Mac OS X 10.4 (too many missing deps) 12 # 13 # TODO: 14 # - find a cleaner libtool workaround 15 # - error checking 16 # 17 18 SDK=MacOSX10.4u.sdk 19 ORIG_SDK=/Developer/SDKs/${SDK} 20 FW_NAME=Extractor.framework 21 FW_BASE_DIR=/Library/Frameworks/${FW_NAME} 22 BUILD_DIR=/tmp/Extractor-build 23 FINAL_FW_BASE_DIR="${BUILD_DIR}/Frameworks/${FW_NAME}" 24 SDK_PATH="${BUILD_DIR}/${SDK}" 25 OPT_FLAGS="-O2 -force_cpusubtype_ALL" 26 27 BUILD_ARCHS_LIST="ppc i386" 28 export MACOSX_DEPLOYMENT_TARGET=10.4 29 30 GNUMAKE_URL=ftp://ftp.gnu.org/pub/gnu/make 31 GNUMAKE_NAME=make-3.81 32 LIBTOOL_URL=ftp://ftp.gnu.org/gnu/libtool 33 LIBTOOL_NAME=libtool-2.2.4 34 GETTEXT_URL=ftp://ftp.gnu.org/gnu/gettext 35 GETTEXT_NAME=gettext-0.16.1 36 LIBOGG_URL=ftp://downloads.xiph.org/pub/xiph/releases/ogg 37 LIBOGG_NAME=libogg-1.1.3 38 LIBVORBIS_URL=ftp://downloads.xiph.org/pub/xiph/releases/vorbis 39 LIBVORBIS_NAME=libvorbis-1.2.0 40 LIBFLAC_URL=http://kent.dl.sourceforge.net/sourceforge/flac 41 LIBFLAC_NAME=flac-1.2.1 42 LIBMPEG2_URL=http://libmpeg2.sourceforge.net/files 43 LIBMPEG2_NAME=libmpeg2-0.5.1 44 45 export PATH=${BUILD_DIR}/toolchain/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin 46 47 # 48 # Fetch necessary packages 49 # 50 51 # $1 = package name 52 # $2 = base url 53 fetch_package() 54 { 55 if ! cd contrib 56 then 57 echo "missing 'contrib' dir" 58 exit 1 59 fi 60 if [ ! -e "$1.tar.bz2" ] && [ ! -e "$1.tar.gz" ] 61 then 62 echo "fetching $1..." 63 if ! ( curl -f -L -O --url "$2/$1.tar.bz2" ) 64 then 65 if ! ( curl -f -L -O --url "$2/$1.tar.gz" ) 66 then 67 echo "error fetching $1" 68 exit 1 69 fi 70 fi 71 fi 72 cd .. 73 } 74 75 fetch_all_packages() 76 { 77 fetch_package "${GNUMAKE_NAME}" "${GNUMAKE_URL}" 78 fetch_package "${GETTEXT_NAME}" "${GETTEXT_URL}" 79 fetch_package "${LIBOGG_NAME}" "${LIBOGG_URL}" 80 fetch_package "${LIBVORBIS_NAME}" "${LIBVORBIS_URL}" 81 fetch_package "${LIBFLAC_NAME}" "${LIBFLAC_URL}" 82 fetch_package "${LIBMPEG2_NAME}" "${LIBMPEG2_URL}" 83 } 84 85 # $1 = package name 86 # $2 = configure options 87 build_toolchain_package() 88 { 89 local build_retval=0 90 echo "building toolchain: $1..." 91 if ! cd contrib 92 then 93 echo "missing 'contrib' dir" 94 exit 1 95 fi 96 if [ -e "$1.tar.bz2" ] 97 then 98 if ! ( tar xjf "$1.tar.bz2" ) 99 then 100 echo "error extracting $1" 101 exit 1 102 fi 103 elif [ -e "$1.tar.gz" ] 104 then 105 if ! ( tar xzf "$1.tar.gz" ) 106 then 107 echo "error extracting $1" 108 exit 1 109 fi 110 else 111 echo "no such package $1" 112 exit 1 113 fi 114 CPPFLAGS="-I${BUILD_DIR}/toolchain/include" 115 LDFLAGS="-L${BUILD_DIR}/toolchain/lib" 116 if ! ( cd $1 && CPPFLAGS="${CPPFLAGS}" \ 117 LDFLAGS="${LDFLAGS}" \ 118 ./configure --prefix="${BUILD_DIR}/toolchain" \ 119 $2 && \ 120 make install ) 121 then 122 echo "error building $1 for toolchain" 123 build_retval=1 124 fi 125 unset CPPFLAGS 126 unset LDFLAGS 127 rm -rf "$1" 128 cd .. 129 if [ $build_retval -eq 1 ] 130 then 131 exit 1 132 fi 133 } 134 135 # 136 # build native tools needed for building other packages 137 # 138 build_toolchain() 139 { 140 141 if [ ! -e "${BUILD_DIR}/toolchain/bin/make" ] 142 then 143 build_toolchain_package ${GNUMAKE_NAME} "" 144 fi 145 146 if [ ! -e "${BUILD_DIR}/toolchain/bin/msgfmt" ] 147 then 148 build_toolchain_package "${GETTEXT_NAME}" \ 149 "--disable-java \ 150 --disable-native-java \ 151 --without-emacs" 152 fi 153 154 if [ ! -e "${BUILD_DIR}/toolchain/bin/dictionary-builder" ] 155 then 156 echo "building toolchain: dictionary-builder..." 157 if ! ( make clean && \ 158 ./configure --prefix="${BUILD_DIR}/toolchain" \ 159 --disable-gsf \ 160 --disable-gnome \ 161 --disable-exiv2 \ 162 --enable-printable && \ 163 make install && 164 cp src/plugins/printable/dictionary-builder \ 165 "${BUILD_DIR}/toolchain/bin" ) 166 then 167 exit 1 168 fi 169 fi 170 } 171 172 # 173 # prepare SDK 174 # 175 prepare_sdk() 176 { 177 if [ ! -e "${BUILD_DIR}" ] 178 then 179 if ! ( mkdir -p "${BUILD_DIR}" ) 180 then 181 echo "error creating build dir" 182 exit 1 183 fi 184 fi 185 186 if [ ! -e "${SDK_PATH}" ] 187 then 188 echo "copying SDK to build dir..." 189 if ! ( cp -ipPR "${ORIG_SDK}" "${BUILD_DIR}" ) 190 then 191 echo "error preparing SDK" 192 exit 1 193 fi 194 fi 195 196 if [ -h "${SDK_PATH}/Library/Frameworks" ] 197 then 198 if ! ( rm -f "${SDK_PATH}/Library/Frameworks" ) 199 then 200 echo "error removing SDK 'Frameworks' symlink" 201 exit 1 202 fi 203 if ! ( mkdir -p "${SDK_PATH}/Library/Frameworks" ) 204 then 205 echo "error creating SDK 'Frameworks' directory" 206 exit 1 207 fi 208 fi 209 } 210 211 prepare_package() 212 { 213 local prepare_retval=0 214 if [ ! -e "${BUILD_DIR}/built-$1-${ARCH_NAME}" ] 215 then 216 if ! cd contrib 217 then 218 echo "missing 'contrib' dir" 219 exit 1 220 fi 221 222 if [ ! -e "$1" ] 223 then 224 if [ -e "$1.tar.bz2" ] 225 then 226 if ! ( tar xjf "$1.tar.bz2" ) 227 then 228 echo "error extracting $1" 229 prepare_retval=1 230 fi 231 elif [ -e "$1.tar.gz" ] 232 then 233 if ! ( tar xzf "$1.tar.gz" ) 234 then 235 echo "error extracting $1" 236 prepare_retval=1 237 fi 238 else 239 echo "no such package $1" 240 prepare_retval=1 241 fi 242 fi 243 for patchfile in $( ls $1-patch-* 2> /dev/null | sort ) 244 do 245 echo "applying $patchfile..." 246 if ! ( cd $1 && cat "../$patchfile" | patch -p1 ) 247 then 248 echo "error patching $1" 249 prepare_retval=1 250 fi 251 done 252 253 cd .. 254 if [ $prepare_retval -eq 1 ] 255 then 256 exit 1 257 fi 258 fi 259 } 260 261 # $1 = package name 262 # $2 = configure options 263 build_package() 264 { 265 local build_retval=0 266 if [ ! -e "${BUILD_DIR}/built-$1-${ARCH_NAME}" ] 267 then 268 echo "building $1 for ${ARCH_NAME}..." 269 if ! cd contrib 270 then 271 echo "missing 'contrib' dir" 272 exit 1 273 fi 274 CC="${ARCH_CC}" 275 CXX="${ARCH_CXX}" 276 CPPFLAGS="${ARCH_CPPFLAGS}" 277 CFLAGS="${OPT_FLAGS} -no-cpp-precomp -fno-common -fPIC ${ARCH_CFLAGS}" 278 CXXFLAGS="${CFLAGS}" 279 LDFLAGS="${ARCH_LDFLAGS}" 280 if ! ( cd "$1" && CC="${CC}" \ 281 CXX="${CXX}" \ 282 CPPFLAGS="${CPPFLAGS}" \ 283 CFLAGS="${CFLAGS}" \ 284 CXXFLAGS="${CXXFLAGS}" \ 285 LDFLAGS="${LDFLAGS}" \ 286 ./configure $2 && \ 287 make DESTDIR="${SDK_PATH}" install && \ 288 touch "${BUILD_DIR}/built-$1-${ARCH_NAME}" ) 289 then 290 echo "error building $1 for ${ARCH_NAME}" 291 build_retval=1 292 fi 293 cp -v "$1/config.log" "${BUILD_DIR}/config.log-$1-${ARCH_NAME}" 294 cp -v "$1/config.h" "${BUILD_DIR}/config.h-$1-${ARCH_NAME}" 295 rm -rf "$1" 296 rm -v `find "${SDK_PATH}" -name "*.la"` 297 unset CC 298 unset CXX 299 unset CPPFLAGS 300 unset CFLAGS 301 unset CXXFLAGS 302 unset LDFLAGS 303 cd .. 304 if [ $build_retval -eq 1 ] 305 then 306 exit 1 307 fi 308 fi 309 } 310 311 # 312 # build dependencies 313 # 314 build_dependencies() 315 { 316 # prepare_package "${GETTEXT_NAME}" 317 # build_package "${GETTEXT_NAME}" \ 318 # "${ARCH_HOSTSETTING} \ 319 # --prefix="${FW_DIR}" \ 320 # --with-pic \ 321 # --disable-shared \ 322 # --enable-static \ 323 # --disable-java \ 324 # --disable-native-java \ 325 # --without-emacs \ 326 # --with-libiconv-prefix=${SDK_PATH}/usr" 327 328 prepare_package "${LIBOGG_NAME}" 329 build_package "${LIBOGG_NAME}" \ 330 "${ARCH_HOSTSETTING} \ 331 ac_cv_func_memcmp_working=yes \ 332 --prefix="${FW_DIR}" \ 333 --with-pic \ 334 --disable-shared \ 335 --enable-static" 336 337 prepare_package "${LIBVORBIS_NAME}" 338 build_package "${LIBVORBIS_NAME}" \ 339 "${ARCH_HOSTSETTING} \ 340 ac_cv_func_memcmp_working=yes \ 341 --prefix="${FW_DIR}" \ 342 --with-pic \ 343 --disable-shared \ 344 --enable-static \ 345 --disable-oggtest" 346 347 prepare_package "${LIBFLAC_NAME}" 348 build_package "${LIBFLAC_NAME}" \ 349 "${ARCH_HOSTSETTING} \ 350 --prefix="${FW_DIR}" \ 351 --with-pic \ 352 --disable-shared \ 353 --enable-static \ 354 --disable-debug \ 355 --disable-asm-optimizations \ 356 --disable-cpplibs \ 357 --disable-oggtest \ 358 --with-libiconv-prefix=${SDK_PATH}/usr" 359 360 prepare_package "${LIBMPEG2_NAME}" 361 build_package "${LIBMPEG2_NAME}" \ 362 "${ARCH_HOSTSETTING} \ 363 --prefix="${FW_DIR}" \ 364 --with-pic \ 365 --disable-shared \ 366 --enable-static \ 367 --disable-debug" 368 369 } 370 371 # 372 # build libextractor 373 # 374 build_extractor() 375 { 376 local build_retval=0 377 if [ ! -e "${BUILD_DIR}/built-Extractor-${ARCH_NAME}" ] 378 then 379 echo "building libextractor for ${ARCH_NAME}..." 380 ARCH_LDFLAGS="-arch ${ARCH_NAME} -isysroot ${SDK_PATH} -Wl,-syslibroot,${SDK_PATH} -L${FW_DIR}/lib" 381 CFLAGS="${OPT_FLAGS} -no-cpp-precomp ${ARCH_CFLAGS}" 382 CPPFLAGS="${ARCH_CPPFLAGS}" 383 CXXFLAGS="${CFLAGS}" 384 LDFLAGS="${ARCH_LDFLAGS}" 385 if ! ( CC="${ARCH_CC}" \ 386 CXX="${ARCH_CXX}" \ 387 CPPFLAGS="${CPPFLAGS}" \ 388 CFLAGS="${CFLAGS}" \ 389 CXXFLAGS="${CXXFLAGS}" \ 390 LDFLAGS="${LDFLAGS}" \ 391 NM="/usr/bin/nm -p" \ 392 ac_cv_func_memcmp_working=yes \ 393 ac_cv_func_mmap_fixed_mapped=yes \ 394 ac_cv_func_stat_empty_string_bug=no \ 395 ./configure "${ARCH_HOSTSETTING}" \ 396 --prefix="${FW_DIR}" \ 397 --enable-shared \ 398 --enable-framework \ 399 --disable-gsf \ 400 --disable-gnome \ 401 --enable-ffmpeg \ 402 --with-ffmpeg-arch="unknown" \ 403 --with-libiconv-prefix=${SDK_PATH}/usr ) 404 then 405 build_retval=1 406 fi 407 # XXX unbelievably fragile!!! 408 cp ./libtool ./libtool.tmp 409 cat ./libtool.tmp | \ 410 sed "s/found=yes/found=no/g;" | \ 411 sed "s|eval depdepl=\"\$tmp\/lib\$tmp_libs.dylib\"|if test \"x\$tmp\" = \"x\/usr\/lib\" ; then\\ 412 eval depdepl=\"${SDK_PATH}\/\$tmp\/lib\$tmp_libs.dylib\"\\ 413 else\\ 414 eval depdepl=\"\$tmp\/lib\$tmp_libs.dylib\"\\ 415 fi|g" > ./libtool 416 rm ./libtool.tmp 417 # use native dictionary-builder instead of the cross-built one 418 find ./ -type f -name "Makefile" | \ 419 xargs perl -pi -w -e "s#./dictionary-builder #${BUILD_DIR}/toolchain/bin/dictionary-builder #g;" 420 # add linking to libiconv where libintl is used 421 find ./ -type f -name "Makefile" | \ 422 xargs perl -pi -w -e "s#-lintl#-lintl -liconv#g;" 423 if ! ( test $build_retval = 0 && make clean && \ 424 make DESTDIR="${SDK_PATH}" install ) 425 then 426 build_retval=1 427 fi 428 # XXX version info for fw 429 if ! ( test $build_retval = 0 && \ 430 gcc -dynamiclib -install_name "${FW_DIR}/Extractor" \ 431 -compatibility_version 1 -current_version 1.0 \ 432 -o "${SDK_PATH}/${FW_DIR}/Extractor" \ 433 ${LDFLAGS} \ 434 -L"${SDK_PATH}/${FW_DIR}/lib" \ 435 -sub_library libextractor \ 436 -lextractor && \ 437 touch "${BUILD_DIR}/built-Extractor-${ARCH_NAME}" ) 438 then 439 build_retval=1 440 fi 441 442 cp -v config.log "${BUILD_DIR}/config.log-Extractor-${ARCH_NAME}" 443 cp -v config.h "${BUILD_DIR}/config.h-Extractor-${ARCH_NAME}" 444 unset CPPFLAGS 445 unset CFLAGS 446 unset CXXFLAGS 447 unset LDFLAGS 448 if [ $build_retval -eq 1 ] 449 then 450 exit 1 451 fi 452 fi 453 } 454 455 finalize_arch_build() 456 { 457 if [ ! -e "${SDK_PATH}/${FW_BASE_DIR}-${ARCH_NAME}" ] 458 then 459 if ! ( mv "${SDK_PATH}/${FW_BASE_DIR}" "${SDK_PATH}/${FW_BASE_DIR}-${ARCH_NAME}" ) 460 then 461 echo "error finalizing arch build" 462 exit 1 463 fi 464 fi 465 } 466 467 create_directory_for() 468 { 469 local dst_dir=$(dirname "$1") 470 if [ ! -e "${dst_dir}" ] 471 then 472 echo "MKDIR ${dst_dir}" 473 if ! ( mkdir -m 775 -p "${dst_dir}" ) 474 then 475 echo "failed to create directory: ${dst_dir}" 476 exit 1 477 fi 478 # fix dir permissions 479 if ! ( chmod 0775 `find ${FINAL_FW_BASE_DIR} -type d` ) 480 then 481 echo "error setting permissions" 482 exit 1 483 fi 484 fi 485 } 486 487 install_executable_to_framework() 488 { 489 local src_name="$1" 490 local src_files="" 491 local dst_file="${FINAL_FW_DIR}/${src_name}" 492 for arch in $BUILD_ARCHS_LIST 493 do 494 local tmpfile="${SDK_PATH}/${FW_BASE_DIR}-${arch}/${FW_VERSION_DIR}/${src_name}" 495 if [ -h "${tmpfile}" ] 496 then 497 install_file_to_framework $1 498 elif [ -f "${tmpfile}" ] 499 then 500 src_files="${tmpfile} ${src_files}" 501 else 502 echo "no such file: ${tmpfile}" 503 exit 1 504 fi 505 done 506 if [ "x${src_files}" != "x" ] 507 then 508 create_directory_for "${dst_file}" 509 local extralibs=$(otool -L ${src_files} | grep "compatibility version" |cut -d' ' -f 1 | sort | uniq -u) 510 if [ "x$extralibs" != "x" ] 511 then 512 echo "WARNING: linking difference" 513 echo "$extralibs" 514 fi 515 if [ ! -e "${dst_file}" ] && [ ! -h "${dst_file}" ] 516 then 517 echo "LIPO ${dst_file}" 518 if ! ( lipo -create -o "${dst_file}" ${src_files} ) 519 then 520 echo "error creating fat binary" 521 exit 1 522 fi 523 if ! ( chmod 0775 "${dst_file}" ) 524 then 525 echo "error settings permissions" 526 exit 1 527 fi 528 fi 529 fi 530 } 531 532 install_file_to_framework() 533 { 534 local src_name="$1" 535 for arch in $BUILD_ARCHS_LIST 536 do 537 local src_file="${SDK_PATH}/${FW_BASE_DIR}-${arch}/${FW_VERSION_DIR}/${src_name}" 538 local dst_file="${FINAL_FW_DIR}/${src_name}" 539 create_directory_for "${dst_file}" 540 if [ ! -e "${dst_file}" ] && [ ! -h "${dst_file}" ] 541 then 542 if [ -h "${src_file}" ] 543 then 544 echo "CP ${dst_file}" 545 if ! ( cp -PpR "${src_file}" "${dst_file}" ) 546 then 547 echo "error copying file" 548 exit 1 549 fi 550 elif [ -f "${src_file}" ] 551 then 552 echo "INSTALL ${dst_file}" 553 if ! ( install -m 0664 "${src_file}" "${dst_file}" ) 554 then 555 echo "error installing file" 556 exit 1 557 fi 558 else 559 echo "no such file: ${src_file}" 560 exit 1 561 fi 562 else 563 if [ -f "${src_file}" ] && [ ! -h "${src_file}" ] && [ -f "${dst_file}" ] && [ ! -h "${dst_file}" ] 564 then 565 diff -q "${src_file}" "${dst_file}" 566 fi 567 fi 568 done 569 } 570 571 install_message_catalog_to_framework() 572 { 573 local src_file="$1" 574 local lang_name=$( basename -s .po $src_file ) 575 local dst_file="${FINAL_FW_DIR}/Resources/${lang_name}.lproj/Localizable.strings" 576 if [ ! -e "$dst_file" ] 577 then 578 echo "MSGCAT $src_file $dst_file" 579 create_directory_for "$dst_file" 580 if ! ( msgcat -t UTF-8 --stringtable-output -o "$dst_file" "$src_file" ) 581 then 582 echo "error creating message catalog: $lang" 583 exit 1 584 fi 585 if ! ( chmod 0664 "${dst_file}" ) 586 then 587 echo "error setting permissions" 588 exit 1 589 fi 590 plutil -lint "$dst_file" 591 fi 592 } 593 594 install_en_message_catalog_to_framework() 595 { 596 local src_file="$1" 597 local lang_name="en" 598 local dst_file="${FINAL_FW_DIR}/Resources/${lang_name}.lproj/Localizable.strings" 599 if [ ! -e "$dst_file" ] 600 then 601 echo "MSGCAT $src_file $dst_file" 602 create_directory_for "$dst_file" 603 if ! ( msgcat -t UTF-8 "$src_file" | msgen --stringtable-output -o "$dst_file" - ) 604 then 605 echo "error creating English message catalog" 606 exit 1 607 fi 608 if ! ( chmod 0664 "${dst_file}" ) 609 then 610 echo "error setting permissions" 611 exit 1 612 fi 613 plutil -lint "$dst_file" 614 fi 615 } 616 617 copy_file_to_framework() 618 { 619 local src_file="$1" 620 local dst_file="${FINAL_FW_DIR}/$2" 621 if [ ! -e "$dst_file" ] 622 then 623 create_directory_for "$dst_file" 624 if ! ( install -m 0664 "$src_file" "$dst_file" ) 625 then 626 echo "error installing file" 627 exit 1 628 fi 629 fi 630 } 631 632 fill_framework_revision() 633 { 634 local dst_file="${FINAL_FW_DIR}/$1" 635 if [ -e "$dst_file" ] 636 then 637 if ! ( sed -e "s/@FRAMEWORK_REVISION@/${FW_VERSION_REV}/g" -i "" "$dst_file" ) 638 then 639 echo "sed error" 640 exit 1 641 fi 642 fi 643 } 644 645 make_framework_link() 646 { 647 local link_target="$1" 648 local link_name="$2" 649 echo "LN $link_name" 650 if ! ( cd "${FINAL_FW_DIR}" && ln -sf "$link_target" "$link_name" ) 651 then 652 echo "error creating link" 653 exit 1 654 fi 655 } 656 657 make_framework_version_links() 658 { 659 if ! ( cd "${FINAL_FW_BASE_DIR}/Versions" && \ 660 ln -sf "${FW_VERSION}" "Current" && \ 661 cd "${FINAL_FW_BASE_DIR}" && \ 662 ln -sf "Versions/Current/Headers" "Headers" && \ 663 ln -sf "Versions/Current/Extractor" "Extractor" && \ 664 ln -sf "Versions/Current/PlugIns" "PlugIns" && \ 665 ln -sf "Versions/Current/Resources" "Resources" ) 666 then 667 echo "error creating standard framework links" 668 exit 1 669 fi 670 } 671 672 FW_VERSION=`grep "LIB_VERSION_CURRENT=[0123456789]*" ./configure | cut -d= -f2` 673 FW_VERSION_DIR="Versions/${FW_VERSION}" 674 FW_DIR="${FW_BASE_DIR}/${FW_VERSION_DIR}" 675 FINAL_FW_DIR="${FINAL_FW_BASE_DIR}/${FW_VERSION_DIR}" 676 ORIG_DIR=$(pwd) 677 old_umask=$(umask) 678 679 if [ ! -n "$1" ] 680 then 681 FW_VERSION_REV="1" 682 else 683 FW_VERSION_REV="$1" 684 fi 685 686 # prepare build env 687 fetch_all_packages 688 umask 002 689 prepare_sdk 690 build_toolchain 691 692 # build deps and libextractor for all archs 693 for arch in $BUILD_ARCHS_LIST 694 do 695 ARCH_NAME=$arch 696 case "$arch" in 697 "ppc") 698 ARCH_HOSTSETTING="--host=powerpc-apple-darwin8" 699 ;; 700 "ppc64") 701 ARCH_HOSTSETTING="--host=powerpc64-apple-darwin8" 702 ;; 703 "i386") 704 ARCH_HOSTSETTING="--host=i686-apple-darwin8" 705 ;; 706 "x86_64") 707 ARCH_HOSTSETTING="--host=x86_64-apple-darwin8" 708 ;; 709 *) 710 echo "unknown architecture ${arch}" 711 exit 1 712 ;; 713 esac 714 ARCH_CC="gcc -arch ${ARCH_NAME} -isysroot ${SDK_PATH}" 715 ARCH_CXX="g++ -arch ${ARCH_NAME} -isysroot ${SDK_PATH}" 716 ARCH_CPPFLAGS="-I${SDK_PATH}/${FW_DIR}/include -isysroot ${SDK_PATH}" 717 ARCH_CFLAGS="-arch ${ARCH_NAME} -isysroot ${SDK_PATH}" 718 ARCH_LDFLAGS="-L${SDK_PATH}/${FW_DIR}/lib -arch ${ARCH_NAME} -isysroot ${SDK_PATH} -Wl,-syslibroot,${SDK_PATH}" 719 720 build_dependencies 721 build_extractor 722 finalize_arch_build 723 done 724 725 # build framework structure 726 first_arch=$(echo "$BUILD_ARCHS_LIST" | cut -d ' ' -f 1) 727 cd "${SDK_PATH}/${FW_BASE_DIR}-${first_arch}/${FW_VERSION_DIR}" 728 install_executable_to_framework 'bin/extract' 729 for tfn in lib/libextractor*dylib 730 do 731 install_executable_to_framework "$tfn" 732 done 733 install_executable_to_framework "Extractor" 734 for tfn in lib/libextractor/libextractor*so 735 do 736 install_executable_to_framework "$tfn" 737 done 738 install_file_to_framework 'include/extractor.h' 739 install_file_to_framework 'share/info/dir' 740 install_file_to_framework 'share/info/extractor.info' 741 install_file_to_framework 'share/man/man1/extract.1' 742 install_file_to_framework 'share/man/man3/libextractor.3' 743 cd "${ORIG_DIR}" 744 copy_file_to_framework "./contrib/macosx/Info.plist" "Resources/Info.plist" 745 fill_framework_revision "Resources/Info.plist" 746 for tfn in ./po/*.po 747 do 748 install_message_catalog_to_framework "$tfn" 749 done 750 install_en_message_catalog_to_framework "./po/libextractor.pot" 751 make_framework_link "lib" "Libraries" 752 make_framework_link "lib/libextractor" "PlugIns" 753 make_framework_link "include" "Headers" 754 make_framework_version_links 755 756 umask ${old_umask} 757 echo "done."