Automated GTK+ build script

sed -i \~ -e ‘s/\\$.wl.-undefined \\$.wl.dynamic_lookup//g;s/-undefined dynamic_lookup//g’ libtool
… sed -i \~ -e ‘s/\\$.wl.-undefined \\$.wl.dynamic_lookup//g;s/-undefined dynamic_lookup//g’ libtool

As I wrote before, I wrote an automated GTK+ build script. GTK framework is already available from gtk-osx.org but I still need my own package because this is for Intel Macs only.

I think GTK’s Quartz support is enough stable now, so this script builds an Quartz-GTK.

To use this script,

  1. Put all archives you need in archive/
  2. Make /opt/gtk writable by your account
  3. Check whether your /tmp has enough capacity
  4. Then run this script, and do rm -rf /tmp/gtk

and you’ll get your GTK installation in /opt/gtk.


#!/bin/sh
export CPPFLAGS=’-I/opt/gtk/include’
export LDFLAGS=’-L/opt/gtk/lib’
export PATH=${DEST}/bin:${PATH}
export BASEDIR=`pwd`
unpack_cmd(){
echo $1 | awk -F. ‘{ \
i=NF;
}’
}
pre_configure(){
case “$1” in
jpeg|jasper)
cp /usr/bin/glibtool libtool
;;
libXrender)
#X11.app doesn’t provide x11.pc nor xproto.pc
sed -i \~ -e “/Requires.private: x11/d” \
-e “s/ *x11//g;s/ *xproto//g” \
-e “/^Cflags/s/$/ -I\/usr\/X11R6\/include/” \
-e “/^Libs/s/$/ -L\/usr\/X11R6\/lib -lX11/” \
xrender.pc.in
#MacOS X 10.4 doesn’t have Xregion.h, but it’s included in MacPorts.
cp /opt/local/var/macports/sources/rsync.macports.org/release/ports/x11/xrender/files/include/X11/Xregion.h ${DEST}/include/X11
export X_CFLAGS=’-I/usr/X11R6/include -DXTHREADS’
export X_LIBS=’-L/usr/X11R6/lib -lX11′
;;
esac
}
pre_build(){
case “$1” in
glib|atk|gtk+) # -undefined dynamic_lookup problem
if [ “$CXXFLAGS” = “-arch ppc” ]; then
sed -i \~ -e ‘s/\\$.wl.-undefined \\$.wl.dynamic_lookup//g;s/-undefined dynamic_lookup//g’ libtool
fi
;;
jpeg|jasper)
./configure –enable-shared –prefix=${DEST}
if [ “$(uname -p)” = “powerpc” -a “$1” = “jpeg” ]; then
sed -i \~ -e ‘s/\\$.wl.-undefined \\$.wl.dynamic_lookup//g;s/-undefined dynamic_lookup//g’ libtool
# sed -e ‘s/CC= gcc/CC= gcc -arch ppc/’ -i\~ Makefile;
fi
;;
esac
}
config_opts(){
case “$1” in
gtk+)
echo ‘–with-gdktarget=quartz’
;;
gtk-engines)
echo ‘–enable-animation’
;;
esac
}
post_build(){
case “$1″ in
libXrender)
unset X_CFLAGS
unset X_LIBS
rm ${DEST}/include/X11/Xregion.h
;;
esac
}
echo Cleaning up all intermediate directories…
mkdir -p $BUILDDIR
pushd $BUILDDIR
for PKG in $PKGS ; do
echo -n $PKG’ ‘
rm -rf ${PKG}*
done
echo ” ”
echo Extracting all archives…
for PKG in $PKGS ; do
echo -n $PKG’ ‘
$(unpack_cmd ${BASEDIR}/archive/${PKG}*) ${BASEDIR}/archive/${PKG}* || exit
done
echo ” ”
echo Building everything…
for PKG in $PKGS ; do
echo Building ${PKG}
cd ${PKG}*
pre_configure ${PKG}
./configure –prefix=${DEST} `config_opts ${PKG}` || exit
pre_build ${PKG}
make -j4 && make install || exit
post_build ${PKG}
cd ..
done
popd

コメントを残す