Add OS X app bundling support

Also add support for building OS X universal binaries,
define version macros and variables, and update the
INSTALL file.
pull/2/head
Stelios Bounanos 2008-02-29 09:18:07 +00:00
rodzic f4f7fd0ec6
commit 18007fe2e3
10 zmienionych plików z 276 dodań i 23 usunięć

Wyświetl plik

@ -20,6 +20,7 @@ Change Log:
devices and sample rates
16) Added mt63 500/1000/2000 modes
17) Added psk acquisition level control
18) Added script to create .app bundles on OS X
2.09 1) Modified src/Makefile.am for FreeBSD name space clash
2) Added psk multi-channel viewer with regex search capability

53
INSTALL
Wyświetl plik

@ -3,17 +3,16 @@ Installation Instructions for fldigi
To compile fldigi you will need:
* A recent C++ compiler. The GNU C++ compilers in the 4.x series are
* A recent C++ compiler. The GNU C++ compilers in the 4.x series are
known to work. Building with g++ 3.x requires the development files
for the Boost C++ library.
* Version 1.1.x of the Fast Light Tool Kit (FLTK), with its
development libraries and headers. Version 1.1.7 and pre-releases of
1.1.8 are known to work. FLTK's multi-threading support is required.
development library and headers. Version 1.1.7 and pre-releases of
1.1.8 are known to work. FLTK's multi-threading support is required.
You should also install the libraries and headers for PortAudio, the
Portable audio I/O library. It is possible, but not recommended, to
compile fldigi without PortAudio; see below.
Portable audio I/O library.
Additional features are enabled if the corresponding libraries are
present on your system:
@ -24,6 +23,18 @@ present on your system:
* Audio file generation, capture and playback support is enabled if
`configure' can find the sndfile library.
* The PulseAudio sound backend is compiled if the development files
for libpulse-simple, the PulseAudio simple API library, are present.
Finally, fldigi requires the samplerate library but has its own copy to
fall back on should it not be detected on your system. The following
message will be printed in that case:
configure: WARNING: using bundled libsamplerate
If you are building packages for other users you should link fldigi
with the libsamplerate that comes with your distribution.
Once you have installed the required packages, the following commands
should be sufficient to compile fldigi and install it under /usr/local:
@ -32,19 +43,33 @@ should be sufficient to compile fldigi and install it under /usr/local:
make
make install (you may need superuser privileges for installation)
To disable PortAudio support you will need to pass an additional option
to `configure':
The `install' target installs the executable, an icon, and a .desktop
file. After installation, an fldigi launcher should appear somewhere in
your applications menu.
./configure --without-portaudio
Fldigi also requires the samplerate library, but has its own copy to
fall back on should it not be detected on your system. The following
message will be printed in that case:
To run fldigi on Mac OS X you will need to create an app bundle. The
Makefile has an `appbundle' target for this purpose that can be used
instead of `install':
configure: using bundled libsamplerate
make appbundle
If you are building packages for other users you should link fldigi
with the libsamplerate that comes with your distribution.
This target will generate two bundles inside the build directory (by
default src/):
* mac-bundle/fldigi.app, which only contains the bare minimum that is
required to run fldigi on the build system
* mac-libs-bundle/fldigi.app, which also includes copies of non-system
libraries (such as PortAudio and FLTK) that the binary links to
The configure script has some support for building universal x86/ppc
binaries. Pass the following additional arguments to enable it:
--enable-mac-universal --disable-dependency-tracking
OS X support is not yet well tested and any feedback/suggestions/patches
will be very welcomed.

Wyświetl plik

@ -5,3 +5,6 @@ SUBDIRS = src
flgen:
(cd src && $(MAKE) $(AM_MAKEFLAGS) $@)
appbundle:
(cd src && $(MAKE) $(AM_MAKEFLAGS) $@)

Wyświetl plik

@ -4,7 +4,24 @@
AC_COPYRIGHT([Copyright (C) 2007, 2008 Stelios Bounanos, M0GLD (m0gld AT enotty DOT net)])
AC_PREREQ(2.61)
AC_INIT([fldigi], [2.10M], [w1hkj AT w1hkj DOT com])
dnl major and minor must be integers; patch may
dnl contain other characters or be empty
m4_define(FLDIGI_MAJOR, [2])
m4_define(FLDIGI_MINOR, [10])
m4_define(FLDIGI_PATCH, [M])
AC_INIT([fldigi], FLDIGI_MAJOR.FLDIGI_MINOR[FLDIGI_PATCH], [w1hkj AT w1hkj DOT com])
# substitute in Makefiles
AC_SUBST([FLDIGI_VERSION_MAJOR], [FLDIGI_MAJOR])
AC_SUBST([FLDIGI_VERSION_MINOR], [FLDIGI_MINOR])
AC_SUBST([FLDIGI_VERSION_PATCH], [FLDIGI_PATCH])
# define in config.h
AC_DEFINE([FLDIGI_VERSION_MAJOR], [FLDIGI_MAJOR], [Major version number])
AC_DEFINE([FLDIGI_VERSION_MINOR], [FLDIGI_MINOR], [Minor version number])
AC_DEFINE([FLDIGI_VERSION_PATCH], ["FLDIGI_PATCH"], [Patch/alpha version string])
AC_CONFIG_AUX_DIR([build-aux])
# define build, build_cpu, build_vendor, build_os
@ -21,8 +38,8 @@ AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_DEFINE(PACKAGE_HOME, ["http://www.w1hkj.com/Fldigi-2.x.html"], [Home page])
AC_DEFINE(PACKAGE_DOCS, ["http://www.w1hkj.com/FldigiHelp-2.0/index.html"], [Docs index])
AC_DEFINE([PACKAGE_HOME], ["http://www.w1hkj.com/Fldigi-2.x.html"], [Home page])
AC_DEFINE([PACKAGE_DOCS], ["http://www.w1hkj.com/FldigiHelp-2.0/index.html"], [Docs index])
# Checks for programs.
@ -146,6 +163,12 @@ AC_FLDIGI_PKG_CHECK([hamlib], [hamlib >= 1.2.4], [with], [HAMLIB],
[use hamradio control libraries @<:@autodetect@:>@],
[ENABLE_HAMLIB])
### OSX
# Set ac_cv_mac_universal to yes/no
# Set DARWIN Makefile conditional
# Substitute MAC_UNIVERSAL_CFLAGS and MAC_UNIVERSAL_LDFLAGS in Makefile
AC_FLDIGI_MACOSX
### output
AH_TOP([

Wyświetl plik

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleIdentifier</key>
<string>%%IDENTIFIER%%</string>
<key>CFBundleName</key>
<string>%%NAME%%</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>%%SIGNATURE%%</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>%%BINARY%%</string>
<key>CFBundleVersion</key>
<string>%%VERSION%%</string>
<key>CFBundleShortVersionString</key>
<string>%%VERSION%%</string>
<key>CFBundleLongVersionString</key>
<string>%%VERSION%%</string>
<!--
<key>CFBundleIconFile</key>
<string>%%ICON%%</string>
-->
<key>NSAppleScriptEnabled</key>
<string>No</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) 2006-2008 Dave Freese W1HKJ and others</string>
</dict>
</plist>

42
m4/macosx.m4 100644
Wyświetl plik

@ -0,0 +1,42 @@
AC_DEFUN([AC_FLDIGI_MACOSX], [
case "$target_os" in
darwin*)
target_darwin="yes"
;;
*)
target_darwin="no"
;;
esac
AC_ARG_ENABLE([mac-universal], AC_HELP_STRING([--enable-mac-universal],
[build a universal binary on Mac OS X @<:@no@:>@]),
[case "${enableval}" in
yes|no) ac_cv_mac_universal="${enableval}" ;;
*) AC_MSG_ERROR([bad value "${enableval}" for --enable-mac-universal]) ;;
esac],
[ac_cv_mac_universal=no])
if test "x$target_darwin" = "xyes" && test "x$ac_cv_mac_universal" = "xyes"; then
mac_minversion="-mmacosx-version-min=10.4"
case "$target_os" in
darwin8*)
mac_arches="-arch i386 -arch ppc"
mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.4u.sdk"
;;
darwin9*)
mac_arches="-arch i386 -arch ppc -arch x86_64 -arch ppc64"
mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
;;
*)
mac_arches=""
mac_sysroot=""
;;
esac
MAC_UNIVERSAL_CFLAGS="$mac_arches $mac_sysroot $mac_minversion"
MAC_UNIVERSAL_LDFLAGS="-dynamiclib"
fi
AC_SUBST([MAC_UNIVERSAL_CFLAGS])
AC_SUBST([MAC_UNIVERSAL_LDFLAGS])
AM_CONDITIONAL([DARWIN], [test "x$target_darwin" = "xyes"])
])

Wyświetl plik

@ -28,8 +28,8 @@ else
PKG_CHECK_MODULES([$4], [$2]) # for the error message
fi
fi
AC_SUBST([$3][_CFLAGS])
AC_SUBST([$3][_LIBS])
AC_SUBST([$4][_CFLAGS])
AC_SUBST([$4][_LIBS])
m4_ifval([$6], [ AM_CONDITIONAL([$6], [test "x$ac_cv_[]$1" = "xyes"]) ], [:])
])

Wyświetl plik

@ -0,0 +1,87 @@
#!/bin/sh
### Script to create the .app structure for osx
### 20080227 Stelios Bounanos M0GLD
if [ $# -ne 2 ]; then
echo "Syntax: $0 data-dir build-dir" >&2
exit 1
fi
PWD=`pwd`
data="${PWD}/$1"
build="${PWD}/$2"
# more sanity checks
for d in "$data" "$build"; do
test -d "$d" && continue
echo "%{d}: not a directory" >&2
exit 1
done
if ! test -w "$build"; then
echo "%{build} is not writeable" >&2
exit 1
fi
plist="${data}/mac/Info.plist.in"
icons="${data}/mac/fldigi.icns"
for f in "$plist" "$icons"; do
test -r "$f" && continue
echo "%{f}: not readable" >&2
exit 1
done
identifier="com.w1hkj.fldigi"
name="Fldigi"
signature="fldg"
binary="fldigi"
version="${FLDIGI_VERSION_MAJOR}.${FLDIGI_VERSION_MINOR}"
icon="`basename $icons`"
set -e
cd "$build"
# bundle the binary
echo "Creating ${build}/mac-bundle/"$PACKAGE".app"
$mkinstalldirs mac-bundle/"$PACKAGE".app/Contents/MacOS mac-bundle/"$PACKAGE".app/Contents/Resources
cd mac-bundle
$INSTALL_STRIP_PROGRAM "${build}/$binary" "$PACKAGE".app/Contents/MacOS
# $INSTALL_DATA "$icons" "$PACKAGE".app/Contents/Resources
echo "APPL${signature}" > "$PACKAGE".app/Contents/PkgInfo
sed -e "s!%%IDENTIFIER%%!${identifier}!g; s!%%NAME%%!${name}!g;\
s!%%SIGNATURE%%!${signature}!g; s!%%BINARY%%!${binary}!g;\
s!%%VERSION%%!${version}!g; s!%%ICON%%!${icon}!g;" < "$plist" > "$PACKAGE".app/Contents/Info.plist
if grep '%%[A-Z]*%%' "$PACKAGE".app/Contents/Info.plist; then
echo "Unsubstituted variables in Info.plist!" >&2
exit 1
fi
# bundle the binary and its non-standard dependencies
echo "Creating ${build}/mac-libs-bundle/"$PACKAGE".app"
cd ..
$mkinstalldirs mac-libs-bundle
cp -pR mac-bundle/"$PACKAGE".app mac-libs-bundle
$mkinstalldirs mac-libs-bundle/"$PACKAGE".app/Contents/Frameworks
cd mac-libs-bundle/"$PACKAGE".app/Contents
list="MacOS/$binary"
while test "x$list" != "x"; do
change="$list"
list=""
for obj in $change; do
for lib in `otool -L $obj | \
sed -n 's!^.*[[:space:]]\([^[:space:]]*\.dylib\).*$!\1!p' | \
grep -Ev '^/(usr/lib|System)'`; do
libfn="`basename $lib`"
if ! test -f "Frameworks/$libfn"; then
cp "$lib" "Frameworks/$libfn"
install_name_tool -id "@executable_path/../Frameworks/$libfn" "Frameworks/$libfn"
list="$list Frameworks/$libfn"
fi
install_name_tool -change "$lib" "@executable_path/../Frameworks/$libfn" "$obj"
done
done
done

Wyświetl plik

@ -8,9 +8,12 @@ AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/irrxml @BOOST_CPPFLAGS
AM_CXXFLAGS = @PORTAUDIO_CFLAGS@ @FLTK_CFLAGS@ @SNDFILE_CFLAGS@ \
@SAMPLERATE_CFLAGS@ @PULSEAUDIO_CFLAGS@ @HAMLIB_CFLAGS@ \
@MAC_UNIVERSAL_CFLAGS@ \
-pipe -Wall -O2 -ffast-math -fexceptions -finline-functions
AM_CFLAGS = $(AM_CXXFLAGS)
AM_LDFLAGS = @MAC_UNIVERSAL_LDFLAGS@
LDADD = @PORTAUDIO_LIBS@ @BOOST_LDFLAGS@ @FLTK_LIBS@ @SNDFILE_LIBS@ \
@SAMPLERATE_LIBS@ @PULSEAUDIO_LIBS@ @HAMLIB_LIBS@ @RTLIB@
@ -28,7 +31,7 @@ fldigi_SOURCES =
if ENABLE_DEBUG
AM_CPPFLAGS += -UNDEBUG
LDFLAGS += @RDYNAMIC@
AM_LDFLAGS += @RDYNAMIC@
else
AM_CPPFLAGS += -DNDEBUG
endif
@ -42,8 +45,12 @@ if ENABLE_HAMLIB
fldigi_SOURCES += $(HAMLIB_SRC)
endif
FLDIGI_VERSION_MAJOR = @FLDIGI_VERSION_MAJOR@
FLDIGI_VERSION_MINOR = @FLDIGI_VERSION_MINOR@
FLDIGI_VERSION_PATCH = @FLDIGI_VERSION_PATCH@
.EXPORT_ALL_VARIABLES: versions.h appbundle
.EXPORT_ALL_VARIABLES: versions.h
versions.h: $(srcdir)/include/versions.h.in
sh $(srcdir)/../scripts/mkversions.sh $^ $@ || echo > $@
@ -76,10 +83,23 @@ flgen: $(srcdir)/dialogs/confdialog.fl $(srcdir)/rigcontrol/rigdialog.fl
$(FLUID) -c -o ../rigcontrol/rigdialog.cxx -h rigdialog.h ../rigcontrol/rigdialog.fl)
else
flgen:
@echo
@echo >&2
@echo "*** The code and headers cannot be generated from the .fl source" >&2
@echo "*** files because the fluid utility was not found on your system" >&2
@echo
@echo >&2
@false
endif
if DARWIN
appbundle:
sh $(srcdir)/../scripts/mkappbundle.sh "$(srcdir)/../data" .
clean-local:
@rm -rf mac-bundle mac-libs-bundle
else
appbundle:
@echo >&2
@echo "*** This target only works on OSX ***" >&2
@echo >&2
@false
endif
@ -296,10 +316,12 @@ EXTRA_fldigi_SOURCES += \
# Additional non-source files that we distribute
EXTRA_DIST = \
$(srcdir)/../scripts/mkversions.sh \
$(srcdir)/../scripts/mkappbundle.sh \
$(srcdir)/../data/fldigi-psk.png \
$(srcdir)/../data/fldigi-rtty.png \
$(srcdir)/../data/fldigi.xpm \
$(srcdir)/../data/fldigi.desktop \
$(srcdir)/../data/mac/Info.plist.in \
fileselector/allfiles.xbm \
fileselector/d1.xbm \
fileselector/d1_mask.xbm \

Wyświetl plik

@ -37,6 +37,10 @@ extern "C" {
# define read_memory_barrier() asm volatile ("lfence":::"memory")
# define write_memory_barrier() asm volatile ("sfence":::"memory")
*/
# elif defined(__ppc__) || defined(__powerpc__) || defined(__PPC__)
# define full_memory_barrier() asm volatile("sync":::"memory")
# define read_memory_barrier() full_memory_barrier()
# define write_memory_barrier() full_memory_barrier()
# else
# warning Memory barriers not defined on this system
# define full_memory_barrier() ((void)0)