- edit MacOSX make target to support building the applescript in two steps.

Step 1, the compile, must be done locally on a MacOSX machine.  This
  gives us the contents of the resource fork, which will be checked into
  CVS as script_compiled.rsrc every time the script sources change.  Step 2
  can be done remotely on the SF compile farm: reconstruct the script
  from the separate data and resource fork files.
- not all filesystems support resource forks!  I added a test in the
  makefile to check that the resource fork is accessible, so that at least
  we will get a clear error message if the filesystem doesn't support it.
This commit is contained in:
Bryce Denney 2002-11-21 17:26:48 +00:00
parent 0c0a87feb5
commit 4a01410fd0

View File

@ -235,7 +235,7 @@ $(BX_OBJS): $(BX_INCLUDES)
bxversion.h:
$(RM) -f bxversion.h
echo '/////////////////////////////////////////////////////////////////////////' > bxversion.h
echo '// $$Id: Makefile.in,v 1.111 2002-11-21 06:38:56 bdenney Exp $$' >> bxversion.h
echo '// $$Id: Makefile.in,v 1.112 2002-11-21 17:26:48 bdenney Exp $$' >> bxversion.h
echo '/////////////////////////////////////////////////////////////////////////' >> bxversion.h
echo '// This file is generated by "make bxversion.h"' >> bxversion.h
echo "#define VER_STRING \"$(VER_STRING)\"" >> bxversion.h
@ -519,25 +519,72 @@ dist-clean: local-dist-clean
###########################################
APP=bochs.app
APP_PLATFORM=MacOS
SCRIPT=bochs.scpt
SCRIPT_EXEC=bochs.scpt
SCRIPT_DATA=$(MACOSX_STUFF_SRCDIR)/script.data
SCRIPT_R=$(MACOSX_STUFF_SRCDIR)/script.r
SCRIPT_APPLESCRIPT=$(MACOSX_STUFF_SRCDIR)/bochs.applescript
SCRIPT_COMPILED_RSRC=$(MACOSX_STUFF)/script_compiled.rsrc
MACOSX_STUFF=build/macosx
MACOSX_STUFF_SRCDIR=$(srcdir)/$(MACOSX_STUFF)
REZ=/Developer/Tools/Rez
RINCLUDES=/System/Library/Frameworks/Carbon.framework/Libraries/RIncludes
REZ_ARGS=-append -i $RINCLUDES -d SystemSevenOrLater=1 -useDF
STANDALONE_LIBDIR=`pwd`/$(APP)/Contents/$(APP_PLATFORM)/lib
REZ_ARGS_SCRIPT=-append
OSACOMPILE=/usr/bin/osacompile
SETFILE=/Developer/Tools/Setfile
$(SCRIPT): $(MACOSX_STUFF_SRCDIR)/bochs.applescript $(MACOSX_STUFF_SRCDIR)/script.r $(MACOSX_STUFF_SRCDIR)/script.data
rm -f $(SCRIPT)
$(CP) -f $(MACOSX_STUFF_SRCDIR)/script.data $(SCRIPT)
$(REZ) $(REZ_ARGS_SCRIPT) $(MACOSX_STUFF_SRCDIR)/script.r -o $(SCRIPT)
$(OSACOMPILE) -o $(SCRIPT) $(MACOSX_STUFF_SRCDIR)/bochs.applescript
$(SETFILE) -t "APPL" -c "aplt" $(SCRIPT)
# On a MacOS X machine, you run rez, osacompile, and setfile to
# produce the script executable, which has both a data fork and a
# resource fork. Ideally, we would just recompile the whole
# executable at build time, but unfortunately this cannot be done on
# the SF compile farm through an ssh connection because osacompile
# needs to be run locally for some reason. Solution: If the script
# sources are changed, rebuild the executable on a MacOSX machine,
# split it into its data and resource forks and check them into CVS
# as separate files. Then at release time, all that's left to do is
# put the data and resource forks back together to make a working script.
# (This can be done through ssh.)
#
# Sources:
# 1. script.r: resources for the script
# 2. script.data: binary data for the script
# 3. bochs.applescript: the source of the script
#
# NOTE: All of this will fail if you aren't building on an HFS+
# filesystem! On the SF compile farm building in your user directory
# will fail, while doing the build in /tmp will work ok.
$(APP)/.build: bochs $(SCRIPT)
# check if this filesystem supports resource forks at all
test_hfsplus:
$(RM) -rf test_hfsplus
echo data > test_hfsplus
# if you get "Not a directory", then this filesystem doesn't support resources
echo resource > test_hfsplus/rsrc
# test succeeded
$(RM) -rf test_hfsplus
# Step 1 (must be done locally on MacOSX, only when sources change)
# Compile and pull out just the resource fork. The resource fork is
# checked into CVS as script_compiled.rsrc. Note that we don't need
# to check in the data fork of tmpscript because it is identical to the
# script.data input file.
$(SCRIPT_COMPILED_RSRC): $(SCRIPT_R) $(SCRIPT_APPLESCRIPT)
$(RM) -f tmpscript
$(CP) -f $(SCRIPT_DATA) tmpscript
$(REZ) -append $(SCRIPT_R) -o tmpscript
$(OSACOMPILE) -o tmpscript $(SCRIPT_APPLESCRIPT)
$(CP) tmpscript/rsrc rsrc
$(RM) -f tmpscript
# Step 2 (can be done locally or remotely on MacOSX)
# Combine the data fork and resource fork, and set attributes.
$(SCRIPT_EXEC): $(SCRIPT_DATA) $(SCRIPT_COMPILED_RSRC)
rm -f $(SCRIPT_EXEC)
$(CP) $(SCRIPT_DATA) $(SCRIPT_EXEC)
$(CP) $(SCRIPT_COMPILED_RSRC) $(SCRIPT_EXEC)/rsrc
$(SETFILE) -t "APPL" -c "aplt" $(SCRIPT_EXEC)
$(APP)/.build: bochs test_hfsplus $(SCRIPT_EXEC)
rm -f $(APP)/.build
$(MKDIR) -p $(APP)
$(MKDIR) -p $(APP)/Contents
@ -549,7 +596,7 @@ $(APP)/.build: bochs $(SCRIPT)
$(MKDIR) -p $(APP)/Contents/Resources
$(REZ) $(REZ_ARGS) $(MACOSX_STUFF_SRCDIR)/bochs.r -o $(APP)/Contents/Resources/bochs.rsrc
$(CP) -f $(MACOSX_STUFF_SRCDIR)/bochs-icn.icns $(APP)/Contents/Resources
ls -ld $(APP)
ls -ld $(APP) $(SCRIPT_EXEC) $(SCRIPT_EXEC)/rsrc
touch $(APP)/.build
$(APP)/.build_plugins: $(APP)/.build bochs_plugins