AARON SMITH’S CODE ENDEAVOR

Archive for September, 2009

Archiving Framework Versions In Xcode

Here’s a quick script you can use in Xcode to archive framework versions. This is specifically for getting around the problem when you clean the build target. When you clean the target, it removes everything and re-builds it - this removes all of the versions that were there before. So if you had version A, and B, and B is the latest version. Cleaning the target will delete version A. In my case, I want to make sure these versions are kept intact.

OUTPUT=archive/${FULL_PRODUCT_NAME}
FV=$FRAMEWORK_VERSION
VERSIONED_OUTPUT=${OUTPUT}/Versions/${FRAMEWORK_VERSION}
mkdir -p $VERSIONED_OUTPUT
cp -Rf ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}/Versions/${FRAMEWORK_VERSION}/* ${VERSIONED_OUTPUT}
cd ${OUTPUT}
rm -f $EXECUTABLE_NAME
ln -sf Versions/${FV}/${EXECUTABLE_NAME} $EXECUTABLE_NAME
rm -f Headers
ln -sf Versions/${FV}/Headers Headers
rm -f Resources
ln -sf Versions/${FV}/Resources Resources
cd Versions
rm -f Current
ln -sf ${FV} Current

After you change a Framework Version in xcode, you should clean the project, otherwise Xcode leaves around some dangling symlinks. Which will get copied into this archive. Not a big deal, but I don’t want any stragglers.

No comments

Doxygen on Snow Leopard

If installing doxygen from macports doesn’t work for you, you’ll have to build doxygen from source. Unfortunately you’ll get an error when building doxygen as well: “error This version of Mac OS X is unsupported”.

The fix is fairly straightforward:

-Download doxygen src
-Edit the file src/qglobal.h
-Find line 73 (we’re changing a chunk from this line)

Change this:

#if defined(__APPLE__) || defined(macintosh)
#define _OS_MAC_
#  ifdef MAC_OS_X_VERSION_MIN_REQUIRED
#    undef MAC_OS_X_VERSION_MIN_REQUIRED
#  endif
#  define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3
#  include <AvailabilityMacros.h>
#  if !defined(MAC_OS_X_VERSION_10_3)
#     define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1
#  endif
#  if !defined(MAC_OS_X_VERSION_10_4)
#       define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1
#  endif
#  if !defined(MAC_OS_X_VERSION_10_5)
#       define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1
#  endif
#  if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5)
#    error "This version of Mac OS X is unsupported"
#  endif
#elif defined(MSDOS) || defined(_MSDOS) || defined(__MSDOS__)

To this:

#if defined(__APPLE__) || defined(macintosh)
#define _OS_MAC_
#  ifdef MAC_OS_X_VERSION_MIN_REQUIRED
#    undef MAC_OS_X_VERSION_MIN_REQUIRED
#  endif
#  define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3
#  include <AvailabilityMacros.h>
#  if !defined(MAC_OS_X_VERSION_10_3)
#     define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1
#  endif
#  if !defined(MAC_OS_X_VERSION_10_4)
#       define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1
#  endif
#  if !defined(MAC_OS_X_VERSION_10_5)
#       define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1
#  endif
#  if !defined(MAC_OS_X_VERSION_10_6)
#       define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1
#  endif
#  if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6)
#    error "This version of Mac OS X is unsupported"
#  endif
#elif defined(MSDOS) || defined(_MSDOS) || defined(__MSDOS__)

All we did was add in a definition for 10.6.

Now run the install:

./configure
make
sudo make install
1 comment

Evironment Variables in Xcode

When you’re writing scripts in xcode you’ll need to know what environment variables xcode exposes.

Here’s how you can find them all:

-make a new empty xcode cocoa project
-add a new “run script build phase phase” to the app target
-add this as the script:

env > ENV

-build the project.

There will be file in the project directory called “ENV”, which lists all environment variables. Which comes in really handy as a reference.

1 comment