Update build scripts

Add a script and Makefile target to relink fldigi with a static hamlib
pull/2/head
Stelios Bounanos 2008-08-21 19:22:32 +01:00
rodzic c7255803e9
commit 8edc6a5cc4
4 zmienionych plików z 115 dodań i 36 usunięć

Wyświetl plik

@ -3,10 +3,17 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src
if HAVE_FLUID
flgen:
(cd src && $(MAKE) $(AM_MAKEFLAGS) $@)
endif
if DARWIN
appbundle:
(cd src && $(MAKE) $(AM_MAKEFLAGS) $@)
endif
if ENABLE_HAMLIB
hamlib-static:
(cd src && $(MAKE) $(AM_MAKEFLAGS) $@)
endif

Wyświetl plik

@ -4,19 +4,21 @@
### 20080227 Stelios Bounanos M0GLD
### Updated 20080727: enable the .icns support
if [ $# -ne 2 ]; then
echo "Syntax: $0 data-dir build-dir" >&2
if [ $# -ne 4 ]; then
echo "Syntax: $0 data-dir build-dir bundle-dir static-bundle-dir" >&2
exit 1
fi
if [ -z "$PACKAGE" ]; then
echo "E: \$PACKAGE undefined"
if [ -z "$PACKAGE_TARNAME" ]; then
echo "E: \$PACKAGE_TARNAME undefined"
exit 1
fi
PWD=`pwd`
data="${PWD}/$1"
build="${PWD}/$2"
bundle_dir="$3"
static_bundle_dir="$4"
# more sanity checks
for d in "$data" "$build"; do
test -d "$d" && continue
@ -29,48 +31,60 @@ if ! test -w "$build"; then
fi
plist="${data}/mac/Info.plist.in"
icons="${data}/mac/fldigi.icns"
for f in "$plist" "$icons"; do
icon="${data}/mac/fldigi.icns"
for f in "$plist" "$icon"; do
test -r "$f" && continue
echo "E: ${f}: not readable" >&2
exit 1
done
# aaaaaaaaaargh => Aaaaaaaaaargh
upcase1()
{
sed 'h; s/\(^.\).*/\1/; y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/; G; s/\n.//'
}
identifier="com.w1hkj.fldigi"
name="Fldigi"
signature="fldg"
binary="fldigi"
identifier="com.w1hkj.$PACKAGE_TARNAME"
name=$(echo "$PACKAGE_TARNAME" | upcase1)
# we'll use the first four consonants as the signature
signature="$(echo $PACKAGE_TARNAME | sed 's/[aeiouAEIOU]//g; s/\(^....\).*/\1/')"
binary="$PACKAGE_TARNAME"
version="${FLDIGI_VERSION_MAJOR}.${FLDIGI_VERSION_MINOR}"
icon="`basename $icons`"
set -e
cd "$build"
if test "x$STRIP" = "x0"; then
INSTALL_PROGRAM_CMD="$INSTALL_STRIP_PROGRAM"
else
INSTALL_PROGRAM_CMD="$INSTALL_PROGRAM"
fi
# 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
appname="${PACKAGE_TARNAME}-${PACKAGE_VERSION}.app"
echo "Creating ${build}/$bundle_dir/$appname"
$mkinstalldirs "$bundle_dir/$appname/Contents/MacOS" "$bundle_dir/$appname/Contents/Resources"
cd "$bundle_dir"
$INSTALL_PROGRAM_CMD "${build}/$binary" "$appname/Contents/MacOS"
$INSTALL_DATA "$icon" "$appname/Contents/Resources"
echo "APPL${signature}" > "$appname/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 "E: unsubstituted variables in Info.plist!" >&2
s!%%VERSION%%!${version}!g; s!%%ICON%%!${icon##*/}!g;" < "$plist" > "$appname/Contents/Info.plist"
if grep '%%[A-Z]*%%' "$appname/Contents/Info.plist"; then
echo "E: unsubstituted variables in $appname/Contents/Info.plist" >&2
exit 1
fi
# bundle the binary and its non-standard dependencies
echo "Creating ${build}/mac-libs-bundle/"$PACKAGE".app"
echo "Creating ${build}/$static_bundle_dir/$appname"
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
$mkinstalldirs "$static_bundle_dir"
cp -pR "$bundle_dir/$appname" "$static_bundle_dir"
$mkinstalldirs "$static_bundle_dir/$appname/Contents/Frameworks"
cd "$static_bundle_dir/$appname/Contents"
list="MacOS/$binary"
while test "x$list" != "x"; do
@ -91,3 +105,7 @@ while test "x$list" != "x"; do
done
done
done
cd "$build"
hdiutil create -srcfolder "$bundle_dir" -format UDZO -tgtimagekey zlib-level=9 "$PACKAGE_TARNAME-$PACKAGE_VERSION-nolibs.dmg"
hdiutil create -srcfolder "$static_bundle_dir" -format UDZO -tgtimagekey zlib-level=9 "$PACKAGE_TARNAME-$PACKAGE_VERSION.dmg"

Wyświetl plik

@ -0,0 +1,47 @@
#!/bin/sh
set -e
if [ $# -ne 1 ]; then
echo "Syntax: $0 obj-dir" >&2
exit 1
fi
tmp="$1"
binary="fldigi"
if ! test -r "$binary"; then
echo "E: $binary not found"
exit 1
fi
if test "x$PKG_CONFIG" != "x"; then
hamlib_dir="$($PKG_CONFIG --variable=libdir hamlib)"
if test "x$hamlib_dir" = "x"; then
echo "E: Could not determine hamlib \$libdir"
exit 1
fi
else
hamlib_dir="${HAMLIB_LIBS#*-L}"
hamlib_dir="${HAMLIB_LIBS%% *}"
if test "x$hamlib_dir" = "x"; then
hamlib_dir=/usr/lib
fi
fi
rm -rf $tmp
mkdir -p $tmp
cd $tmp
for i in "$hamlib_dir"/hamlib-*.a; do
ar x $i
done
cd ..
case "$target_os" in
*cygwin*)
AM_LDFLAGS="$AM_LDFLAGS -Wl,--export-all-symbols"
;;
esac
$CXX -o ${binary}${EXEEXT} $AM_CXXFLAGS $CXXFLAGS $AM_LDFLAGS $LDFLAGS $fldigi_OBJECTS $tmp/*.${OBJEXT} $fldigi_LDADD
rm -rf $tmp

Wyświetl plik

@ -46,7 +46,7 @@ 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 appbundle hamlib-static
versions.h: $(srcdir)/include/versions.h.in
sh $(srcdir)/../scripts/mkversions.sh $^ $@ || echo > $@
@ -58,6 +58,7 @@ nodist_fldigi_SOURCES = $(BUILT_SOURCES)
# and deleted by the clean targets
CLEANFILES = $(BUILT_SOURCES)
CLEAN_LOCAL_FILES =
if WIN32
if HAVE_WINDRES
@ -86,22 +87,27 @@ flgen: $(srcdir)/dialogs/confdialog.fl $(srcdir)/rigcontrol/rigdialog.fl
(cd $(srcdir)/include; \
$(FLUID) -c -o ../dialogs/confdialog.cxx -h confdialog.h ../dialogs/confdialog.fl; \
$(FLUID) -c -o ../rigcontrol/rigdialog.cxx -h rigdialog.h ../rigcontrol/rigdialog.fl)
else
flgen:
@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 >&2
@false
endif
if DARWIN
appbundle:
sh $(srcdir)/../scripts/mkappbundle.sh "$(srcdir)/../data" .
clean-local:
@rm -rf mac-bundle mac-libs-bundle
sh $(srcdir)/../scripts/mkappbundle.sh "$(srcdir)/../data" . \
$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-bundle-nolibs \
$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-bundle
CLEAN_LOCAL_FILES += $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-bundle-nolibs \
$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-bundle \
$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)*.dmg
endif
if ENABLE_HAMLIB
hamlib-static:
sh $(srcdir)/../scripts/mkhamlibstatic.sh hls-tmp
CLEAN_LOCAL_FILES += hls-tmp
endif
clean-local:
@rm -rf $(CLEAN_LOCAL_FILES)
TESTS = $(srcdir)/../scripts/tests/config-h.sh
# Sources that we build. It is OK to have headers here.
@ -348,6 +354,7 @@ EXTRA_fldigi_SOURCES += \
EXTRA_DIST = \
$(srcdir)/../scripts/mkversions.sh \
$(srcdir)/../scripts/mkappbundle.sh \
$(srcdir)/../scripts/mkhamlibstatic.sh \
$(srcdir)/../scripts/fldigi-shell \
$(srcdir)/../scripts/tests/config-h.sh \
$(srcdir)/../data/fldigi-psk.png \