Make --post create a basic Mac OS X application bundle with a shell script

that executes the bundled program.

Change the defaults for Quartz, threading, large file support, XDBE, Xft,
and Xinerama to "yes".

Remove the old Mac OS X resource fork file.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6142 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2008-07-13 21:39:07 +00:00
parent d2d7daa20a
commit ba2e9f3375
9 changed files with 90 additions and 100 deletions

20
CHANGES
View File

@ -1,17 +1,20 @@
CHANGES IN FLTK 1.3.0
- added scroll_to() to Fl_Scroll, replacing position()
- "fltk-config --post foo" now creates an application
bundle rather than attaching a resource fork.
- Added scroll_to() to Fl_Scroll, replacing position()
which now behaves as it should (STR #1303)
- fixed Fl_Scroll inside Fl_Scroll (STR #265)
- hardcoded 1.1 references in src/Makefile to 1.3
- Fixed Fl_Scroll inside Fl_Scroll (STR #265)
- Hardcoded 1.1 references in src/Makefile to 1.3
(STR #1922)
- changed font index to 32 bit
- changed font size to 32 bit
- changed widget coordinates to 32 bit
- added support for shortcuts for Fl_Input_,
- Changed font index to 32 bit
- Changed font size to 32 bit
- Changed widget coordinates to 32 bit
- Added support for shortcuts for Fl_Input_,
Fl_Value_Input, and Fl_Text_Display derived
widgets (STR #1770)
- initial setup (STR #1904)
- Initial setup (STR #1904)
CHANGES IN FLTK 1.1.9
@ -25,6 +28,7 @@ CHANGES IN FLTK 1.1.9
- Fixed MSWindows crash when selecting umlauts
in Fl_Help_View (STR #1912)
CHANGES IN FLTK 1.1.8
- Documentation fixes (STR #1454, STR #1455, STR #1456,

View File

@ -3,7 +3,7 @@
#
# Header makefile for the Fast Light Tool Kit (FLTK).
#
# Copyright 1998-2007 by Bill Spitzak and others.
# Copyright 1998-2008 by Bill Spitzak and others.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@ -37,7 +37,7 @@ install:
echo "Installing include files in $(DESTDIR)$(includedir)..."
$(RMDIR) $(DESTDIR)$(includedir)/FL
$(INSTALL_DIR) $(DESTDIR)$(includedir)/FL
for file in *.[hrH]; do \
for file in *.[hH]; do \
$(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/FL; \
done
@HLINKS@ cd $(DESTDIR)$(includedir)/FL;\

View File

@ -1,13 +0,0 @@
data 'MBAR' (128) {
$"0001 0080" /* ...*/
};
data 'MENU' (128, "Apple") {
$"0080 0000 0000 0000 0000 FFFF FFFB 0114" /* .€........ÿÿÿû.. */
$"0A41 626F 7574 2046 4C54 4B00 0000 0001" /* ÂAbout FLTK..... */
$"2D00 0000 0000" /* -..... */
};
data 'carb' (0) {
};

View File

@ -5,7 +5,7 @@ dnl "$Id$"
dnl
dnl Configuration script for the Fast Light Tool Kit (FLTK).
dnl
dnl Copyright 1998-2007 by Bill Spitzak and others.
dnl Copyright 1998-2008 by Bill Spitzak and others.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
@ -250,7 +250,7 @@ AC_SUBST(SHAREDSUFFIX)
AC_SUBST(LINKSHARED)
AC_SUBST(FLUID)
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support])
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support (default=yes)])
AC_ARG_WITH(optim, [ --with-optim="flags" use custom optimization flags])
@ -260,8 +260,8 @@ AC_ARG_WITH(archflags, [ --with-archflags="flags"
case $uname in
Darwin*)
AC_ARG_ENABLE(quartz, [ --enable-quartz use Quartz instead of Quickdraw (default=no)])
if test "x$enable_quartz" = "xyes"; then
AC_ARG_ENABLE(quartz, [ --enable-quartz use Quartz instead of Quickdraw (default=yes)])
if test "x$enable_quartz" != "xno"; then
AC_DEFINE(USE_QUARTZ, 1)
AC_DEFINE(__APPLE_QUARTZ__)
else
@ -423,7 +423,7 @@ AC_SYS_LARGEFILE
dnl Define largefile options as needed...
LARGEFILE=""
if test x$enable_largefile = xyes; then
if test x$enable_largefile != xno; then
LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
if test x$ac_cv_sys_large_files = x1; then
@ -565,7 +565,7 @@ dnl Check for pthreads for multi-threaded apps...
have_pthread=no
PTHREAD_FLAGS=""
if test "x$enable_threads" = xyes; then
if test "x$enable_threads" != xno; then
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
if test x$ac_cv_header_pthread_h = xyes; then
@ -599,7 +599,6 @@ AC_SUBST(PTHREAD_FLAGS)
dnl Define OS-specific stuff...
HLINKS=
POSTBUILD=:
OSX_ONLY=:
THREADS=
@ -678,9 +677,6 @@ case $uname in
HLINKS="#"
fi
# Add a postbuild step after linking applications
POSTBUILD="/Developer/Tools/Rez -t APPL -o"
# Some steps are only done for OS X package management
OSX_ONLY=
@ -754,18 +750,18 @@ case $uname in
fi
dnl Check for Xinerama support unless disabled...
AC_ARG_ENABLE(xinerama, [ --enable-xinerama turn on Xinerama support [default=no]])
AC_ARG_ENABLE(xinerama, [ --enable-xinerama turn on Xinerama support [default=yes]])
if test x$enable_xinerama = xyes; then
if test x$enable_xinerama != xno; then
AC_CHECK_LIB(Xinerama,XineramaIsActive,
AC_DEFINE(HAVE_XINERAMA)
LIBS="-lXinerama $LIBS")
fi
dnl Check for the Xft library unless disabled...
AC_ARG_ENABLE(xft, [ --enable-xft turn on Xft support [default=no]])
AC_ARG_ENABLE(xft, [ --enable-xft turn on Xft support [default=yes]])
if test x$enable_xft = xyes; then
if test x$enable_xft != xno; then
AC_PATH_PROG(FTCONFIG,freetype-config)
if test "x$FTCONFIG" != x; then
@ -780,9 +776,9 @@ case $uname in
fi
dnl Check for the Xdbe extension unless disabled...
AC_ARG_ENABLE(xdbe, [ --enable-xdbe turn on Xdbe support [default=no]])
AC_ARG_ENABLE(xdbe, [ --enable-xdbe turn on Xdbe support [default=yes]])
if test x$enable_xdbe = xyes; then
if test x$enable_xdbe != xno; then
AC_CHECK_HEADER(X11/extensions/Xdbe.h, AC_DEFINE(HAVE_XDBE),,
[#include <X11/Xlib.h>])
fi
@ -818,7 +814,6 @@ esac
AC_SUBST(GLDEMOS)
AC_SUBST(GLLIB)
AC_SUBST(HLINKS)
AC_SUBST(POSTBUILD)
AC_SUBST(OSX_ONLY)
AC_SUBST(THREADS)
@ -1084,7 +1079,7 @@ case $uname in
graphics="GDI"
;;
Darwin*)
if test x$enable_quartz = xyes; then
if test x$enable_quartz != xno; then
graphics="Quartz"
else
graphics="Quickdraw"
@ -1092,13 +1087,13 @@ case $uname in
;;
*)
graphics="X11"
if test x$enable_xft = xyes; then
if test x$enable_xft != xno; then
graphics="$graphics+Xft"
fi
if test x$enable_xdbe = xyes; then
if test x$enable_xdbe != xno; then
graphics="$graphics+Xdbe"
fi
if test x$enable_xinerama = xyes; then
if test x$enable_xinerama != xno; then
graphics="$graphics+Xinerama"
fi
;;
@ -1130,7 +1125,7 @@ else
echo " ZLIB=Builtin"
fi
if test x$enable_largefile = xyes; then
if test x$enable_largefile != xno; then
echo " Large Files: YES"
else
echo " Large Files: NO"

View File

@ -49,9 +49,6 @@ srcdir=@srcdir@
CC="@CC@"
CXX="@CXX@"
# post-process command (only needed for MacOS)
POSTBUILD="@POSTBUILD@"
# flags for C++ compiler:
ARCHFLAGS="@ARCHFLAGS@"
CFLAGS="@CFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
@ -118,11 +115,11 @@ Options telling what information we request:
even if there are DSOs installed
[--libs] return FLTK libraries full path for dependencies
Option to compile and link an application:
Options to compile and link an application:
[-g] compile the program with debugging information
[-Dname[=value]] compile the program with the given define
[--compile program.cxx]
[--post program]
[--post program] prepare the program for desktop use
"
exit $1
}
@ -195,12 +192,11 @@ do
CXXFLAGS="$CXXFLAGS $1"
;;
--compile)
compile=$2
post=$2
compile="$2"
shift
;;
--post)
post=$2
post="$2"
shift
;;
*)
@ -248,40 +244,68 @@ if test -n "$echo_help"; then
fi
if test -n "$compile"; then
case $compile in
case "$compile" in
*.cxx)
prog=`basename $compile .cxx`
prog="`basename '$compile' .cxx`"
;;
*.cpp)
prog=`basename $compile .cpp`
prog="`basename '$compile' .cpp`"
;;
*.cc)
prog=`basename $compile .cc`
prog="`basename '$compile' .cc`"
;;
*.C)
prog=`basename $compile .C`
prog="`basename '$compile' .C`"
;;
*)
echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
exit 1
;;
esac
post=$prog
echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o $prog $compile $LDSTATIC
$CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o $prog $compile $LDSTATIC
post="$prog"
# stop after compilation in case of errors
err=$?
if test $err != 0; then
exit $err
fi
echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC
$CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC || exit 1
fi
if test -n "$post" -a "$POSTBUILD" != ":"; then
echo $POSTBUILD $post $includedir/FL/mac.r
$POSTBUILD $post $includedir/FL/mac.r
if test -n "$post"; then
case "`uname`" in
Darwin)
echo Creating "'$post.app'" bundle for desktop...
id=`echo $post | tr ' ' '_'`
# Make the bundle directory and move the executable there
rm -rf "$post.app/Contents/MacOS"
mkdir -p "$post.app/Contents/MacOS"
mv "$post" "$post.app/Contents/MacOS"
# Make a shell script that runs the bundled executable
echo "#!/bin/sh" >"$post"
echo 'dir="`dirname $0`"' >>"$post"
echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" $*' >>"$post"
chmod +x "$post"
# Make the simplest Info.plist needed for an application
cat >"$post.app/Contents/Info.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<plist version="0.9">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>$post</string>
<key>CFBundleIdentifier</key>
<string>org.fltk.$id</string>
<key>CFBundleName</key>
<string>$post</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>
EOF
;;
esac
fi
if test "$echo_cflags" = "yes"; then

View File

@ -3,7 +3,7 @@
#
# FLUID makefile for the Fast Light Tool Kit (FLTK).
#
# Copyright 1998-2007 by Bill Spitzak and others.
# Copyright 1998-2008 by Bill Spitzak and others.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@ -59,13 +59,11 @@ fluid$(EXEEXT): $(OBJECTS) ../lib/$(LIBNAME) ../lib/$(FLLIBNAME) \
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LINKFLTKFORMS) $(LINKFLTKIMG) $(LDLIBS)
$(OSX_ONLY) $(INSTALL_BIN) fluid fluid.app/Contents/MacOS
$(POSTBUILD) $@ ../FL/mac.r
fluid-shared$(EXEEXT): $(OBJECTS) ../src/$(DSONAME) ../src/$(FLDSONAME) \
../src/$(IMGDSONAME)
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LINKSHARED) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
clean:
-$(RM) *.o core.* *~ *.bck *.bck

View File

@ -3,7 +3,7 @@
#
# Make include file for the Fast Light Tool Kit (FLTK).
#
# Copyright 1998-2007 by Bill Spitzak and others.
# Copyright 1998-2008 by Bill Spitzak and others.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@ -103,9 +103,6 @@ FLUID = @FLUID@$(EXEEXT)
# Possible steps for OS X build only
OSX_ONLY = @OSX_ONLY@
# Possible steps after linking...
POSTBUILD = @POSTBUILD@
# Man page extensions...
CAT1EXT = @CAT1EXT@
CAT3EXT = @CAT3EXT@
@ -135,7 +132,6 @@ UNINSTALL_DESKTOP = @UNINSTALL_DESKTOP@
.o$(EXEEXT):
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) $< $(LINKFLTK) $(LDLIBS) -o $@
$(POSTBUILD) $@ ../FL/mac.r
.c.o:
echo Compiling $<...

View File

@ -82,6 +82,13 @@ int Fl::arg(int argc, char **argv, int &i) {
if (s[0] != '-' || s[1] == '-' || !s[1]) {return_i = 1; return 0;}
s++; // point after the dash
#ifdef __APPLE__
if (!strncmp(s, "psn", 3)) {
// Skip process serial number...
i++;
}
else
#endif // __APPLE__
if (fl_match(s, "iconic")) {
fl_show_iconic = 1;
i++;

View File

@ -3,7 +3,7 @@
#
# Test/example program makefile for the Fast Light Tool Kit (FLTK).
#
# Copyright 1998-2007 by Bill Spitzak and others.
# Copyright 1998-2008 by Bill Spitzak and others.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@ -278,20 +278,17 @@ blocks$(EXEEXT): blocks.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) blocks.o -o $@ $(AUDIOLIBS) $(LINKFLTK) $(LDLIBS)
$(OSX_ONLY) $(INSTALL_BIN) blocks$(EXEEXT) blocks.app/Contents/MacOS
$(POSTBUILD) $@ ../FL/mac.r
checkers$(EXEEXT): checkers.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) checkers.o -o $@ $(LINKFLTK) $(LDLIBS)
$(OSX_ONLY) $(INSTALL_BIN) checkers$(EXEEXT) checkers.app/Contents/MacOS
$(POSTBUILD) $@ ../FL/mac.r
clock$(EXEEXT): clock.o
colbrowser$(EXEEXT): colbrowser.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ colbrowser.o $(LINKFLTKFORMS) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
color_chooser$(EXEEXT): color_chooser.o
@ -302,14 +299,12 @@ curve$(EXEEXT): curve.o
demo$(EXEEXT): demo.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ demo.o $(LINKFLTKFORMS) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
doublebuffer$(EXEEXT): doublebuffer.o
editor$(EXEEXT): editor.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) editor.o -o $@ $(LINKFLTKIMG) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
fast_slow$(EXEEXT): fast_slow.o
fast_slow.cxx: fast_slow.fl ../fluid/fluid$(EXEEXT)
@ -317,21 +312,18 @@ fast_slow.cxx: fast_slow.fl ../fluid/fluid$(EXEEXT)
file_chooser$(EXEEXT): file_chooser.o ../lib/$(IMGLIBNAME)
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) file_chooser.o -o $@ $(LINKFLTKIMG) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
fonts$(EXEEXT): fonts.o
forms$(EXEEXT): forms.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ forms.o $(LINKFLTKFORMS) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
hello$(EXEEXT): hello.o
help$(EXEEXT): help.o ../lib/$(IMGLIBNAME)
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) help.o -o $@ $(LINKFLTKIMG) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
iconize$(EXEEXT): iconize.o
@ -347,14 +339,12 @@ input_choice$(EXEEXT): input_choice.o
keyboard$(EXEEXT): keyboard_ui.o keyboard.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ keyboard.o keyboard_ui.o $(LINKFLTK) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
keyboard_ui.o: keyboard_ui.h
keyboard_ui.cxx: keyboard_ui.fl ../fluid/fluid$(EXEEXT)
label$(EXEEXT): label.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ label.o $(LINKFLTKFORMS) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
line_style$(EXEEXT): line_style.o
@ -363,7 +353,6 @@ list_visuals$(EXEEXT): list_visuals.o
mandelbrot$(EXEEXT): mandelbrot_ui.o mandelbrot.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ mandelbrot.o mandelbrot_ui.o $(LINKFLTK) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
mandelbrot_ui.o: mandelbrot_ui.h
mandelbrot_ui.cxx: mandelbrot_ui.fl ../fluid/fluid$(EXEEXT)
@ -378,7 +367,6 @@ navigation$(EXEEXT): navigation.o
output$(EXEEXT): output.o ../lib/$(FLLIBNAME)
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ output.o $(LINKFLTKFORMS) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
overlay$(EXEEXT): overlay.o
@ -389,7 +377,6 @@ pixmap$(EXEEXT): pixmap.o
pixmap_browser$(EXEEXT): pixmap_browser.o ../lib/$(IMGLIBNAME)
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) pixmap_browser.o -o $@ $(LINKFLTKIMG) $(LDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
preferences$(EXEEXT): preferences.o
preferences.cxx: preferences.fl ../fluid/fluid$(EXEEXT)
@ -410,7 +397,6 @@ sudoku: sudoku.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) sudoku.o -o $@ $(AUDIOLIBS) $(LINKFLTKIMG) $(LDLIBS)
$(OSX_ONLY) $(INSTALL_BIN) sudoku$(EXEEXT) sudoku.app/Contents/MacOS
$(POSTBUILD) $@ ../FL/mac.r
sudoku.exe: sudoku.o sudoku.rc
echo Linking $@...
@ -443,7 +429,6 @@ CubeView$(EXEEXT): CubeMain.o CubeView.o CubeViewUI.o
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ \
CubeMain.o CubeView.o CubeViewUI.o \
$(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
CubeMain.o: CubeViewUI.h CubeView.h CubeViewUI.cxx
CubeView.o: CubeView.h
CubeViewUI.o: CubeViewUI.cxx CubeViewUI.h
@ -452,32 +437,26 @@ CubeViewUI.cxx: CubeViewUI.fl ../fluid/fluid$(EXEEXT)
cube$(EXEEXT): cube.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ cube.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
fractals$(EXEEXT): fractals.o fracviewer.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ fractals.o fracviewer.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
fullscreen$(EXEEXT): fullscreen.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ fullscreen.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
glpuzzle$(EXEEXT): glpuzzle.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ glpuzzle.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
gl_overlay$(EXEEXT): gl_overlay.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ gl_overlay.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
shape$(EXEEXT): shape.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ shape.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS)
$(POSTBUILD) $@ ../FL/mac.r
#