From 23d1d96b705edde9e544fbc4c6cd1078d8ccb3e9 Mon Sep 17 00:00:00 2001 From: meep-eep Date: Sun, 15 May 2005 21:51:23 +0000 Subject: [PATCH] Install routine for MacOS X. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1776 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 1 + sc2/build/unix/build.config | 97 +++++++++++++++++++++++++++++++--- sc2/build/unix/build_functions | 5 ++ 3 files changed, 96 insertions(+), 7 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 52ad28bbb..c548c9ea3 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.4: +- Installation routine for MacOS X, from Nic. - Lots and lots of dialog fixes, from Nic. - Some speech is dependant on whether spoken voices are on, from Nic. - OpenAL header cleanup. Updating OpenAL may be necessary. diff --git a/sc2/build/unix/build.config b/sc2/build/unix/build.config index dce2e8e3b..fcbf61cc4 100644 --- a/sc2/build/unix/build.config +++ b/sc2/build/unix/build.config @@ -56,7 +56,18 @@ uqm_requirements() uqm_prepare_config() { # Describe the menu: - MENU_main_ITEMS="debug graphics sound ioformat install_path" + MENU_main_ITEMS="debug graphics sound ioformat" + case "$HOST_TYPE" in + Darwin) + # Installation directory not modifiable + ;; + MINGW32*) + # No install procedure available for MinGW + ;; + *) + MENU_main_ITEMS="$MENU_main_ITEMS install_path" + ;; + esac MENU_main_TITLE="Main menu" MENU_main_ITEM_debug_TYPE=CHOICE MENU_main_ITEM_graphics_TYPE=CHOICE @@ -213,12 +224,11 @@ uqm_process_config() { # Set INSTALL_LIBDIR, INSTALL_BINDIR, and INSTALL_SHAREDIR to the specified # values, replacing '$prefix' to the prefix set. - prefix="$INPUT_install_prefix_VALUE" \ - eval INSTALL_BINDIR="${INPUT_install_bindir_VALUE%/}/" - prefix="$INPUT_install_prefix_VALUE" \ - eval INSTALL_LIBDIR="${INPUT_install_libdir_VALUE%/}/" - prefix="$INPUT_install_prefix_VALUE" \ - eval INSTALL_SHAREDIR="${INPUT_install_sharedir_VALUE%/}/" + local prefix + prefix="$INPUT_install_prefix_VALUE" + eval INSTALL_BINDIR="${INPUT_install_bindir_VALUE%/}/" + eval INSTALL_LIBDIR="${INPUT_install_libdir_VALUE%/}/" + eval INSTALL_SHAREDIR="${INPUT_install_sharedir_VALUE%/}/" # Set the content dir CONTENTDIR="${INSTALL_SHAREDIR}uqm/content" @@ -284,8 +294,81 @@ uqm_pre_install() { : # Nothing to do } +uqm_install() { + case "$HOST_TYPE" in + Darwin) + uqm_install_osx + ;; + MINGW32*) + echo "No installation procedure available for MinGW." + echo "Read the manual for more information." + ;; + *) + generic_install + ;; + esac +} + uqm_post_install() { : # Nothing to do } +uqm_install_osx() { + local VERSION HEADERS HEADER FRAMEWORK + + VERSION=`head -1 content/version` + + INSTROOT="$BUILD_WORK/The Ur-Quan Masters.app/Contents" + + # Make directory structure + mkdirhier "$INSTROOT/MacOS" 0755 + mkdirhier "$INSTROOT/Frameworks" 0755 + mkdirhier "$INSTROOT/Resources/Launcher.nib" 0755 + mkdirhier "$INSTROOT/Resources/content/packages/addons" 0755 + + # Install misc. resources, icons, etc. + $SED "s/@@VERSION@@/$VERSION/g" src/res/darwin/Info.plist > \ + "$INSTROOT/Info.plist" + cp src/res/darwin/PkgInfo "$INSTROOT" + cp "src/res/darwin/The Ur-Quan Masters.icns" "$INSTROOT/Resources" + cp src/res/darwin/Launcher.nib/objects.nib \ + "$INSTROOT/Resources/Launcher.nib" + + # Find Frameworks and copy them into the application. + HEADERS="Ogg/Ogg.h SDL/SDL.h SDL_image/SDL_image.h Vorbis/vorbisfile.h" + if [ "$uqm_SOUNDMODULE" = openal ]; then + HEADERS="$HEADERS OpenAL/al.h" + fi + for HEADER in $HEADERS; do + HEADER=`basename $HEADER` + eval FRAMEWORK=`echo '' | \ + $COMPILE -E -D__MACOSX__ -include $HEADER - | \ + awk '(/'$HEADER'/ && $2 == 1) { print $3; exit }' | \ + $SED 's/.Headers.*$/"/'` + cp -r "$FRAMEWORK" "$INSTROOT/Frameworks" + done + + # Install game content (it should probably make a zipfile) + cp content/starcon.key content/version "$INSTROOT/Resources/content" + (cd content && \ + find .\( -name CVS -o -name packages \) -prune -o \ + \! \( -type d -o -name packages -o -name CVS -o \ + -name starcon.key -o -name version -o -name \*.ogg \) \ + -print | $SED 's/^..//' | zip -@ uqm-${VERSION}-prv-content.uqm) + mv content/uqm-$VERSION-prv-content.uqm "$INSTROOT/Resources/content/packages" + + (cd content && \ + find . -name \*\[0-9\]\[0-9\]\[0-9\].ogg -print \ + | $SED 's/^..//' | zip -0 -@ uqm-${VERSION}-prv-voice.uqm) + mv content/uqm-$VERSION-prv-voice.uqm "$INSTROOT/Resources/content/packages" + + (cd content && \ + find . -name \*.ogg -a \! -name \*\[0-9\]\[0-9\]\[0-9\].ogg \ + -print | $SED 's/^..//' | zip -0 -@ uqm-${VERSION}-prv-3domusic.uqm) + mv content/uqm-$VERSION-prv-3domusic.uqm "$INSTROOT/Resources/content/packages" + + # Install game binary (and rename it) + cp $uqm_NAME "$INSTROOT/MacOS/The Ur-Quan Masters" +} + diff --git a/sc2/build/unix/build_functions b/sc2/build/unix/build_functions index 480ec4f53..29088f1fc 100644 --- a/sc2/build/unix/build_functions +++ b/sc2/build/unix/build_functions @@ -321,6 +321,11 @@ installsome() { # Install the program build_install() { + eval "${TARGET}_install" +} + +# Generic installation routine +generic_install() { local SRC DEST MODE OWNER eval "${TARGET}_pre_install"