Skip to content

Commit

Permalink
pharo 64bits osx, first pass
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Aug 2, 2016
1 parent f008dd6 commit ea59767
Show file tree
Hide file tree
Showing 26 changed files with 476 additions and 51 deletions.
2 changes: 1 addition & 1 deletion build.macos32x86/common/Makefile.extra
Expand Up @@ -9,7 +9,7 @@
THIRDPARTYDIR:=$(BLDDIR)/third-party
THIRDPARTYOUTDIR:=$(abspath $(THIRDPARTYDIR)/out)
THIRDPARTYLIBDIR:=$(THIRDPARTYOUTDIR)/lib
THIRDPARTYINCLUDEDIR=$(THIRDPARTYOUTDIR)/include
THIRDPARTYINCLUDEDIR:=$(THIRDPARTYOUTDIR)/include

ifeq ($(USEPLUGINASDYLIB),TRUE)
THIRDPARTYINSTALLDIR:=$(APP)/Contents/MacOS/Plugins
Expand Down
3 changes: 2 additions & 1 deletion build.macos32x86/pharo.cog.spur/Makefile
Expand Up @@ -10,7 +10,7 @@ COGDEFS:=-DPharoVM=1
APPNAME:=Pharo
APPNAMEDEF:=$(APPNAME)
USEPLUGINASDYLIB:=TRUE
THIRDPARTYLIBS:=pkgconfig freetype2 libssh2 libgit2 pixman libpng cairo
THIRDPARTYLIBS:=pkgconfig freetype2 libssh2 libgit2 libsdl2 pixman libpng cairo

# Now include the Makefile proper, which is common to all Mac OS builds.
#
Expand All @@ -22,6 +22,7 @@ include ../third-party/pkgconfig/Makefile.lib
include ../third-party/freetype2/Makefile.lib
include ../third-party/libssh2/Makefile.lib
include ../third-party/libgit2/Makefile.lib
include ../third-party/libsdl2/Makefile.lib
include ../third-party/pixman/Makefile.lib
include ../third-party/libpng/Makefile.lib
include ../third-party/cairo/Makefile.lib
44 changes: 34 additions & 10 deletions build.macos64x64/common/Makefile.app
Expand Up @@ -23,33 +23,51 @@
# 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 ($(APPNAME),)
APPNAME:=Cocoa
endif
ifeq ($(APPNAMEDEF),)
APPNAMEDEF:=$(APPNAME)Fast
endif
ifeq ($(USEPLUGINASDYLIB),)
USEPLUGINASDYLIB:=FALSE
endif

ifeq ($(CONFIGURATION),debug)
APP:=CocoaDebug.app
APP:=$(APPNAME)Debug.app
else ifeq ($(CONFIGURATION),assert)
APP:=CocoaAssert.app
else # default CONFIGURATION=product => CocoaFast.app
APP:=CocoaFast.app
APP:=$(APPNAME)Assert.app
else # default CONFIGURATION=product => $(APPNAMEDEF).app
APP:=$(APPNAMEDEF).app
endif

default: $(APP)

include ../common/Makefile.vm
include ../common/Makefile.extra

cleanall: cleanapp cleanastapp cleandbgapp cleanallvm

cleanapp:
rm -rf CocoaFast.app
rm -rf $(APPNAMEDEF).app

cleanastapp:
rm -rf CocoaAssert.app
rm -rf $(APPNAME)Assert.app

cleandbgapp:
rm -rf CocoaDebug.app
rm -rf $(APPNAME)Debug.app

VMEXE:=$(APP)/Contents/MacOS/$(VM)
VMPLIST:=$(APP)/Contents/Info.plist

ifeq ($(USEPLUGINASDYLIB),FALSE)
VMBUNDLES:=$(addprefix $(APP)/Contents/Resources/, $(addsuffix .bundle, $(EXTERNAL_PLUGINS)))
else ifeq ($(USEPLUGINASDYLIB),TRUE)
VMPLUGINDYLIBS:=$(addprefix $(APP)/Contents/MacOS/Plugins/lib, $(addsuffix .dylib, $(EXTERNAL_PLUGINS)))
else
$(error USEPLUGINASDYLIB has to be TRUE or FALSE)
endif

OSXICONS:=$(OSXDIR)/$(VM).icns $(wildcard $(OSXDIR)/$(SYSTEM)*.icns)
VMICONS:=$(addprefix $(APP)/Contents/Resources/,$(notdir $(OSXICONS)))
VMMENUNIB:=$(APP)/Contents/Resources/English.lproj/MainMenu.nib
Expand All @@ -63,17 +81,17 @@ SOURCES:=$(SOURCES) $(APP)/Contents/Resources/$(APPSOURCE)
endif


$(APP): cleanbundles $(VMEXE) $(VMBUNDLES) \
$(APP): cleanbundles $(VMEXE) $(VMBUNDLES) $(VMPLUGINDYLIBS) \
$(VMPLIST) $(VMLOCALIZATION) $(VMMENUNIB) $(VMICONS) \
$(SOURCES) $(APPPOST) signapp touchapp
$(SOURCES) $(THIRDPARTYLIBS) $(APPPOST) signapp touchapp

# Bundles with missing prerequisites won't be built. But we need to force the
# attempt to make them every time in case the prerequisites /have/ been built.
# to do this we must both delete the bundles and touch any ignore files, upon
# which the bundle build depends.
cleanbundles:
-rm -rf $(APP)/Contents/Resources/*.bundle
-touch $(OBJDIR)/*.ignore
-touch $(OBJDIR)/*.ignore

$(VMEXE): $(OBJDIR)/$(VM)
@mkdir -p $(APP)/Contents/MacOS
Expand All @@ -88,6 +106,11 @@ $(APP)/Contents/Resources/%.bundle: $(BLDDIR)/vm/%.bundle
echo cp -pR $< $(APP)/Contents/Resources; \
cp -pR $< $(APP)/Contents/Resources; \
fi

$(APP)/Contents/MacOS/Plugins/%.dylib: $(BLDDIR)/vm/%.dylib
@mkdir -p $(APP)/Contents/MacOS/Plugins
cp -p $< $(APP)/Contents/MacOS/Plugins


$(VMPLIST): $(OSXDIR)/$(SYSTEM)-Info.plist getversion
@mkdir -p $(APP)/Contents
Expand Down Expand Up @@ -139,6 +162,7 @@ print-app-settings:
@echo APP=$(APP)
@echo VMEXE=$(VMEXE)
@echo VMBUNDLES=$(VMBUNDLES)
@echo VMPLUGINDYLIBS=$(VMPLUGINDYLIBS)
@echo VMPLIST=$(VMPLIST)
@echo VMICONS=$(VMICONS)
@echo SIGNING_IDENTITY=$(SIGNING_IDENTITY)
Expand Down
27 changes: 27 additions & 0 deletions build.macos64x64/common/Makefile.extra
@@ -0,0 +1,27 @@
#
# THIRDPARTYLIBS The libraries to build (you define them in ./third-party/LIB/Makefile.lib)
# THIRDPARTYDIR Where to build libraries
# THIRDPARTYOUTDIR Where to first install libraries (output place)
#
# REQUIRES:
# USEPLUGINASDYLIB Used to define where to place built libraries (default is FALSE (or absent)).
#
THIRDPARTYDIR:=$(BLDDIR)/third-party
THIRDPARTYOUTDIR:=$(abspath $(THIRDPARTYDIR)/out)
THIRDPARTYLIBDIR:=$(THIRDPARTYOUTDIR)/lib
THIRDPARTYINCLUDEDIR:=$(THIRDPARTYOUTDIR)/include

ifeq ($(USEPLUGINASDYLIB),TRUE)
THIRDPARTYINSTALLDIR:=$(APP)/Contents/MacOS/Plugins
else
THIRDPARTYINSTALLDIR:=$(APP)/Contents/Resources
endif

$(THIRDPARTYDIR):
mkdir -p $(THIRDPARTYDIR)

$(THIRDPARTYOUTDIR): $(THIRDPARTYDIR)
mkdir -p $(THIRDPARTYOUTDIR)

$(THIRDPARTYINSTALLDIR):
mkdir -p $(THIRDPARTYINSTALLDIR)
4 changes: 4 additions & 0 deletions build.macos64x64/common/Makefile.flags
Expand Up @@ -29,6 +29,10 @@ BFLAGS:=-arch $(TARGET_ARCH) \
-bundle \
-isysroot $(SDK)

DYFLAGS:=-arch $(TARGET_ARCH) \
-shared \
-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 \
Expand Down
69 changes: 48 additions & 21 deletions build.macos64x64/common/Makefile.plugin
@@ -1,20 +1,21 @@
#############################################################################
# Generic Makefile for plugins on Cocoa Mac OS X
# Do make getversion to get makwe -n to work
# Do make getversion to get make -n to work
#
# The following variables can be overridden in the platform Makefile, e.g.
# platforms/iOS/plugins/AioPlugin/Makefile. Look at
# platforms/iOS/plugins/*/Makefile for examples.
#
# CFLAGS adds additional compilation flags to source file compilation
# XCFLAGS adds additional compilation flags after all other flags
# EXCLUDESRC defines patterns of source files to not compile, e.g. %/dump.c
# EXTRALIBS defines additional libraries to link into an external plugin bundle
# INCDIRS defines additonal directories in which to search for includes
# LIBSRC overrides the set of files to compile (if EXCLUDESRC inconvenient)
# LINK_WITH_CPP set to non-empty to link external plugin bundle with c++ runtime
# SRCDIRS supplies additional directories containing files to compile.
# PREREQUISITES supplies names of files that must exist to make lib or bundle
# CFLAGS adds additional compilation flags to source file compilation
# XCFLAGS adds additional compilation flags after all other flags
# EXCLUDESRC defines patterns of source files to not compile, e.g. %/dump.c
# EXTRALIBS defines additional libraries to link into an external plugin bundle
# INCDIRS defines additonal directories in which to search for includes
# LIBSRC overrides the set of files to compile (if EXCLUDESRC inconvenient)
# LINK_WITH_CPP set to non-empty to link external plugin bundle with c++ runtime
# SRCDIRS supplies additional directories containing files to compile.
# PREREQUISITES supplies names of files that must exist to make lib or bundle
# THIRDPARTYLIBS supplies names for third-party libraries that needs to be built

$(info $$(LIBNAME): $(LIBNAME))

Expand Down Expand Up @@ -51,12 +52,21 @@ CFLAGS:= $(CFLAGS) $(OFLAGS) $(COGDEFS) $(DEBUGVM) $(XDEFS)
# BUILDDIR: The location where the plugin is built
#
#PLUGINSRCDIR:= ../../src/plugins
CROSSDIR:= $(PLATDIR)/Cross/plugins/$(LIBNAME)

ifeq ($(USEPLUGINASDYLIB),TRUE)
# I do not like to use lib "as is" because that will strip all "lib" occurences, but I do not
# find any better solution :(
LIBDIR:=$(subst lib,,$(LIBNAME))
else
LIBDIR:=$(LIBNAME)
endif

CROSSDIR:= $(PLATDIR)/Cross/plugins/$(LIBDIR)
OSXDIR:= $(PLATDIR)/iOS/vm/OSX
OSXPLGDIR:= $(PLATDIR)/iOS/plugins/$(LIBNAME)
OSXPLGDIR:= $(PLATDIR)/iOS/plugins/$(LIBDIR)
UNIXDIR:= $(PLATDIR)/unix/vm
MAKERDIR:= $(PLUGINSRCDIR)/$(LIBNAME)
BUILDDIR:= $(BUILD)/$(LIBNAME)
MAKERDIR:= $(PLUGINSRCDIR)/$(LIBDIR)
BUILDDIR:= $(BUILD)/$(LIBDIR)

# Support directory locations
CROSSVMDIR:=$(PLATDIR)/Cross/vm
Expand All @@ -77,7 +87,6 @@ ifneq ($(EXCLUDESRC),)
LIBSRC:=$(filter-out $(EXCLUDESRC),$(LIBSRC))
endif


#############################################################################
# bundle settings
#
Expand All @@ -97,6 +106,9 @@ VMDIR:= $(BUILD)/vm
PLUGINLIB:= $(VMDIR)/$(LIBNAME).lib
PLUGINBUNDLE:= $(VMDIR)/$(LIBNAME).bundle
PLUGINEXE:= $(PLUGINBUNDLE)/Contents/MacOS/$(LIBNAME)

PLUGINDYLIB:= $(VMDIR)/$(LIBNAME).dylib

# https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html
PLUGINPLIST:= $(PLUGINBUNDLE)/Contents/Info.plist
PLUGINICONS:= $(PLUGINBUNDLE)/Contents/Resources/SqueakPlugin.icns
Expand All @@ -114,7 +126,7 @@ $(BUILD)/$(LIBNAME)/$(LIBNAME).o: plugins.int plugins.ext

include ../common/Makefile.rules

all: $(PLUGINLIB) $(PLUGINBUNDLE)
all: $(PLUGINLIB) $(PLUGINBUNDLE) $(PLUGINDYLIB)

print-settings:
@echo ---------------- Makefile.plugin settings ------------------
Expand Down Expand Up @@ -153,15 +165,15 @@ $(VMDIR):
# If any prerequisites are declared all must exist to continue
ifeq ($(realpath $(PREREQUISITES)),$(abspath $(PREREQUISITES)))

$(PLUGINLIB): $(VMDIR) $(OBJDIR) $(LIBOBJ)
$(PLUGINLIB): $(PLUGINREQS) $(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)
$(PLUGINBUNDLE): $(PLUGINREQS) $(PLUGINEXE) $(PLUGINICONS) $(PLUGINPLIST)

$(PLUGINEXE): $(VMDIR) $(OBJDIR) $(LIBOBJ)
$(PLUGINEXE): $(PLUGINREQS) $(VMDIR) $(OBJDIR) $(LIBOBJ)
mkdir -p $(PLUGINBUNDLE)/Contents/MacOS
ifneq ($(LINK_WITH_CPP),)
$(LDCXX) \
Expand All @@ -181,9 +193,24 @@ $(PLUGINICONS): $(OSXDIR)/SqueakPlugin.icns

$(PLUGINPLIST): $(PLATDIR)/iOS/plugins/Info.plist getversion
mkdir -p $(PLUGINBUNDLE)/Contents
sed "s/\$$(VERSION)/`getversion VERSION_TAG`/" $< | \
sed "s/\$$(VERSION)/`./getversion VERSION_TAG`/" $< | \
sed "s/\$(LIBNAME)/$(LIBNAME)/" > $(PLUGINPLIST)

$(PLUGINDYLIB): $(PLUGINREQS) $(VMDIR) $(OBJDIR) $(LIBOBJ)
ifneq ($(LINK_WITH_CPP),)
$(LDCXX) \
$(DYFLAGS) \
-install_name @executable_path/Plugins/$(LIBNAME).dylib \
$(LIBOBJ) $(EXTRALIBS) \
-o $(VMDIR)/$(LIBNAME).dylib
else
$(LD) \
$(DYFLAGS) \
-install_name @executable_path/Plugins/$(LIBNAME).dylib \
$(LIBOBJ) $(EXTRALIBS) \
-o $(VMDIR)/$(LIBNAME).dylib
endif

getversion:
make -f ../common/Makefile.vm getversion

Expand Down
23 changes: 21 additions & 2 deletions build.macos64x64/common/Makefile.vm
Expand Up @@ -88,7 +88,6 @@ include plugins.ext
LIBS:= $(addprefix $(OBJDIR)/, $(addsuffix .lib, $(INTERNAL_PLUGINS)))
BUNDLES:= $(addprefix $(OBJDIR)/, $(addsuffix .bundle, $(EXTERNAL_PLUGINS)))


# VM config flags.
ifeq ($(CONFIGURATION),debug)
OFLAGS:= -g -O0 -fno-omit-frame-pointer
Expand Down Expand Up @@ -206,9 +205,13 @@ endif
#############################################################################
# Building plugins
#
.PHONY: $(OBJDIR)/%.lib $(OBJDIR)/%.bundle
.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
Expand Down Expand Up @@ -246,8 +249,24 @@ $(OBJDIR)/%.bundle: FORCE
CONFIGURATION=$(CONFIGURATION) ARCH=$(TARGET_ARCH) \
PLATDIR=$(PLATDIR) PLUGINSRCDIR=$(PLUGINSRCDIR) VMSRCDIR=$(VMSRCDIR) \
LIBNAME=$(*F) COGDEFS="$(COGDEFS)" \
APP=$(APP) BLDDIR=$(BLDDIR) \
$(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)) \
CONFIGURATION=$(CONFIGURATION) ARCH=$(TARGET_ARCH) \
PLATDIR=$(PLATDIR) PLUGINSRCDIR=$(PLUGINSRCDIR) VMSRCDIR=$(VMSRCDIR) \
LIBNAME=$(*F) COGDEFS="$(COGDEFS)" \
APP=$(APP) BLDDIR=$(BLDDIR) USEPLUGINASDYLIB=TRUE \
$(PLUGINHACK) \
$(OBJDIR)/$(*F).dylib

# It would be nice to have this abbreviation but it creates havoc eem 2/2016
#%.bundle: $(OBJDIR)/%.bundle
Expand Down
19 changes: 18 additions & 1 deletion build.macos64x64/pharo.cog.spur/Makefile
Expand Up @@ -3,10 +3,27 @@
# Do make init to allow make -n to function.
#

VMSRCDIR:= ../../spur64src/vm
VMSRCDIR:=../../spur64src/vm
PLUGINSRCDIR:=../../spur64src/plugins
VM:=Pharo
COGDEFS:=-DPharoVM=1
APPNAME:=Pharo
APPNAMEDEF:=$(APPNAME)
USEPLUGINASDYLIB:=TRUE
THIRDPARTYLIBS:=pkgconfig freetype2 libssh2 libsdl2 pixman libpng cairo
#libgit2

# Now include the Makefile proper, which is common to all Mac OS builds.
#
include ../common/Makefile.app

# third-party libraries
#
include ../third-party/pkgconfig/Makefile.lib
include ../third-party/freetype2/Makefile.lib
include ../third-party/libssh2/Makefile.lib
include ../third-party/libgit2/Makefile.lib
include ../third-party/libsdl2/Makefile.lib
include ../third-party/pixman/Makefile.lib
include ../third-party/libpng/Makefile.lib
include ../third-party/cairo/Makefile.lib

0 comments on commit ea59767

Please sign in to comment.