Skip to content

Commit

Permalink
Revert "On macOS allow DUAL_MAPPED_CODE_ZONE to be tested, and don't …
Browse files Browse the repository at this point in the history
…include COGDEFS"

This reverts commit b84ea7a.
  • Loading branch information
eliotmiranda committed Jul 3, 2021
1 parent b84ea7a commit efb5122
Show file tree
Hide file tree
Showing 10 changed files with 365 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.macos32x86/common/Makefile.vm
Expand Up @@ -119,7 +119,7 @@ DEBUGVM=-DDEBUGVM=0 -DNDEBUG=1 # Define NDEBUG for production to exclude asserts
endif

TZ:=$(shell date +%Z)
DEFS:= -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
DEFS:= $(COGDEFS) -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
-DUSE_INLINE_MEMORY_ACCESSORS -D'TZ="$(TZ)"' \
-DHAVE_CONFIG_H=1

Expand Down
2 changes: 1 addition & 1 deletion build.macos64ARMv8/common/Makefile.flags
Expand Up @@ -45,7 +45,7 @@ ifdef BIT_IDENTICAL_FLOATING_POINT
CFLAGS:=$(CFLAGS) -DBIT_IDENTICAL_FLOATING_POINT=1
endif

CFLAGS:=$(CFLAGS) -DBUILD_FOR_OSX=1 -DUSE_METAL=1 -DUSE_CORE_GRAPHICS=1 \
CFLAGS:=$(CFLAGS) -DBUILD_FOR_OSX=1 -DUSE_METAL=1 -DUSE_OPENGL=1 -DUSE_CORE_GRAPHICS=1 \
-arch $(TARGET_ARCH) \
-mmacosx-version-min=$(TARGET_VERSION_MIN) \
-fvisibility=default \
Expand Down
2 changes: 1 addition & 1 deletion build.macos64ARMv8/common/Makefile.vm
Expand Up @@ -123,7 +123,7 @@ DEBUGVM=-DDEBUGVM=0 -DNDEBUG=1 # Define NDEBUG for production to exclude asserts
endif

TZ:=$(shell date +%Z)
DEFS:= -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
DEFS:= $(COGDEFS) -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
-DUSE_INLINE_MEMORY_ACCESSORS -D'TZ="$(TZ)"' \
-DUSE_METAL=1 -DHAVE_CONFIG_H=1
XDEFS:= -DSQUEAK_BUILTIN_PLUGIN
Expand Down
13 changes: 13 additions & 0 deletions build.macos64ARMv8/squeak.cog.spur/Makefile
@@ -0,0 +1,13 @@
##############################################################################
# Makefile for Mac OS X Cog Spur Squeak Cocoa VM using clang and gnu make 3.81
# Do make init to allow make -n to function.
#

BIT_IDENTICAL_FLOATING_POINT=BIT_IDENTICAL_FLOATING_POINT

VMSRCDIR:= ../../spur64src/vm
SOURCEFILE:=SqueakV50.sources

# Now include the Makefile proper, which is common to all Mac OS builds.
#
include ../common/Makefile.app.squeak
347 changes: 347 additions & 0 deletions build.macos64x64/common/Makefile.vm
@@ -0,0 +1,347 @@
#############################################################################
# Generic Makefile for Mac OS VM
# Do make getversion to get make -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.
#
# SDK optional specific SDK instead of oldest suitable available version,
# e.g. SDK:=MacOSX10.13.sdk
#
# TARGET_VERSION_MIN optional oldest supported target instead of default 10.7
# e.g. TARGET_VERSION_MIN:=10.11
#
# LINK_WITH_CXX optional, use clang++ to link. Simply set to non-empty
#
# 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
export VM
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
export PLUGINSRCDIR

# CONFIGURATION defines what version of the VM to build, product, assert or
# debug. The default is overridden in the mvm script

CONFIGURATION?=product
export CONFIGURATION


#############################################################################
# Build directories
#

ifeq ($(CONFIGURATION),assert)
BUILD:=buildast
else ifeq ($(CONFIGURATION),debug)
BUILD:=builddbg
else # default CONFIGURATION=product
BUILD:=build
endif
ifeq ($(THREADING),multi)
MAKERSRC:=$(wildcard $(VMSRCDIR)/gcc3x-*interpmt.c $(VMSRCDIR)/cogit.c)
else
MAKERSRC:=$(wildcard $(VMSRCDIR)/gcc3x-*interp.c $(VMSRCDIR)/cogit.c)
endif
$(shell mkdir -p deps >/dev/null) # deps is the dependencies directory
BLDDIR:= $(BUILD)
export BLDDIR
OBJDIR:= $(BLDDIR)/vm

PLATDIR:=../../platforms
export PLATDIR
CROSSDIR:=$(PLATDIR)/Cross/vm
TPDIR:=$(PLATDIR)/Cross/third-party
OSXDIR:=$(PLATDIR)/iOS/vm/OSX
OSXCOMMONDIR:=$(PLATDIR)/iOS/vm/Common
OSXCLASSESDIR:=$(PLATDIR)/iOS/vm/Common/Classes
OSXPLUGINSDIR:=$(PLATDIR)/iOS/plugins
UNIXVMDIR:=$(PLATDIR)/unix/vm

CROSSSRC:= $(wildcard $(CROSSDIR)/*.c)
#XEX:= ... %/sqMacV2Browser.m ...
XEX:=%/sqSqueakMainApplication+screen.m %/sqMacV2Window.m \
%/SqViewBitmapConversion.m
OSXSRC=$(wildcard $(OSXDIR)/*.c) $(wildcard $(OSXDIR)/*.m) \
$(wildcard $(OSXCOMMONDIR)/*.c) $(wildcard $(OSXCOMMONDIR)/*.m) \
$(wildcard $(OSXCLASSESDIR)/*.c) $(wildcard $(OSXCLASSESDIR)/*.m)
OSXSRC:=$(filter-out $(XEX),$(OSXSRC))
UNIXSRC:=$(addprefix $(UNIXVMDIR)/,aio.c sqUnixHeartbeat.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)))

ifdef BIT_IDENTICAL_FLOATING_POINT
LIBS:=$(LIBS) $(BLDDIR)/fdlibm/libm.a
endif

# VM config flags.
ifeq ($(CONFIGURATION),debug)
OFLAGS:= -g -O0 -fno-omit-frame-pointer
DEBUGVM=-DDEBUGVM=1 -DAIO_DEBUG
else ifeq ($(CONFIGURATION),assert)
OFLAGS:= -g -O1 -fno-omit-frame-pointer
DEBUGVM=-DDEBUGVM=0
else # default CONFIGURATION=product
OFLAGS:= -g -Os
DEBUGVM=-DDEBUGVM=0 -DNDEBUG=1 # Define NDEBUG for production to exclude asserts
endif

TZ:=$(shell date +%Z)
DEFS:= $(COGDEFS) -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
-DUSE_INLINE_MEMORY_ACCESSORS -D'TZ="$(TZ)"' \
-DUSE_METAL=1 -DHAVE_CONFIG_H=1
XDEFS:= -DSQUEAK_BUILTIN_PLUGIN
CFLAGS:= $(OFLAGS) $(COGDEFS) $(DEBUGVM) $(DEFS) $(XDEFS)
INCLUDES:= $(addprefix -I,. $(SRCDIRS))

#############################################################################
# Linker settings
#
LD:= gcc

#############################################################################
# Ensure version control info is up-to-date, and extract it from the file.
#
SCCSVER:=$(PLATDIR)/Cross/vm/sqSCCSVersion.h

ifneq ($(shell grep 'GitRawRevisionString.*$$Rev$$.' $(SCCSVER)),)
$(shell bash -c "cd ../../scripts; ./updateSCCSVersions")
endif

SVNREV:= $(shell sed -e "s/^static.*GitRawRevisionString.*Rev: \([0-9][0-9]*\).*/\\1/p" -e d $(SCCSVER))


#############################################################################
# Common build rules
#
include ../common/Makefile.rules

svnver:
@-echo $(SVNREV)

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

productilc:
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) CONFIGURATION=product build/vm/validImage

assertilc:
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) CONFIGURATION=assert buildast/vm/validImage

debugilc:
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) CONFIGURATION=debug builddbg/vm/validImage

cleanallvm: cleandeps cleanvm cleanvmast cleanvmdbg cleangv

cleandeps:
rm -rf deps

cleanvm:
rm -rf sqNamedPrims.h build

cleanvmast:
rm -rf sqNamedPrims.h buildast

cleanvmdbg:
rm -rf sqNamedPrims.h builddbg

cleangv:
rm -rf getversion getversion.*

print-source:
$(info ---------------- Makefile.vm sources ------------------)
$(info CROSSSRC=$(CROSSSRC))
$(info OSXSRC=$(OSXSRC))
$(info MAKERSRC=$(MAKERSRC))
$(info UNIXSRC=$(UNIXSRC))
$(info VMSRC=$(VMSRC))

print-settings:
$(info ---------------- Makefile.vm settings ------------------)
$(info CONFIGURATION=$(CONFIGURATION))
$(info VPATH=$(VPATH))
$(info INCLUDES=$(INCLUDES))
$(info CFLAGS=$(CFLAGS))
$(info INTERNAL_PLUGINS=$(INTERNAL_PLUGINS))
$(info EXTERNAL_PLUGINS=$(EXTERNAL_PLUGINS))
$(info OBJDIR=$(OBJDIR))
$(info LIBS=$(LIBS))
$(info BUNDLES=$(BUNDLES))
$(info SDK=$(SDK))
$(info -----------------------------------------------------)

print-deps:
$(info ---------------- Makefile.vm dep files ------------------)
$(info deps=$(patsubst %,deps/%.d,$(notdir $(basename $(VMSRC)))))
$(info ---------------- Makefile.vm dep files ------------------)

print-objects:
$(info ---------------- Makefile.vm objects ------------------)
$(info VMOBJ=$(VMOBJ))
$(info -----------------------------------------------------)

ignore := $(addsuffix .%, $(basename $(wildcard $(BUILD)/vm/*.ignore)))

$(OBJDIR)/$(VM): $(OBJDIR) $(VMOBJ) $(LIBS)
$(CC) -o $(OBJDIR)/version.o $(CFLAGS) $(INCLUDES) $(DEFS) -c $(OSXCOMMONDIR)/version.c
ifneq ($(LINK_WITH_CXX),)
$(LDCXX) -arch $(TARGET_ARCH) -mmacosx-version-min=$(TARGET_VERSION_MIN) \
-isysroot $(SDK) $(CXXVERFLAGS) $(LDFLAGS) $(FRAMEWORKS) \
-Wl,-headerpad_max_install_names \
-o $(OBJDIR)/$(VM) $(VMOBJ) $(filter-out $(call ignore), $(LIBS))
else
$(CC) -arch $(TARGET_ARCH) -mmacosx-version-min=$(TARGET_VERSION_MIN) \
-isysroot $(SDK) $(LDFLAGS) $(FRAMEWORKS) \
-Wl,-headerpad_max_install_names \
-o $(OBJDIR)/$(VM) $(VMOBJ) $(filter-out $(call ignore), $(LIBS))
endif

$(OBJDIR)/validImage: $(OBJDIR)/validImage.o $(OBJDIR)/sqUnixSpurMemory.o $(OBJDIR)/sqHeapMap.o
$(LD) -arch $(TARGET_ARCH) -o $@ $^

$(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

validImage: $(OBJDIR) $(OBJDIR)/validImage

#############################################################################
# Building plugins
#
.PHONY: $(OBJDIR)/%.lib $(OBJDIR)/%.bundle $(OBJDIR)/%.dylib

ifeq ($(USEPLUGINASDYLIB),TRUE)
plugin-makefile = $(firstword $(realpath $(OSXPLUGINSDIR)/$(subst lib,,$(1))/Makefile ../common/Makefile.plugin))
else
plugin-makefile = $(firstword $(realpath $(OSXPLUGINSDIR)/$(1)/Makefile ../common/Makefile.plugin))
endif

# 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)
test $@ -ot $(call plugin-makefile,$(*F)) && rm -rf $(BUILD)/vm/$(*F).* || true
rm -f $(BUILD)/vm/$(*F).ignore
$(MAKE) $(MFLAGS) BUILD=$(BUILD) \
-f $(call plugin-makefile,$(*F)) MAKEFILE=$(call plugin-makefile,$(*F)) \
ARCH=$(TARGET_ARCH) TARGET_VERSION_MIN=$(TARGET_VERSION_MIN) \
VMSRCDIR=$(VMSRCDIR) \
LIBNAME=$(*F) COGDEFS="$(COGDEFS)" XDEFS=-DSQUEAK_BUILTIN_PLUGIN \
CXXVERFLAGS="$(CXXVERFLAGS)" $(PLUGINHACK) \
$(OBJDIR)/$(*F).lib

prereqs/%.lib:
@-ls -rlt $(call plugin-makefile,$(*F)) $(wildcard $(*F).ignore) \
$(wildcard $(PLUGINSRCDIR)/$(*F)/*.c) \
$(wildcard $(PLATDIR)/Cross/plugins/$(*F)/*.*) \
$(wildcard $(OSXPLUGINSDIR)/$(*F)/*.*)

# It would be nice to have this abbreviation but it creates havoc eem 2/2016
#%.lib: $(OBJDIR)/%.lib
# make $(MAKEFLAGS) $<

# 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)
test $@ -ot $(call plugin-makefile,$(*F)) && rm -rf $(BUILD)/vm/$(*F).* || true
rm -f $(BUILD)/vm/$(*F).ignore
$(MAKE) $(MFLAGS) BUILD=$(BUILD) \
-f $(call plugin-makefile,$(*F)) MAKEFILE=$(call plugin-makefile,$(*F)) \
ARCH=$(TARGET_ARCH) TARGET_VERSION_MIN=$(TARGET_VERSION_MIN) \
VMSRCDIR=$(VMSRCDIR) \
LIBNAME=$(*F) COGDEFS="$(COGDEFS)" \
THIRDPARTYOUTDIR=$(THIRDPARTYOUTDIR) \
CXXVERFLAGS="$(CXXVERFLAGS)" $(PLUGINHACK) \
$(OBJDIR)/$(*F).bundle

# External plugin. Made in the "Pharo way": as a simple dylib to be included in
# Plugins directory
$(OBJDIR)/%.dylib: FORCE
@-mkdir -p $(BLDDIR)/$(*F)
test $@ -ot $(call plugin-makefile,$(*F)) && rm -rf $(BUILD)/vm/$(*F).* || true
rm -f $(BUILD)/vm/$(*F).ignore
$(MAKE) $(MFLAGS) BUILD=$(BUILD) \
-f $(call plugin-makefile,$(*F)) MAKEFILE=$(call plugin-makefile,$(*F)) \
ARCH=$(TARGET_ARCH) TARGET_VERSION_MIN=$(TARGET_VERSION_MIN) \
VMSRCDIR=$(VMSRCDIR) \
LIBNAME=$(*F) USEPLUGINASDYLIB=TRUE COGDEFS="$(COGDEFS)" \
THIRDPARTYOUTDIR=$(THIRDPARTYOUTDIR) \
CXXVERFLAGS="$(CXXVERFLAGS)" $(PLUGINHACK) \
$(OBJDIR)/$(*F).dylib

# It would be nice to have this abbreviation but it creates havoc eem 2/2016
#%.bundle: $(OBJDIR)/%.bundle
# make $(MAKEFLAGS) $<

$(BLDDIR)/fdlibm/libm.a:
@-mkdir -p $(@D)
$(MAKE) CFLAGS="$(OFLAGS) -arch $(TARGET_ARCH) -D_IEEE_LIBM -isysroot $(SDK)" -C $(@D) \
TP=../../$(TPDIR) -f ../../$(TPDIR)/fdlibm/Makefile.remote

FORCE:

.PRECIOUS: $(OBJDIR)/%.lib $(OBJDIR)/%.bundle

#############################################################################
# Extra specific dependencies
#
sqNamedPrims.h: plugins.int
$(PLATDIR)/Cross/util/mkNamedPrims.sh plugins.int > sqNamedPrims.h

$(OBJDIR)/sqNamedPrims.o: sqNamedPrims.c sqNamedPrims.h
Expand Up @@ -92,7 +92,7 @@ - (const char *) getAttribute:(sqInt)indexNumber {
else {
switch (indexNumber) {
case 0:
return fullExeName;
return [[[[NSBundle mainBundle] executablePath] precomposedStringWithCanonicalMapping] UTF8String];

case 1:
return [self getImageName];
Expand Down

0 comments on commit efb5122

Please sign in to comment.