Revision: 3576 Author: eliot Date: 2016-02-10 09:48:30 -0800 (Wed, 10 Feb 2016) Log Message: ----------- First check-in of gnu make build system for Mac OS X. build.macos32x86/common includes makefiles for app vm and plugins. Makefiles for unusual plugins added to platforms/iOS/plugins subdirs. Trailing backslashes removed from various plugins.int files. platforms/iOS/vm/iPhone/sqDummyaio.h moved to platforms/iOS/vm/Common. platforms/iOS/vm/Common/aio.c nuked; it should be taken from platforms/ unix/vm. platforms/Cross/vm/sqSCCSVersion.h extended to make a more useful getversion program for use in makefiles. Still to do: Move build.macos32x86/squeak.cog.spur et al to use new makefiles (tested in test dirs, but not checked-in yet). Add Pharo icns files. Make sure that makefiles work with problems like spaces in Newspeak Virtual Machine Modified Paths: -------------- branches/Cog/build.macos32x86/squeak.cog.spur/plugins.int branches/Cog/build.macos32x86/squeak.cog.v3/plugins.int branches/Cog/build.macos32x86/squeak.sista.spur/plugins.int branches/Cog/build.macos32x86/squeak.stack.spur/plugins.int branches/Cog/build.macos32x86/squeak.stack.v3/plugins.int branches/Cog/platforms/Cross/vm/sqSCCSVersion.h branches/Cog/platforms/iOS/vm/Common/version.c branches/Cog/platforms/iOS/vm/OSX/GreenCogSqueak.icns branches/Cog/platforms/iOS/vm/OSX/sqMacV2Window.m branches/Cog/platforms/iOS/vm/OSX/sqSqueakMainApplication+screen.m Added Paths: ----------- branches/Cog/build.macos32x86/common/ branches/Cog/build.macos32x86/common/Makefile.app branches/Cog/build.macos32x86/common/Makefile.flags branches/Cog/build.macos32x86/common/Makefile.plugin branches/Cog/build.macos32x86/common/Makefile.rules branches/Cog/build.macos32x86/common/Makefile.vm branches/Cog/build.macos32x86/common/mkNamedPrims.sh branches/Cog/platforms/iOS/plugins/AioPlugin/ branches/Cog/platforms/iOS/plugins/AioPlugin/Makefile branches/Cog/platforms/iOS/plugins/BitBltPlugin/ branches/Cog/platforms/iOS/plugins/BitBltPlugin/Makefile branches/Cog/platforms/iOS/plugins/BochsIA32Plugin/ branches/Cog/platforms/iOS/plugins/BochsIA32Plugin/Makefile branches/Cog/platforms/iOS/plugins/BochsX64Plugin/ branches/Cog/platforms/iOS/plugins/BochsX64Plugin/Makefile branches/Cog/platforms/iOS/plugins/IA32ABI/ branches/Cog/platforms/iOS/plugins/IA32ABI/Makefile branches/Cog/platforms/iOS/plugins/Info.plist branches/Cog/platforms/iOS/plugins/SecurityPlugin/Makefile branches/Cog/platforms/iOS/plugins/SocketPlugin/ branches/Cog/platforms/iOS/plugins/SocketPlugin/Makefile branches/Cog/platforms/iOS/plugins/SoundPlugin/Makefile branches/Cog/platforms/iOS/vm/Common/sqDummyaio.h branches/Cog/platforms/iOS/vm/OSX/Pharo-Info.plist branches/Cog/platforms/iOS/vm/OSX/Squeak-Info.plist branches/Cog/platforms/iOS/vm/OSX/osExports.c branches/Cog/platforms/iOS/vm/OSX/sqPlatformSpecific.h Removed Paths: ------------- branches/Cog/platforms/iOS/vm/Common/aio.c branches/Cog/platforms/iOS/vm/iPhone/sqDummyaio.h Property Changed: ---------------- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h Added: branches/Cog/build.macos32x86/common/Makefile.app =================================================================== --- branches/Cog/build.macos32x86/common/Makefile.app (rev 0) +++ branches/Cog/build.macos32x86/common/Makefile.app 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,80 @@ +############################################################################# +# Generic Makefile for VM app bundle +# Do make getversion to get makwe -n to work +# +# This is designed to be invoked by Makefile in a specific build directory via +# include ../common/Makefile.app +# +# Parameters: +# VMSRCDIR defines the locaton of the VM source to build. Required. +# +# COGDEFS supply any command-line defines to use, and may be null. +# +# The name of the VM to build. Optional. Defaults to Squeak +# +# PLUGINSRCDIR defines the locaton of the plugin source, the subsets of which +# selected by plugins.int and plugins.ext will be built. Optional. Defaults to +# ../../src +# +# CONFIGURATION defines what version of the VM to build, product, assert or +# debug. Optional. Defaults to product. The default is overridden in mvm script + + +ifeq ("$(CONFIGURATION)","product") + APP:=CocoaFast.app +else ifeq ("$(CONFIGURATION)","assert") + APP:=CocoaAssert.app +else + APP:=CocoaDebug.app +endif + +default: $(APP) + +include ../common/Makefile.vm + +cleanall: cleanapp cleanastapp cleandbgapp cleanallvm + +cleanapp: + rm -rf CocoaFast.app + +cleanastapp: + rm -rf CocoaAssert.app + +cleandbgapp: + rm -rf CocoaDebug.app + +VMEXE:=$(APP)/Contents/MacOS/$(VM) +VMPLIST:=$(APP)/Contents/Info.plist +VMBUNDLES:=$(addprefix $(APP)/Contents/Resources/, $(addsuffix .bundle, $(EXTERNAL_PLUGINS))) +OSXICONS:=$(OSXDIR)/$(VM).icns $(wildcard $(OSXDIR)/$(SYSTEM)*.icns) +VMICONS:=$(addprefix $(APP)/Contents/Resources/,$(notdir $(OSXICONS))) + +$(APP): $(VMEXE) $(VMBUNDLES) $(VMPLIST) $(VMICONS) + +$(VMEXE): vm $(OBJDIR)/$(VM) + mkdir -p $(APP)/Contents/MacOS + cp $(OBJDIR)/$(VM) $(APP)/Contents/MacOS + +$(APP)/Contents/Resources/%.bundle: $(BLDDIR)/vm/%.bundle + mkdir -p $(APP)/Contents/Resources + cp -pR $< $(APP)/Contents/Resources + +$(VMPLIST): $(OSXDIR)/$(SYSTEM)-Info.plist getversion + mkdir -p $(APP)/Contents + sed "s/\$$(VERSION)/`getversion VERSION_TAG`/" $< | \ + sed "s/\$$(VERSION_NUMBER)/`getversion VERSION_NUMBER`/" | \ + sed "s/\$$(VERSION_TAG)/`getversion VERSION_TAG`/" | \ + sed "s/\$$(VM_NICKNAME)/`getversion VM_NICKNAME`/" > $@ + +$(APP)/Contents/Resources/%.icns: $(OSXDIR)/%.icns + mkdir -p $(APP)/Contents/Resources + cp -p $< $(APP)/Contents/Resources + +print-app-settings: + @echo ---------------- Makefile.app settings ------------------ + @echo APP=$(APP) + @echo VMEXE=$(VMEXE) + @echo VMBUNDLES=$(VMBUNDLES) + @echo VMPLIST=$(VMPLIST) + @echo VMICONS=$(VMICONS) + @echo ----------------------------------------------------- Added: branches/Cog/build.macos32x86/common/Makefile.flags =================================================================== --- branches/Cog/build.macos32x86/common/Makefile.flags (rev 0) +++ branches/Cog/build.macos32x86/common/Makefile.flags 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,35 @@ +############################################################################# +# Compilations flags for Mac OS X +# +# These are derived from Xcode v 6.2 for Apple LLVM version 6.0 (clang-600.0.57) + +SDK:=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk +TARGET_ARCH:=i386 + +CFLAGS:=$(CFLAGS) -DBUILD_FOR_OSX \ + -arch $(TARGET_ARCH) \ + -mmacosx-version-min=10.6 -msse4.2 -fvisibility=hidden -fwrapv \ + -fmacro-backtrace-limit=0 -fdiagnostics-show-note-include-stack \ + -fmessage-length=0 -fpascal-strings -fasm-blocks -fstrict-aliasing \ + -isysroot $(SDK) \ + -include $(PLATDIR)/iOS/vm/SqueakPureObjc_Prefix.pch + +BFLAGS:=-arch $(TARGET_ARCH) \ + -bundle \ + -isysroot $(SDK) + +WARNINGS:= -Wno-missing-field-initializers -Wno-missing-prototypes \ + -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function \ + -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value \ + -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow \ + -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion \ + -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion \ + -Wno-sign-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof \ + -Wno-trigraphs -Wdeprecated-declarations + +FRAMEWORKS:=-fobjc-link-runtime \ + -framework OpenGL -framework Cocoa \ + -framework Foundation -framework AudioToolbox \ + -framework CoreAudio -framework SystemConfiguration \ + -framework ApplicationServices -framework Security \ + -framework QuartzCore Added: branches/Cog/build.macos32x86/common/Makefile.plugin =================================================================== --- branches/Cog/build.macos32x86/common/Makefile.plugin (rev 0) +++ branches/Cog/build.macos32x86/common/Makefile.plugin 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,155 @@ +############################################################################# +# Generic Makefile for plugins on Cocoa Mac OS X +# Do make getversion to get makwe -n to work +# + +# VM config flags. +ifeq ("$(CONFIGURATION)","product") +OFLAGS:= -g -Os +DEBUGVM=-DDEBUGVM=0 -DNDEBUG=1 +BUILD:=build +else ifeq ("$(CONFIGURATION)","assert") +OFLAGS:= -g -O1 -fno-omit-frame-pointer +DEBUGVM=-DDEBUGVM=0 +BUILD:=buildast +else +OFLAGS:= -g -O0 -fno-omit-frame-pointer +DEBUGVM=-DDEBUGVM=1 +BUILD:=builddbg +endif + +CFLAGS:= $(OFLAGS) $(COGDEFS) $(DEBUGVM) $(XDEFS) +# The following are the four key locations (set via invocation): +# PLUGINSRCDIR: Where is the root of the src/plugins source tree? +# VMSRCDIR: Where is the root of the src vm source tree? +# PLATDIR: Where is the root of the platforms tree? +# BASEDIR: Where is the root of the build tree? +COMMONDIR:=$(BASEDIR)/../common + +############################################################################# +# Standard directory locations: +# CROSSDIR: The location of the cross platform sources +# OSXPLGDIR: The location of the iOS sources +# MAKERDIR: The location of the VMMaker generated sources +# BUILDDIR: The location where the plugin is built +# +#PLUGINSRCDIR:= ../../src/plugins +CROSSDIR:= $(PLATDIR)/Cross/plugins/$(LIBNAME) +OSXDIR:= $(PLATDIR)/iOS/vm/OSX +OSXPLGDIR:= $(PLATDIR)/iOS/plugins/$(LIBNAME) +UNIXDIR:= $(PLATDIR)/unix/vm +MAKERDIR:= $(PLUGINSRCDIR)/$(LIBNAME) +BUILDDIR:= $(BASEDIR)/$(BUILD)/$(LIBNAME) + +# Support directory locations +CROSSVMDIR:=$(PLATDIR)/Cross/vm +OSXVMDIR:=$(PLATDIR)/iOS/vm/OSX +MAKERVMDIR:=$(VMSRCDIR) + +SRCDIRS:= $(MAKERVMDIR) $(CROSSVMDIR) $(MAKERDIR) $(OSXPLGDIR) $(OSXVMDIR) $(CROSSDIR) $(SRCDIRS) +INCLUDES:= $(addprefix -I,. $(SRCDIRS)) $(INCLUDES) + +############################################################################# +# If no source files were given, use standard set +# + +CROSSSRC:= $(wildcard $(CROSSDIR)/*.c) $(wildcard $(CROSSDIR)/*.cpp) +OSXSRC:= $(wildcard $(OSXPLGDIR)/*.c) $(wildcard $(OSXPLGDIR)/*.m) $(wildcard $(OSXPLGDIR)/*.cpp) +MAKERSRC:= $(wildcard $(MAKERDIR)/*.c) +LIBSRC?= $(notdir $(MAKERSRC) $(OSXSRC) $(CROSSSRC)) + + +############################################################################# +# bundle settings +# +# Note: By default DLLTOOL/DLLWRAP do the work for everything related to plugins +# but if LINK_WITH_GCC we use gcc and if LINK_WITH_GPP we use g++. +# +DLLTOOL:= dlltool +DLLWRAP:= dllwrap -mno-cygwin +#OPTSTRIP:= strip # for production +OPTSTRIP:= echo not doing strip + +############################################################################# +# Plugin settings +# +OBJDIR:= $(BASEDIR)/$(BUILD)/$(LIBNAME) +VMDIR:= $(BASEDIR)/$(BUILD)/vm +PLUGINLIB:= $(VMDIR)/$(LIBNAME).lib +PLUGINBUNDLE:= $(VMDIR)/$(LIBNAME).bundle +PLUGINEXE:= $(PLUGINBUNDLE)/Contents/MacOS/$(LIBNAME) +# https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html +PLUGINPLIST:= $(PLUGINBUNDLE)/Contents/Info.plist +PLUGINICONS:= $(PLUGINBUNDLE)/Contents/Resources/SqueakPlugin.icns +LIBOBJ?=$(patsubst %.c,%.o,$(patsubst %.m,%.o,$(patsubst %.cpp,%.o,$(LIBSRC)))) +LIBOBJ:=$(addprefix $(OBJDIR)/,$(LIBOBJ)) + +VPATH:= $(SRCDIRS) + +############################################################################# +# Rules for automated builds + +include $(COMMONDIR)/Makefile.rules + +all: $(PLUGINLIB) $(PLUGINBUNDLE) + +print-settings: + @echo ---------------- Makefile.plugin settings ------------------ + @echo PWD=$(shell pwd) + @echo VPATH=$(VPATH) + @echo INCLUDES=$(INCLUDES) + @echo CFLAGS=$(CFLAGS) + @echo PLUGINSRCDIR=$(PLUGINSRCDIR) + @echo VMSRCDIR=$(VMSRCDIR) + @echo CROSSDIR=$(CROSSDIR) + @echo OSXPLGDIR=$(OSXPLGDIR) + @echo OSXDIR=$(OSXDIR) + @echo MAKERDIR=$(MAKERDIR) + @echo CROSSSRC=$(CROSSSRC) + @echo OSXSRC=$(OSXSRC) + @echo MAKERSRC=$(MAKERSRC) + @echo LIBSRC=$(LIBSRC) + @echo LIBOBJ=$(LIBOBJ) + @echo OBJDIR=$(OBJDIR) + @echo VMDIR=$(VMDIR) + @echo PLUGINLIB=$(PLUGINLIB) + @echo PLUGINEXE=$(PLUGINEXE) + @echo PLUGINBUNDLE=$(PLUGINBUNDLE) + @echo ----------------------------------------------------- + +$(OBJDIR): + mkdir -p $(OBJDIR) + +$(VMDIR): + mkdir -p $(VMDIR) + +$(PLUGINLIB): $(VMDIR) $(OBJDIR) $(LIBOBJ) + -rm $(PLUGINLIB) + ar -rc $(PLUGINLIB) $(LIBOBJ) + +# Either link with normal compiler/linker or with cpp compiler/linker. If +# LINK_WITH_CPP is set, use e.g. clang++ +$(PLUGINBUNDLE): $(PLUGINEXE) $(PLUGINICONS) $(PLUGINPLIST) + +$(PLUGINEXE): $(VMDIR) $(OBJDIR) $(LIBOBJ) + mkdir -p $(PLUGINBUNDLE)/Contents/MacOS +ifneq ($(LINK_WITH_CPP),) + $(LDCXX) \ + $(BFLAGS) \ + $(LIBOBJ) $(EXTRALIBS) \ + -o $(PLUGINBUNDLE)/Contents/MacOS/$(LIBNAME) +else + $(LD) \ + $(BFLAGS) \ + $(LIBOBJ) $(EXTRALIBS) \ + -o $(PLUGINBUNDLE)/Contents/MacOS/$(LIBNAME) +endif + +$(PLUGINICONS): $(OSXDIR)/SqueakPlugin.icns + mkdir -p $(PLUGINBUNDLE)/Contents/Resources + cp -p $< $@ + +$(PLUGINPLIST): $(PLATDIR)/iOS/plugins/Info.plist getversion + mkdir -p $(PLUGINBUNDLE)/Contents + sed "s/\$$(VERSION)/`getversion VERSION_TAG`/" $< | \ + sed "s/\$(LIBNAME)/$(LIBNAME)/" > $(PLUGINPLIST) Added: branches/Cog/build.macos32x86/common/Makefile.rules =================================================================== --- branches/Cog/build.macos32x86/common/Makefile.rules (rev 0) +++ branches/Cog/build.macos32x86/common/Makefile.rules 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,37 @@ +############################################################################# +# Compilations rules for Mac OS X +# +# See http://make.mad-scientist.net/papers/advanced-auto-dependency-generation +# for an explanation of the dependency management scheme. + +# /usr/bin/clang, a.k.a. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang +CC := clang +LD := clang +LDCXX := clang++ # For linking c++ bundles + +include $(COMMONDIR)/Makefile.flags + +DEPFLAGS = -MT $@ -MMD -MP -MF deps/$(*F).Td +ALLFLAGS = $(DEPFLAGS) $(WARNINGS) $(CFLAGS) +#POSTCOMPILE = mv -f deps/$(*F).Td deps/$(*F).d +POSTCOMPILE = sed '/^$$/d' <deps/$(*F).Td | sed '/^.*:$$/d' > deps/$(*F).d; rm deps/$(*F).Td + +$(OBJDIR)/%.o: %.c +$(OBJDIR)/%.o: %.c deps/%.d + $(CC) -x c $(ALLFLAGS) $(INCLUDES) -c $< -o $@ + $(POSTCOMPILE) + +$(OBJDIR)/%.o: %.m +$(OBJDIR)/%.o: %.m deps/%.d + $(CC) -x objective-c $(ALLFLAGS) $(INCLUDES) -c $< -o $@ + $(POSTCOMPILE) + +$(OBJDIR)/%.o: %.cpp +$(OBJDIR)/%.o: %.cpp deps/%.d + $(CC) -x c++ $(ALLFLAGS) $(INCLUDES) -c $< -o $@ + $(POSTCOMPILE) + +deps/%.d: ; +.PRECIOUS: deps/%.d + +-include $(patsubst %,deps/%.d,$(basename $(VMSRC))) Added: branches/Cog/build.macos32x86/common/Makefile.vm =================================================================== --- branches/Cog/build.macos32x86/common/Makefile.vm (rev 0) +++ branches/Cog/build.macos32x86/common/Makefile.vm 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,242 @@ +############################################################################# +# Generic Makefile for Mac OS VM +# Do make getversion to get makwe -n to work +# +# This is designed to be invoked by Makefile in a specific build directory via +# include ../common/Makefile.app +# +# Parameters: +# VMSRCDIR defines the locaton of the VM source to build. Required. +# +# COGDEFS supply any command-line defines to use, and may be null. +# +# The name of the VM to build, e.g. Squeak or "Newspeak Virtual Machine" +# and its short name, e.g. Squeak or Newspeak, used to choose app icon files. + +VM?=Squeak +SYSTEM?=$(VM) + +# PLUGINSRCDIR defines the locaton of the plugin source, the subsets of which +# selected by plugins.int and plugins.ext will be built. + +PLUGINSRCDIR?=../../src/plugins + +# CONFIGURATION defines what version of the VM to build, product, assert or +# debug. The default is overridden in the mvm script + +CONFIGURATION?=product + + +############################################################################# +# Build directories +# +ifndef BASEDIR +BASEDIR:=. +endif +COMMONDIR:=$(BASEDIR)/../common + +ifeq ("$(CONFIGURATION)","product") + BUILD:=build +else ifeq ("$(CONFIGURATION)","assert") + BUILD:=buildast +else + BUILD:=builddbg +endif +$(shell mkdir -p deps >/dev/null) # deps is the dependencies directory +BLDDIR:= $(BASEDIR)/$(BUILD) +OBJDIR:= $(BLDDIR)/vm + +# N.B. PLATDIR *must* be a relative path, see -f../../$(shell test -f ...) below +PLATDIR:=../../platforms +CROSSDIR:=$(PLATDIR)/Cross/vm +OSXDIR:=$(PLATDIR)/iOS/vm/OSX +OSXCOMMONDIR:=$(PLATDIR)/iOS/vm/Common +OSXCLASSESDIR:=$(PLATDIR)/iOS/vm/Common/Classes +OSXPLUGINSDIR:=$(PLATDIR)/iOS/plugins +UNIXVMDIR:=$(PLATDIR)/unix/vm + +MAKERSRC:=$(addprefix $(VMSRCDIR)/,gcc3x-cointerp.c cogit.c) +CROSSSRC:= $(wildcard $(CROSSDIR)/*.c) +XEX:=%/sqSqueakMainApplication+screen.m +OSXSRC:=$(wildcard $(OSXDIR)/*.c) $(filter-out $(XEX),$(wildcard $(OSXDIR)/*.m)) \ + $(wildcard $(OSXCOMMONDIR)/*.c) $(wildcard $(OSXCOMMONDIR)/*.m) \ + $(wildcard $(OSXCLASSESDIR)/*.c) $(wildcard $(OSXCLASSESDIR)/*.m) +UNIXSRC:=$(addprefix $(UNIXVMDIR)/,aio.c sqUnixHeartbeat.c sqUnixMemory.c \ + sqUnixSpurMemory.c sqUnixThreads.c sqUnixVMProfile.c) +VMSRC:= $(MAKERSRC) $(CROSSSRC) $(OSXSRC) $(UNIXSRC) +VMOBJ:= $(notdir $(VMSRC)) +VMOBJ:= $(VMOBJ:.c=.o) +VMOBJ:= $(VMOBJ:.m=.o) +VMOBJ:= $(VMOBJ:.cpp=.o) +VMOBJ:= $(addprefix $(OBJDIR)/,$(VMOBJ)) + +# N.B. Most important that OSXCOMMONDIR precede OSXDIR so that the above +# exclusion of OSXDIR/sqSqueakMainApplication+screen.m works, since there +# exists a OSXCOMMONDIR/sqSqueakMainApplication+screen.m. +SRCDIRS:=$(VMSRCDIR) $(OSXCOMMONDIR) $(OSXCLASSESDIR) $(OSXDIR) $(UNIXVMDIR) $(CROSSDIR) +VPATH:=$(SRCDIRS) +# Additonal includes are required, eg for SoundPlugin/sqSqueakSoundCoreAudio.h +PluginIncludes := FilePlugin HostWindowPlugin SoundPlugin +OSPluginIncludes := FilePlugin HostWindowPlugin SoundPlugin +SRCDIRS:=$(SRCDIRS) \ + $(addprefix $(PLATDIR)/Cross/plugins/,$(PluginIncludes)) \ + $(addprefix $(OSXPLUGINSDIR)/,$(OSPluginIncludes)) + +# The internal (.lib) and external (.bundle) plugins +# +include plugins.int +include plugins.ext + +LIBS:= $(addprefix $(OBJDIR)/, $(addsuffix .lib, $(INTERNAL_PLUGINS))) +BUNDLES:= $(addprefix $(OBJDIR)/, $(addsuffix .bundle, $(EXTERNAL_PLUGINS))) + + +# VM config flags. +ifeq ("$(CONFIGURATION)","product") +OFLAGS:= -g -Os +DEBUGVM=-DDEBUGVM=0 -DNDEBUG=1 # Define NDEBUG for production to exclude asserts +INTERPFLAGS:=-D'VM_LABEL(foo)=0' +else ifeq ("$(CONFIGURATION)","assert") +OFLAGS:= -g -O1 -fno-omit-frame-pointer +DEBUGVM=-DDEBUGVM=0 +INTERPFLAGS:=-DAllocationCheckFiller=0xADD4E55 -D'VM_LABEL(foo)=0' +else +OFLAGS:= -g -O0 -fno-omit-frame-pointer +DEBUGVM=-DDEBUGVM=1 +INTERPFLAGS:=-DAllocationCheckFiller=0xADD4E55 -D'VM_LABEL(foo)=0' +endif + +TZ:=$(shell date +%Z) +DEFS:= $(COGDEFS) -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \ + -DUSE_INLINE_MEMORY_ACCESSORS -D'TZ="$(TZ)"' \ + $(INTERPFLAGS) +XDEFS:= -DSQUEAK_BUILTIN_PLUGIN +CFLAGS:= $(OFLAGS) $(COGDEFS) $(DEBUGVM) $(DEFS) $(XDEFS) +INCLUDES:= $(addprefix -I,. $(SRCDIRS)) + +############################################################################# +# Linker settings +# +LD:= gcc + +############################################################################# +# +SVNREV:= $(shell sed -e "s/^static.*SvnRawRevisionString.*Rev: \([0-9][0-9]*\).*/\\1/p" -e d $(PLATDIR)/Cross/vm/sqSCCSVersion.h) + + +############################################################################# +# Common build rules +# +include $(COMMONDIR)/Makefile.rules + +svnver: + @-echo $(SVNREV) + +getversion: $(OSXCOMMONDIR)/version.c $(CROSSDIR)/sqSCCSVersion.h +getversion: $(OSXCOMMONDIR)/version.c deps/version.d $(CROSSDIR)/sqSCCSVersion.h + $(CC) -x c -DVERSION_PROGRAM=1 $(ALLFLAGS) $(INCLUDES) $< -o $@ + $(POSTCOMPILE) + +-include deps/version.d + +product:; + $(MAKE) -f $(MAKEFILE_LIST) CONFIGURATION=product $(@,product=) default + +assert: + $(MAKE) -f $(MAKEFILE_LIST) CONFIGURATION=assert $(@,assert=) default + +debug: + $(MAKE) -f $(MAKEFILE_LIST) CONFIGURATION=debug $(@,debug=) default + +cleanallvm: cleanvm cleanvmast cleanvmdbg + +cleanvm: + rm -rf sqNamedPrims.h build deps + +cleanvmast: + rm -rf sqNamedPrims.h buildast + +cleanvmdbg: + rm -rf sqNamedPrims.h builddbg + +print-source: + @echo ---------------- Makefile.vm sources ------------------ + @echo CROSSSRC=$(CROSSSRC) + @echo OSXSRC=$(OSXSRC) + @echo MAKERSRC=$(MAKERSRC) + @echo UNIXSRC=$(UNIXSRC) + @echo VMSRC=$(VMSRC) + +print-settings: + @echo ---------------- Makefile.vm settings ------------------ + @echo CONFIGURATION=$(CONFIGURATION) + @echo VPATH=$(VPATH) + @echo INCLUDES=$(INCLUDES) + @echo CFLAGS=$(CFLAGS) + @echo INTERNAL_PLUGINS=$(INTERNAL_PLUGINS) + @echo EXTERNAL_PLUGINS=$(EXTERNAL_PLUGINS) + @echo OBJDIR=$(OBJDIR) + @echo LIBS=$(LIBS) + @echo BUNDLES=$(BUNDLES) + @echo ----------------------------------------------------- + +print-objects: + @echo ---------------- Makefile.vm objects ------------------ + @echo VMOBJ=$(VMOBJ) + @echo ----------------------------------------------------- + +vm: $(OBJDIR)/$(VM) + +$(OBJDIR)/$(VM): $(OBJDIR) $(VMOBJ) $(LIBS) + $(CC) -arch $(TARGET_ARCH) -o $(OBJDIR)/version.o $(CFLAGS) $(INCLUDES) $(DEFS) -c $(OSXCOMMONDIR)/version.c + $(CC) -arch $(TARGET_ARCH) -isysroot $(SDK) $(LDFLAGS) $(FRAMEWORKS) \ + -o $(OBJDIR)/$(VM) $(VMOBJ) $(LIBS) + +$(OBJDIR): + @-mkdir -p $(BLDDIR) + mkdir -p $(OBJDIR) +ifneq ($(INTERNAL_PLUGINS),) + mkdir -p $(addprefix $(BLDDIR)/, $(INTERNAL_PLUGINS)) +endif +ifneq ($(EXTERNAL_PLUGINS),) + mkdir -p $(addprefix $(BLDDIR)/, $(EXTERNAL_PLUGINS)) +endif + +############################################################################# +# Building plugins +# +.PHONY: FORCE + +# Internal plugin. Build as lib then link in lib +# Check for Makefile in iOS plugins directory otherwise use default Makefile +# N.B. PLATDIR *must* be a relative path for this to work +$(OBJDIR)/%.lib: FORCE + @-mkdir -p $(BLDDIR)/$(*F) + $(MAKE) $(MFLAGS) BUILD=$(BUILD) \ + -f $(shell test -f $(OSXPLUGINSDIR)/$(*F)/Makefile && echo $(OSXPLUGINSDIR)/$(*F)/Makefile || echo $(COMMONDIR)/Makefile.plugin) \ + CONFIGURATION=$(CONFIGURATION) ARCH=$(TARGET_ARCH) \ + PLATDIR=$(PLATDIR) BASEDIR=$(BASEDIR) \ + PLUGINSRCDIR=$(PLUGINSRCDIR) VMSRCDIR=$(VMSRCDIR) \ + LIBNAME=$(*F) COGDEFS="$(COGDEFS)" XDEFS=-DSQUEAK_BUILTIN_PLUGIN \ + $(OBJDIR)/$(*F).lib + +# External plugin. Build as bundle and copy to vm dir ($(OBJDIR)). +# Check for Makefile in iOS plugins directory otherwise use default Makefile +$(OBJDIR)/%.bundle: FORCE + @-mkdir -p $(BLDDIR)/$(*F) + $(MAKE) $(MFLAGS) BUILD=$(BUILD) \ + -f $(shell test -f $(OSXPLUGINSDIR)/$(*F)/Makefile && echo $(OSXPLUGINSDIR)/$(*F)/Makefile || echo $(COMMONDIR)/Makefile.plugin) \ + CONFIGURATION=$(CONFIGURATION) ARCH=$(TARGET_ARCH) \ + PLATDIR=$(PLATDIR) BASEDIR=$(BASEDIR) \ + PLUGINSRCDIR=$(PLUGINSRCDIR) VMSRCDIR=$(VMSRCDIR) \ + COGDEFS="$(COGDEFS)" LIBNAME=$(*F) $(OBJDIR)/$(*F).bundle + +FORCE: + +############################################################################# +# Extra specific dependencies +# +sqNamedPrims.h: plugins.int + $(COMMONDIR)/mkNamedPrims.sh plugins.int > sqNamedPrims.h + +$(OBJDIR)/sqNamedPrims.o: sqNamedPrims.c sqNamedPrims.h Added: branches/Cog/build.macos32x86/common/mkNamedPrims.sh =================================================================== --- branches/Cog/build.macos32x86/common/mkNamedPrims.sh (rev 0) +++ branches/Cog/build.macos32x86/common/mkNamedPrims.sh 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,24 @@ +#!/bin/bash +# Generate a sqNamedPrims.h file from plugins.int. The plugins.int used should +# be the one and only argument. +if [ $# != 1 -o ! -f "$1" ]; then + echo usage $0 plugins.int \>sqNamedPrims.h 1>&2 + exit 1 +fi +echo "/* Automatically generated on "`date`" */" +echo "extern sqExport vm_exports[];"; +echo "extern sqExport os_exports[];"; +for p in `grep -v '^#' "$1" | sed 's/INTERNAL_PLUGINS = //' | sed 's/ *\\\\//'` +do + test -n "$p" && echo "extern sqExport "$p"_exports[];" +done +echo +echo "sqExport *pluginExports[] = {" +echo " vm_exports," +echo " os_exports," +for p in `grep -v '^#' "$1" | sed 's/INTERNAL_PLUGINS = //' | sed 's/ *\\\\//'` +do + echo " "$p"_exports," +done +echo " NULL" +echo "};" Property changes on: branches/Cog/build.macos32x86/common/mkNamedPrims.sh ___________________________________________________________________ Added: svn:executable + * Modified: branches/Cog/build.macos32x86/squeak.cog.spur/plugins.int =================================================================== --- branches/Cog/build.macos32x86/squeak.cog.spur/plugins.int 2016-02-10 17:36:18 UTC (rev 3575) +++ branches/Cog/build.macos32x86/squeak.cog.spur/plugins.int 2016-02-10 17:48:30 UTC (rev 3576) @@ -31,4 +31,4 @@ StarSqueakPlugin \ SurfacePlugin \ UUIDPlugin \ -VMProfileMacSupportPlugin \ +VMProfileMacSupportPlugin Modified: branches/Cog/build.macos32x86/squeak.cog.v3/plugins.int =================================================================== --- branches/Cog/build.macos32x86/squeak.cog.v3/plugins.int 2016-02-10 17:36:18 UTC (rev 3575) +++ branches/Cog/build.macos32x86/squeak.cog.v3/plugins.int 2016-02-10 17:48:30 UTC (rev 3576) @@ -35,4 +35,4 @@ StarSqueakPlugin \ SurfacePlugin \ UUIDPlugin \ -VMProfileMacSupportPlugin \ +VMProfileMacSupportPlugin Modified: branches/Cog/build.macos32x86/squeak.sista.spur/plugins.int =================================================================== --- branches/Cog/build.macos32x86/squeak.sista.spur/plugins.int 2016-02-10 17:36:18 UTC (rev 3575) +++ branches/Cog/build.macos32x86/squeak.sista.spur/plugins.int 2016-02-10 17:48:30 UTC (rev 3576) @@ -35,4 +35,4 @@ StarSqueakPlugin \ SurfacePlugin \ UUIDPlugin \ -VMProfileMacSupportPlugin \ +VMProfileMacSupportPlugin Modified: branches/Cog/build.macos32x86/squeak.stack.spur/plugins.int =================================================================== --- branches/Cog/build.macos32x86/squeak.stack.spur/plugins.int 2016-02-10 17:36:18 UTC (rev 3575) +++ branches/Cog/build.macos32x86/squeak.stack.spur/plugins.int 2016-02-10 17:48:30 UTC (rev 3576) @@ -35,4 +35,4 @@ StarSqueakPlugin \ SurfacePlugin \ UUIDPlugin \ -VMProfileMacSupportPlugin \ +VMProfileMacSupportPlugin Modified: branches/Cog/build.macos32x86/squeak.stack.v3/plugins.int =================================================================== --- branches/Cog/build.macos32x86/squeak.stack.v3/plugins.int 2016-02-10 17:36:18 UTC (rev 3575) +++ branches/Cog/build.macos32x86/squeak.stack.v3/plugins.int 2016-02-10 17:48:30 UTC (rev 3576) @@ -34,4 +34,4 @@ StarSqueakPlugin \ SurfacePlugin \ UUIDPlugin \ -VMProfileMacSupportPlugin \ +VMProfileMacSupportPlugin Modified: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h =================================================================== --- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h 2016-02-10 17:36:18 UTC (rev 3575) +++ branches/Cog/platforms/Cross/vm/sqSCCSVersion.h 2016-02-10 17:48:30 UTC (rev 3576) @@ -102,23 +102,62 @@ #if VERSION_PROGRAM # include "sq.h" +#if SistaVM +# define NICKNAME "Sista" +#elif COGVM +# define NICKNAME "Cog" +#elif STACKVM +# define NICKNAME "Stack" +#else +# define NICKNAME "Context" +#endif + +#if SPURVM +# define OBJMEM "Spur" +#else +# define OBJMEM "V3" +#endif + +int argc = 0; +char **argv = 0; + +/* printit allows that with no arguments print all key/value pairs + * and with one argument print the value of a particular key. + */ int -main(int argc, char *argv[]) +printit(const char *what) { + if (argc == 1) { + printf("%s: ", what); + return 1; + } + return argc == 2 && !strcmp(argv[1], what); +} + +int +main(int _argc, char **_argv) +{ char vm_version[] = VM_VERSION; - if (argc == 2 && !strcmp(argv[1], "VM_VERSION")) + argc = _argc; + argv = _argv; + + if (printit("VM_NICKNAME")) + printf("%s\n", NICKNAME " " OBJMEM " VM"); + if (printit("VM_MONIKER")) + printf("%s\n", NICKNAME OBJMEM "VM"); + if (printit("VM_VERSION")) printf("%s\n", vm_version); - else if (argc == 2 && !strcmp(argv[1], "VM_MAJOR")) + if (printit("VM_MAJOR")) printf("%.*s\n", strchr(vm_version,'.') - vm_version, vm_version); - else if (argc == 2 && !strcmp(argv[1], "VM_MINOR")) - printf("%s\n", strchr(vm_version,'.') + 1, vm_version); - else if (argc == 2 && !strcmp(argv[1], "VM_RELEASE")) + if (printit("VM_MINOR")) + printf("%s\n", strchr(vm_version,'.') + 1); + if (printit("VM_RELEASE")) printf("%s\n", revisionAsString()); - else if (argc == 2 && !strcmp(argv[1], "VERSION_TAG")) + if (printit("VERSION_TAG")) printf("%s-%s\n", vm_version, revisionAsString()); - else - return 1; + if (printit("VERSION_NUMBER")) + printf("%s.%s\n", vm_version, revisionAsString()); return 0; } Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h ___________________________________________________________________ Modified: checkindate - Fri Jan 29 15:33:20 PST 2016 + Wed Feb 10 09:41:25 PST 2016 Added: branches/Cog/platforms/iOS/plugins/AioPlugin/Makefile =================================================================== --- branches/Cog/platforms/iOS/plugins/AioPlugin/Makefile (rev 0) +++ branches/Cog/platforms/iOS/plugins/AioPlugin/Makefile 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,5 @@ +INCLUDES:=-I../../platforms/Cross/plugins/FilePlugin \ + -I../../platforms/Cross/plugins/SocketPlugin \ + -I../../platforms/unix/vm + +include ../common/Makefile.plugin Added: branches/Cog/platforms/iOS/plugins/BitBltPlugin/Makefile =================================================================== --- branches/Cog/platforms/iOS/plugins/BitBltPlugin/Makefile (rev 0) +++ branches/Cog/platforms/iOS/plugins/BitBltPlugin/Makefile 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,4 @@ +LIBSRC:=BitBltPlugin.c +LIBOBJ:=BitBltPlugin.o + +include ../common/Makefile.plugin Added: branches/Cog/platforms/iOS/plugins/BochsIA32Plugin/Makefile =================================================================== --- branches/Cog/platforms/iOS/plugins/BochsIA32Plugin/Makefile (rev 0) +++ branches/Cog/platforms/iOS/plugins/BochsIA32Plugin/Makefile 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,9 @@ +LINK_WITH_CPP:=1 +INCLUDES:=-I../bochsx86 \ + -I../../processors/IA32/bochs \ + -I../../processors/IA32/bochs/instrument/stubs +EXTRALIBS:= -L../bochsx86/cpu -L../bochsx86/fpu -L../bochsx86/disasm \ + -lcpu -lfpu -ldisasm +CFLAGS:=-DUSE_BOCHS_CONFIG_H=1 + +include ../common/Makefile.plugin Added: branches/Cog/platforms/iOS/plugins/BochsX64Plugin/Makefile =================================================================== --- branches/Cog/platforms/iOS/plugins/BochsX64Plugin/Makefile (rev 0) +++ branches/Cog/platforms/iOS/plugins/BochsX64Plugin/Makefile 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,9 @@ +LINK_WITH_CPP:=1 +INCLUDES:= -I../bochsx64 \ + -I../../processors/IA32/bochs \ + -I../../processors/IA32/bochs/instrument/stubs +EXTRALIBS:= -L../bochsx64/cpu -L../bochsx64/fpu -L../bochsx64/disasm \ + -lcpu -lfpu -ldisasm +CFLAGS:=-DUSE_BOCHS_CONFIG_H=1 + +include ../common/Makefile.plugin Added: branches/Cog/platforms/iOS/plugins/IA32ABI/Makefile =================================================================== --- branches/Cog/platforms/iOS/plugins/IA32ABI/Makefile (rev 0) +++ branches/Cog/platforms/iOS/plugins/IA32ABI/Makefile 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,4 @@ +LIBSRC:= IA32ABI.c xabicc.c AlienSUnitTestProcedures.c +LIBOBJ:= IA32ABI.o xabicc.o AlienSUnitTestProcedures.o + +include ../common/Makefile.plugin Added: branches/Cog/platforms/iOS/plugins/Info.plist =================================================================== --- branches/Cog/platforms/iOS/plugins/Info.plist (rev 0) +++ branches/Cog/platforms/iOS/plugins/Info.plist 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>$(LIBNAME)</string> + <key>CFBundleIconFile</key> + <string>SqueakPlugin.icns</string> + <key>CFBundleIdentifier</key> + <string>org.squeak.$(LIBNAME)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>BNDL</string> + <key>CFBundleShortVersionString</key> + <string>$(VERSION)</string> + <key>CFBundleSignature</key> + <string>FAST</string> + <key>CFBundleVersion</key> + <string>$(VERSION)</string> +</dict> +</plist> Added: branches/Cog/platforms/iOS/plugins/SecurityPlugin/Makefile =================================================================== --- branches/Cog/platforms/iOS/plugins/SecurityPlugin/Makefile (rev 0) +++ branches/Cog/platforms/iOS/plugins/SecurityPlugin/Makefile 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,3 @@ +INCLUDES:=-I../../platforms/Cross/plugins/FilePlugin + +include ../common/Makefile.plugin Added: branches/Cog/platforms/iOS/plugins/SocketPlugin/Makefile =================================================================== --- branches/Cog/platforms/iOS/plugins/SocketPlugin/Makefile (rev 0) +++ branches/Cog/platforms/iOS/plugins/SocketPlugin/Makefile 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,7 @@ +SRCDIRS:=../../platforms/unix/plugins/SocketPlugin +INCLUDES:=-I../../platforms/Cross/plugins/SocketPlugin \ + -I../../platforms/unix/vm +LIBSRC:= SocketPlugin.c sqUnixSocket.c +LIBOBJ:=SocketPlugin.o sqUnixSocket.o + +include ../common/Makefile.plugin Added: branches/Cog/platforms/iOS/plugins/SoundPlugin/Makefile =================================================================== --- branches/Cog/platforms/iOS/plugins/SoundPlugin/Makefile (rev 0) +++ branches/Cog/platforms/iOS/plugins/SoundPlugin/Makefile 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,3 @@ +INCLUDES:=-I../../platforms/iOS/vm/Common/Classes + +include ../common/Makefile.plugin Deleted: branches/Cog/platforms/iOS/vm/Common/aio.c =================================================================== --- branches/Cog/platforms/iOS/vm/Common/aio.c 2016-02-10 17:36:18 UTC (rev 3575) +++ branches/Cog/platforms/iOS/vm/Common/aio.c 2016-02-10 17:48:30 UTC (rev 3576) @@ -1,401 +0,0 @@ -/* aio.c -- asynchronous file i/o - * - * Copyright (C) 1996-2006 by Ian Piumarta and other authors/contributors - * listed elsewhere in this file. - * All rights reserved. - * - * This file is part of Unix Squeak. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* Author: [hidden email] - * - * Last edited: 2006-10-18 10:07:06 by piumarta on emilia.local - */ - -#include "sqaio.h" -#include "sqMemoryAccess.h" - -#ifdef HAVE_CONFIG_H - -# include "config.h" - -# ifdef HAVE_UNISTD_H -# include <sys/types.h> -# include <unistd.h> -# endif /* HAVE_UNISTD_H */ - -# ifdef NEED_GETHOSTNAME_P - extern int gethostname(); -# endif - -# include <stdio.h> -# include <signal.h> -# include <errno.h> -# include <fcntl.h> -# include <sys/file.h> -# include <sys/ioctl.h> - -# ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -# else -# include <time.h> -# endif - -# ifdef HAS_SYS_SELECT_H -# include <sys/select.h> -# endif - -# ifndef FIONBIO -# ifdef HAVE_SYS_FILIO_H -# include <sys/filio.h> -# endif -# ifndef FIONBIO -# ifdef FIOSNBIO -# define FIONBIO FIOSNBIO -# else -# error: FIONBIO is not defined -# endif -# endif -# endif - -# if !defined(O_NONBLOCK) && defined(O_NDELAY) -# define O_NONBLOCK O_NDELAY -# endif -# if !defined(FASYNC) && defined(O_ASYNC) -# define FASYNC O_ASYNC -# endif - -#else /* !HAVE_CONFIG_H -- assume lowest common demoninator */ - -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -# include <errno.h> -# include <signal.h> -# include <sys/types.h> -# include <sys/time.h> -# include <sys/select.h> -# include <sys/ioctl.h> -# include <fcntl.h> - -#endif - - -#undef DEBUG -#undef DEBUG_TICKER - -#if defined(DEBUG) - int aioLastTick= 0; - int aioThisTick= 0; -# define FPRINTF(X) { aioThisTick= ioLowResMSecs(); fprintf(stderr, "%8d %8d ", aioThisTick, aioThisTick - aioLastTick); aioLastTick= aioThisTick; fprintf X; } -#else -# define FPRINTF(X) -#endif - -#if defined(DEBUG_TICKER) - static char *ticks= "-\\|/"; - static char *ticker= ""; - #define DO_TICK() \ - { \ - fprintf(stderr, "\r%c\r", *ticker); \ - if (!*ticker++) ticker= ticks; \ - } -#else -# define DO_TICK() -#endif - -#define _DO_FLAG_TYPE() _DO(AIO_R, rd) _DO(AIO_W, wr) _DO(AIO_X, ex) - -static aioHandler rdHandler[FD_SETSIZE]; -static aioHandler wrHandler[FD_SETSIZE]; -static aioHandler exHandler[FD_SETSIZE]; - -static void *clientData[FD_SETSIZE]; - -static int maxFd; -static fd_set fdMask; /* handled by aio */ -static fd_set rdMask; /* handle read */ -static fd_set wrMask; /* handle write */ -static fd_set exMask; /* handle exception */ -static fd_set xdMask; /* external descriptor */ - - -static void undefinedHandler(int fd, void *clientData, int flags) -{ - fprintf(stderr, "undefined handler called (fd %d, flags %x)\n", fd, flags); -} - -#ifdef DEBUG -static char *handlerName(aioHandler h) -{ - if (h == undefinedHandler) return "undefinedHandler"; -#ifdef DEBUG_SOCKETS - { - extern char *socketHandlerName(aioHandler); - return socketHandlerName(h); - } -#endif - return "***unknown***"; -} -#endif - -/* initialise asynchronous i/o */ - -void aioInit(void) -{ - extern void forceInterruptCheck(int); /* not really, but hey */ - - FD_ZERO(&fdMask); - FD_ZERO(&rdMask); - FD_ZERO(&wrMask); - FD_ZERO(&exMask); - FD_ZERO(&xdMask); - maxFd= 0; - signal(SIGPIPE, SIG_IGN); - signal(SIGIO, forceInterruptCheck); -} - - -/* disable handlers and close all handled non-exteral descriptors */ - -void aioFini(void) -{ - int fd; - for (fd= 0; fd < maxFd; fd++) - if (FD_ISSET(fd, &fdMask) && !(FD_ISSET(fd, &xdMask))) - { - aioDisable(fd); - close(fd); - FD_CLR(fd, &fdMask); - FD_CLR(fd, &rdMask); - FD_CLR(fd, &wrMask); - FD_CLR(fd, &exMask); - } - while (maxFd && !FD_ISSET(maxFd - 1, &fdMask)) - --maxFd; - signal(SIGPIPE, SIG_DFL); -} - - -/* answer whether i/o becomes possible within the given number of microSeconds */ - -int aioPoll(int microSeconds) -{ - int fd, ms; - fd_set rd, wr, ex; - - FPRINTF((stderr, "aioPoll(%d)\n", microSeconds)); - DO_TICK(); - - /* get out early if there is no pending i/o and no need to relinquish cpu */ - - if ((maxFd == 0) && (microSeconds == 0)) - return 0; - - rd= rdMask; - wr= wrMask; - ex= exMask; -#ifdef BUILD_FOR_OSX -#else - if (maxFd == 0) - return 0; -#endif - extern sqInt ioMSecs(void); - ms= (sqInt) ioMSecs(); - - for (;;) - { - struct timeval tv; - int n, now,why; - tv.tv_sec= microSeconds / 1000000; - tv.tv_usec= microSeconds % 1000000; - n= select(maxFd, &rd, &wr, &ex, &tv); - why = errno; - if (n > 0) break; - if (n == 0) return 0; - if (errno && (EINTR != errno)) - { - fprintf(stderr, "errno %d\n", errno); - perror("select"); - return 0; - } - now= (int) ioMSecs(); - microSeconds -= (now - ms) * 1000; - if (microSeconds <= 0) - return 0; - ms= now; - } - - for (fd= 0; fd < maxFd; ++fd) - { -# define _DO(FLAG, TYPE) \ - { \ - if (FD_ISSET(fd, &TYPE)) \ - { \ - aioHandler handler= TYPE##Handler[fd]; \ - FD_CLR(fd, &TYPE##Mask); \ - TYPE##Handler[fd]= undefinedHandler; \ - handler(fd, clientData[fd], FLAG); \ - } \ - } - _DO_FLAG_TYPE(); -# undef _DO - } - return 1; -} - - -/* sleep for microSeconds or until i/o becomes possible, avoiding - sleeping in select() is timeout too small */ - -int aioSleep(int microSeconds) -{ -#if defined(HAVE_NANOSLEEP) - if (microSeconds < (1000000/60)) /* < 1 timeslice? */ - { - if (!aioPoll(0)) - { - int error,why; - struct timespec rqtp= { 0, microSeconds * 1000 }; - struct timespec rmtp; - error = nanosleep(&rqtp, &rmtp); - if (error == -1) { - why = errno; - } - microSeconds= 0; /* poll but don't block */ - } - } -#endif - return aioPoll(microSeconds); -} - - -/* enable asynchronous notification for a descriptor */ - -void aioEnable(int fd, void *data, int flags) -{ - FPRINTF((stderr, "aioEnable(%d)\n", fd)); - if (fd < 0) - { - FPRINTF((stderr, "aioEnable(%d): IGNORED\n", fd)); - return; - } - if (FD_ISSET(fd, &fdMask)) - { - fprintf(stderr, "aioEnable: descriptor %d already enabled\n", fd); - return; - } - clientData[fd]= data; - rdHandler[fd]= wrHandler[fd]= exHandler[fd]= undefinedHandler; - FD_SET(fd, &fdMask); - FD_CLR(fd, &rdMask); - FD_CLR(fd, &wrMask); - FD_CLR(fd, &exMask); - if (fd >= maxFd) - maxFd= fd + 1; - if (flags & AIO_EXT) - { - FD_SET(fd, &xdMask); - /* we should not set NBIO ourselves on external descriptors! */ - } - else - { - /* enable non-blocking asynchronous i/o and delivery of SIGIO to the active process */ - int arg; - FD_CLR(fd, &xdMask); -# if defined(O_ASYNC) - if ( fcntl(fd, F_SETOWN, getpid() ) < 0) perror("fcntl(F_SETOWN, getpid())"); - if ((arg= fcntl(fd, F_GETFL, 0 )) < 0) perror("fcntl(F_GETFL)"); - if ( fcntl(fd, F_SETFL, arg | O_NONBLOCK | O_ASYNC) < 0) perror("fcntl(F_SETFL, O_ASYNC)"); -# elif defined(FASYNC) - if ( fcntl(fd, F_SETOWN, getpid() ) < 0) perror("fcntl(F_SETOWN, getpid())"); - if ((arg= fcntl(fd, F_GETFL, 0 )) < 0) perror("fcntl(F_GETFL)"); - if ( fcntl(fd, F_SETFL, arg | O_NONBLOCK | FASYNC ) < 0) perror("fcntl(F_SETFL, FASYNC)"); -# elif defined(FIOASYNC) - arg= getpid(); if (ioctl(fd, SIOCSPGRP, &arg) < 0) perror("ioctl(SIOCSPGRP, getpid())"); - arg= 1; if (ioctl(fd, FIOASYNC, &arg) < 0) perror("ioctl(FIOASYNC, 1)"); -# endif - } -} - - -/* install/change the handler for a descriptor */ - -void aioHandle(int fd, aioHandler handlerFn, int mask) -{ - FPRINTF((stderr, "aioHandle(%d, %s, %d)\n", fd, handlerName(handlerFn), mask)); - if (fd < 0) - { - FPRINTF((stderr, "aioHandle(%d): IGNORED\n", fd)); - return; - } -# define _DO(FLAG, TYPE) \ - if (mask & FLAG) { \ - FD_SET(fd, &TYPE##Mask); \ - TYPE##Handler[fd]= handlerFn; \ - } - _DO_FLAG_TYPE(); -# undef _DO -} - - -/* temporarily suspend asynchronous notification for a descriptor */ - -void aioSuspend(int fd, int mask) -{ - if (fd < 0) - { - FPRINTF((stderr, "aioSuspend(%d): IGNORED\n", fd)); - return; - } - FPRINTF((stderr, "aioSuspend(%d)\n", fd)); -# define _DO(FLAG, TYPE) \ - { \ - if (mask & FLAG) \ - { \ - FD_CLR(fd, &TYPE##Mask); \ - TYPE##Handler[fd]= undefinedHandler; \ - } \ - } - _DO_FLAG_TYPE(); -# undef _DO -} - - -/* definitively disable asynchronous notification for a descriptor */ - -void aioDisable(int fd) -{ - if (fd < 0) - { - FPRINTF((stderr, "aioDisable(%d): IGNORED\n", fd)); - return; - } - FPRINTF((stderr, "aioDisable(%d)\n", fd)); - aioSuspend(fd, AIO_RWX); - FD_CLR(fd, &xdMask); - FD_CLR(fd, &fdMask); - rdHandler[fd]= wrHandler[fd]= exHandler[fd]= 0; - clientData[fd]= 0; - /* keep maxFd accurate (drops to zero if no more sockets) */ - while (maxFd && !FD_ISSET(maxFd - 1, &fdMask)) - --maxFd; -} Copied: branches/Cog/platforms/iOS/vm/Common/sqDummyaio.h (from rev 3536, branches/Cog/platforms/iOS/vm/iPhone/sqDummyaio.h) =================================================================== --- branches/Cog/platforms/iOS/vm/Common/sqDummyaio.h (rev 0) +++ branches/Cog/platforms/iOS/vm/Common/sqDummyaio.h 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,44 @@ +/* + * sqDummyaio.h + * SqueakNoOGLIPhone + * + * Created by John M McIntosh on 5/29/08. + * + */ + +/* + Some of this code was funded via a grant from the European Smalltalk User Group (ESUG) + Copyright (c) 2008 Corporate Smalltalk Consulting Ltd. All rights reserved. + MIT License + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + The end-user documentation included with the redistribution, if any, must include the following acknowledgment: + "This product includes software developed by Corporate Smalltalk Consulting Ltd (http://www.smalltalkconsulting.com) + and its contributors", in the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software itself, in the same form and location as other + such third-party acknowledgments. + */ + + +int aioPoll(int microSeconds); +void aioInit(void); +int aioSleep(int microSeconds); Modified: branches/Cog/platforms/iOS/vm/Common/version.c =================================================================== --- branches/Cog/platforms/iOS/vm/Common/version.c 2016-02-10 17:36:18 UTC (rev 3575) +++ branches/Cog/platforms/iOS/vm/Common/version.c 2016-02-10 17:48:30 UTC (rev 3576) @@ -1,15 +1,25 @@ -#if !defined __VERSION__ -# define __VERSION__ "Unknown" -#endif - -#if !defined(TZ) -# define TZ "" -# define SPACER "" -#else -# define SPACER " " -#endif - -char vmBuildString[] = \ - "Mac OS X built on " \ - __DATE__" "__TIME__ SPACER TZ \ - " Compiler: " __VERSION__; +/* Two versioning facilities in one file. If VERSION_PROGRAM is + * defined as non-zero then this will run the main in + * platforms/Cross/vm/sqSCCSVersion.h which will print various version + * info. Otherewise this defines vmBuildString with the current + * compiler. + */ +#if VERSION_PROGRAM +# include "sqSCCSVersion.h" +#else +# if !defined __VERSION__ +# define __VERSION__ "Unknown" +# endif + +# if !defined(TZ) +# define TZ "" +# define SPACER "" +# else +# define SPACER " " +# endif + +char vmBuildString[] = \ + "Mac OS X built on " \ + __DATE__" "__TIME__ SPACER TZ \ + " Compiler: " __VERSION__; +#endif /* VERSION_PROGRAM */ Modified: branches/Cog/platforms/iOS/vm/OSX/GreenCogSqueak.icns =================================================================== (Binary files differ) Added: branches/Cog/platforms/iOS/vm/OSX/Pharo-Info.plist =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/Pharo-Info.plist (rev 0) +++ branches/Cog/platforms/iOS/vm/OSX/Pharo-Info.plist 2016-02-10 17:48:30 UTC (rev 3576) @@ -0,0 +1,536 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>image</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>Pharo.icns</string> + <key>CFBundleTypeName</key> + <string>Pharo Image File</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>STim</string> + </array> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>sources</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>SqueakSources.icns</string> + <key>CFBundleTypeName</key> + <string>Squeak Sources File</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>STso</string> + </array> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>changes</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>SqueakChanges.icns</string> + <key>CFBundleTypeName</key> + <string>Squeak Changes File</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>STch</string> + </array> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>sobj</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>SqueakScript.icns</string> + <key>CFBundleTypeName</key> + <string>Squeak Script File</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>SOBJ</string> + </array> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>pr</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>SqueakProject.icns</string> + <key>CFBundleTypeName</key> + <string>Squeak Project File</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>STpr</string> + </array> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>JPEG</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>JPEG</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>TEXT</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>TEXT</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>ttro</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>ttro</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>HTML</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>HTML</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>RTF </string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>RTF</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>TIFF </string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>TIFF</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>PICT </string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>PICT</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>URL </string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>URL</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>ZIP </string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>ZIP</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>zip </string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>zip</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>BINA</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>BINA</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>GIFf</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>GIFf</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>PNGf</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>PNGf</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>MP3 </string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>MP3</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> @@ Diff output truncated at 50000 characters. @@ |
Free forum by Nabble | Edit this page |