[Vm-dev] [commit] r2606 - add build file templates and configuration script

commits at squeakvm.org commits at squeakvm.org
Sun Sep 16 01:25:14 UTC 2012


Author: piumarta
Date: 2012-09-15 18:25:14 -0700 (Sat, 15 Sep 2012)
New Revision: 2606

Added:
   trunk/platforms/win32/build/Makefile.common.in
   trunk/platforms/win32/build/Makefile.in
   trunk/platforms/win32/build/Makefile.plugin.in
   trunk/platforms/win32/build/Squeak.ini.in
   trunk/platforms/win32/build/configure
Log:
add build file templates and configuration script

Added: trunk/platforms/win32/build/Makefile.common.in
===================================================================
--- trunk/platforms/win32/build/Makefile.common.in	                        (rev 0)
+++ trunk/platforms/win32/build/Makefile.common.in	2012-09-16 01:25:14 UTC (rev 2606)
@@ -0,0 +1,26 @@
+#############################################################################
+# Makefile for Win32 Squeak
+# Common definitions between main Makefile and Makefile.plugin
+# 
+# Last edited: 2012-09-15 20:06:57 by piumarta on W530
+
+# What is the name of the VM to build?
+VM = Squeak
+
+# What's the version identifier?
+VERSION = @VM_VERSION@
+
+# What's the RC version identifier?
+RCVERSION = @RC_VERSION@
+
+# Where is the root of the platform tree?
+PLATDIR = @PLATDIR@
+
+# Where is the root of the source tree?
+SRCDIR = @SRCDIR@
+
+# Where is the root of the MinGW tree?
+MINGWDIR = @MINGWDIR@
+
+# Where is the root of the DX7 SDK tree?
+DX7DIR = @DX7DIR@

Added: trunk/platforms/win32/build/Makefile.in
===================================================================
--- trunk/platforms/win32/build/Makefile.in	                        (rev 0)
+++ trunk/platforms/win32/build/Makefile.in	2012-09-16 01:25:14 UTC (rev 2606)
@@ -0,0 +1,253 @@
+#############################################################################
+# Makefile for Win32 Squeak
+#
+# Last edited: 2012-09-16 10:19:04 by piumarta on W530
+
+#############################################################################
+# Common definitions: VM, VERSION, RCVERSION, PLATDIR, SRCDIR, MINGWDIR, DX7DIR
+
+include Makefile.common
+
+#############################################################################
+# Base definitions:
+
+# Is this a Croquet VM (defaults to OGL instead of D3D)?
+# CROQUET=-DCROQUET
+
+#############################################################################
+# Default locations
+#
+ifndef BASEDIR
+BASEDIR= .
+endif
+
+BLDDIR= $(BASEDIR)/obj
+OBJDIR= $(BLDDIR)/vm
+
+CROSSDIR=$(PLATDIR)/Cross/vm
+WIN32DIR=$(PLATDIR)/win32/vm
+MAKERDIR=$(SRCDIR)/vm
+XMISCDIR=$(PLATDIR)/win32/misc
+
+CROSSSRC= $(wildcard $(CROSSDIR)/*.c)
+WIN32SRC= $(wildcard $(WIN32DIR)/*.c)
+MAKERSRC= $(wildcard $(MAKERDIR)/*.c)
+VMSRC   = $(notdir $(MAKERSRC) $(WIN32SRC) $(CROSSSRC))
+
+VPATH= $(VMDIR) $(WIN32DIR) $(CROSSDIR) $(XMISCDIR)
+
+#############################################################################
+# The internal (.lib) and external (.dll) plugins
+#
+include $(SRCDIR)/plugins.ext
+include $(SRCDIR)/plugins.int
+
+LIBS = $(addsuffix .lib, $(INTERNAL_PLUGINS))
+DLLS = $(addsuffix .dll, $(EXTERNAL_PLUGINS))
+
+#############################################################################
+# Generic VM source file definitions
+#
+VMDIR= $(SRCDIR)/vm
+VMOBJ:=	$(VMSRC:.c=.o)
+VMOBJ:=	$(filter-out interp.o sqFilePrims.o, $(VMOBJ))
+
+#LIBSRC = $(wildcard *.c)
+#LIBOBJ = $(LIBSRC:.c=.o)
+
+#############################################################################
+# SqueakVM definitions
+#
+SQUEAK= $(VM)$(VERSION)
+VMEXE=  $(VM)$(VERSION).exe
+VMDEF=	$(VM).def
+VMEXP=	$(VM).exp
+VMLIB=	$(VM).lib
+VMRES=	$(VM).res
+VMDEFIN=$(VM).def.in
+
+
+.SECONDARY:
+
+.PRECIOUS: gnu-interp.c
+
+#############################################################################
+# C compiler settings
+#
+CC=	gcc
+OFLAGS= -O2
+CFLAGS=	-g -mwindows \
+	-fomit-frame-pointer -funroll-loops -fschedule-insns2 $(OFLAGS)
+DEFS=	-DWIN32_FILE_SUPPORT -DNO_SERVICE -DNO_STD_FILE_SUPPORT -DNDEBUG \
+	-DLSB_FIRST -DVM_NAME="\"$(VM)\"" -DVM_VERSION="\"$(VERSION)\"" -DX86 $(XDEFS) $(CROQUET)
+XDEFS=	-DSQUEAK_BUILTIN_PLUGIN
+INCLUDES= -I. -I$(VMDIR) -I$(WIN32DIR) -I$(CROSSDIR) -I$(DX7DIR)/include -I$(MINGWDIR)/include $(XINC)
+
+#############################################################################
+# Linker settings
+#
+# Note: I had to use 'gcc' instead of 'ld' to prevent unresolved symbols
+#       The switch '-mwindows' gives us a GUI app instead of a console app.
+#
+LD=	 gcc
+LDFLAGS= -mwindows
+STDLIBS= -lddraw -ldinput -lopengl32 -lwsock32 -lcomdlg32 -lole32 -lwinmm \
+	 -lversion -luser32 -lgdi32 -lkernel32 -lcrtdll
+#LIBS=	 $(STDLIBS) $(CRTLIB)
+
+#############################################################################
+# Gnuifier settings
+#
+AWK=		gawk
+GNUIFY= $(PLATDIR)/win32/misc/gnuify
+
+#############################################################################
+# Tools to use
+#
+AR = ar rc
+CP = cp
+RM = rm
+DLLTOOL=	dlltool
+DLLWRAP=	dllwrap
+
+#############################################################################
+# RC settings
+#
+# Note: RC compiles the .rc files into linkable .o files
+#
+RC=	 windres
+RCFLAGS= 
+
+.SUFFIXES:
+.SUFFIXES:	.ccg .cc .c .o .s .i .rc .res .cg .hg .ccg
+
+
+
+#############################################################################
+# Common build rules
+#
+default: print-settings $(OBJDIR) $(VMEXE) $(DLLS) squeak
+
+print-settings:
+	@echo ---------------- Makefile settings ------------------
+	@echo "VPATH   =$(VPATH)"
+	@echo "INCLUDES=$(INCLUDES)"
+	@echo "CFLAGS  =$(CFLAGS)"
+	@echo -----------------------------------------------------
+
+$(VMEXE): gnu-interp.o $(VMOBJ) $(LIBS) $(VMEXP) resource.o
+	$(LD) $(LDFLAGS) -o $(OBJDIR)/$(VMEXE) $(OBJDIR)/gnu-interp.o $(addprefix $(OBJDIR)/,$(VMOBJ)) $(OBJDIR)/$(VMEXP) $(OBJDIR)/resource.o $(addprefix $(OBJDIR)/,$(LIBS)) $(STDLIBS)
+	$(RM) $(OBJDIR)/version.o
+	strip --strip-all $(OBJDIR)/$(VMEXE)
+
+gnu-interp.o : gnu-interp.c
+
+$(OBJDIR):
+	mkdir -p $(OBJDIR)
+
+squeak:
+	mkdir -p $(SQUEAK)
+	cp -p $(OBJDIR)/*.exe $(SQUEAK)/.
+	cp -p $(OBJDIR)/*.dll $(SQUEAK)/.
+	cp -p $(PLATDIR)/win32/build/Squeak.ini.in $(SQUEAK)/$(SQUEAK).ini
+	cp -p $(PLATDIR)/win32/build/splash.bmp $(SQUEAK)/.
+	ls -l $(SQUEAK)
+
+#############################################################################
+# The exports for named primitives from Squeak (required by VM)
+#
+$(VMDEF) $(VMEXP) $(VMLIB): $(VMOBJ)
+	$(DLLTOOL) --input-def $(PLATDIR)/win32/build/$(VMDEFIN) --output-def $(OBJDIR)/$(VMDEF) --output-exp $(OBJDIR)/$(VMEXP) --output-lib $(OBJDIR)/$(VMLIB) $(addprefix $(OBJDIR)/,$(VMOBJ))
+
+#############################################################################
+# Building plugins
+
+%.lib: $(BLDDIR)/%/Makefile.lib
+	$(MAKE) -C $(BLDDIR)/$* -fMakefile.lib LIBNAME=$* \
+	BASEDIR=../../$(BASEDIR) \
+	XDEFS=-DSQUEAK_BUILTIN_PLUGIN $*.lib
+	@$(CP) $(BLDDIR)/$*/$*.lib $(OBJDIR)
+
+# Check for Makefile in win32 plugins directory
+$(BLDDIR)/%/Makefile.lib: $(PLATDIR)/win32/plugins/%/Makefile
+	-mkdir -p $(BLDDIR)/$*
+	cp $< $@
+
+# Otherwise use default Makefile
+$(BLDDIR)/%/Makefile.lib: Makefile.plugin
+	-mkdir -p $(BLDDIR)/$*
+	cp $< $@
+
+%.dll: $(BLDDIR)/%/Makefile.dll
+	$(MAKE) -C $(BLDDIR)/$* -fMakefile.dll LIBNAME=$* \
+		BASEDIR=../../$(BASEDIR) \
+		$*.dll
+	@$(CP) $(BLDDIR)/$*/$*.dll $(OBJDIR)
+
+# Check for Makefile in win32 plugins directory
+$(BLDDIR)/%/Makefile.dll: $(PLATDIR)/win32/plugins/%/Makefile
+	@-mkdir -p $(BLDDIR)/$*
+	@cp $< $@
+
+# Otherwise use default Makefile
+$(BLDDIR)/%/Makefile.dll: Makefile.plugin
+	@-mkdir -p $(BLDDIR)/$*
+	@cp $< $@
+
+
+#############################################################################
+# Basic rules
+
+.c.o:
+		$(CC) -o $(OBJDIR)/$@ $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+
+.c.s:
+		$(CC) -S -o $@ -fverbose-asm -Wa,ah $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+
+gnu-interp.c:	interp.c $(GNUIFY)
+		$(AWK) -f $(GNUIFY) $< > $(BASEDIR)/$@
+
+.rc.res:
+		$(RC) $(RCFLAGS) -v -D RCVERSION="$(RCVERSION)" -D VMVERSION="\"\\\"$(VERSION)\\\"\"" --include-dir $(dir $<) -i $< -o $(OBJDIR)/$@
+
+resource.o:	$(VMRES)
+		$(RC) $(RCFLAGS) -i $(OBJDIR)/$< -o $(OBJDIR)/$@
+
+#############################################################################
+# Extra specific dependencies
+#
+
+sqNamedPrims.o:	sqNamedPrims.c sqNamedPrims.h
+
+#Squeak.res: misc/Squeak.rc
+#	$(RC) $(RCFLAGS) -i $< -o $(OBJDIR)/$@
+#
+#Croquet.res: misc/Croquet.rc
+#	$(RC) $(RCFLAGS) -i $< -o $(OBJDIR)/$@
+
+#############################################################################
+# Maintainer rules
+#
+
+BINRELEASE=$(SQUEAK).win32-i386
+SRCRELEASE=$(SQUEAK).win32-src
+SUBVERSION=@SUBVERSION@
+
+release: $(BINRELEASE) $(SRCRELEASE)
+
+$(BINRELEASE):
+	zip -9r $(BINRELEASE).zip $(SQUEAK)
+	rm -rf $(RELEASE)
+
+$(SRCRELEASE):
+	mkdir -p $(SQUEAK)/platforms
+	ln -s $(PLATDIR)/Cross $(SQUEAK)/platforms/Cross
+	ln -s $(PLATDIR)/win32 $(SQUEAK)/platforms/win32
+	echo "$(SUBVERSION)" > $(SQUEAK)/platforms/win32/build/src/revision.txt
+	cp $(SQUEAK)/platforms/win32/HowToBuild.txt $(SQUEAK)/.
+	find $(SQUEAK)/platforms -name '*~' -exec rm {} \;
+	zip -9r $(SRCRELEASE).zip $(SQUEAK)/HowToBuild.txt $(SQUEAK)/platforms
+	rm -rf $(SQUEAK)/platforms
+
+dist:
+	rsync -Pva *.zip squeakvm.org:public_html/squeak/win32/release/.

Added: trunk/platforms/win32/build/Makefile.plugin.in
===================================================================
--- trunk/platforms/win32/build/Makefile.plugin.in	                        (rev 0)
+++ trunk/platforms/win32/build/Makefile.plugin.in	2012-09-16 01:25:14 UTC (rev 2606)
@@ -0,0 +1,128 @@
+#############################################################################
+# Generic Makefile for plugins
+#############################################################################
+include $(BASEDIR)/Makefile.common
+
+AR = ar rc
+CP = cp
+RM = rm
+
+# These are the two key locations (set via invocation):
+# BASEDIR: Where is the root of the build tree?
+# PLATDIR: Where is the root of the platforms tree?
+
+#############################################################################
+# Standard directory locations:
+#   CROSSDIR: The location of the cross platform sources
+#   WIN32DIR: The location of the win32 sources
+#   MAKERDIR: The location of the VMMaker generated sources
+#   BUILDDIR: The location where the plugin is built
+#
+CROSSDIR=   $(PLATDIR)/Cross/plugins/$(LIBNAME)
+WIN32DIR=   $(PLATDIR)/Win32/plugins/$(LIBNAME)
+MAKERDIR=   $(SRCDIR)/$(LIBNAME)
+BUILDDIR=   $(BASEDIR)/obj/$(LIBNAME)
+
+# Support directory locations
+CROSSVMDIR= $(PLATDIR)/Cross/vm
+WIN32VMDIR= $(PLATDIR)/Win32/vm
+MAKERVMDIR= $(SRCDIR)/vm
+BUILVMDDIR= $(BASEDIR)/obj/vm
+
+INCLUDES= -I. -I$(DX7DIR)/include \
+	  -I$(MAKERVMDIR) -I$(WIN32VMDIR) -I$(CROSSVMDIR) \
+	  -I$(MAKERDIR) -I$(WIN32DIR) -I$(CROSSDIR)
+
+#############################################################################
+# If no source files were given, use standard set
+#
+
+CROSSSRC= $(wildcard $(CROSSDIR)/*.c)
+WIN32SRC= $(wildcard $(WIN32DIR)/*.c)
+MAKERSRC= $(wildcard $(MAKERDIR)/*.c)
+LIBSRC  = $(notdir $(MAKERSRC) $(WIN32SRC) $(CROSSSRC))
+
+#############################################################################
+# C compiler settings (for egcs-1.1.2)
+#
+CC=	gcc
+OFLAGS= -O2
+CFLAGS=	-g -mwindows -fomit-frame-pointer -funroll-loops \
+	-fschedule-insns2 $(OFLAGS)
+DEFS=	-DWIN32_FILE_SUPPORT -DNO_SERVICE -DNO_STD_FILE_SUPPORT -DNDEBUG \
+	-DLSB_FIRST -DVM_NAME="\"$(VM)\"" -DVM_VERSION="\"$(VERSION)\""  -DX86 $(XDEFS)
+
+#############################################################################
+# DLL settings
+#
+# Note: DLLTOOL/DLLWRAP does the work for everything related to plugins
+#
+DLLTOOL=	dlltool
+DLLWRAP=	dllwrap
+
+.SUFFIXES:	.c .o .s .rc .res .dep
+
+#############################################################################
+# Plugin settings
+#
+OBJDIR=    $(BASEDIR)/obj/$(LIBNAME)
+VMDIR=     $(BASEDIR)/obj/vm
+PLUGINLIB= $(LIBNAME).lib
+PLUGINDLL= $(LIBNAME).dll
+LIBOBJ=    $(LIBSRC:.c=.o)
+
+VPATH= $(MAKERDIR) $(WIN32DIR) $(CROSSDIR) $(OBJDIR)
+
+all:	$(PLUGINLIB) $(PLUGINDLL)
+
+print-settings:
+	@echo ---------------- Makefile settings ------------------
+	@echo VPATH=$(VPATH)
+	@echo INCLUDES=$(INCLUDES)
+	@echo CFLAGS=$(CFLAGS)
+	@echo CROSSDIR=$(CROSSDIR)
+	@echo WIN32DIR=$(WIN32DIR)
+	@echo MAKERDIR=$(MAKERDIR)
+	@echo LIBSRC=$(LIBSRC)
+	@echo LIBOBJ=$(LIBOBJ)
+	@echo -----------------------------------------------------
+
+$(OBJDIR):
+	mkdir -p $(OBJDIR)
+
+$(VMDIR):
+	mkdir -p $(VMDIR)
+
+$(PLUGINLIB): $(VMDIR) $(OBJDIR) $(LIBOBJ)
+	$(AR) $(OBJDIR)/$(PLUGINLIB) $(LIBOBJ)
+
+$(PLUGINDLL): $(VMDIR) $(OBJDIR) $(LIBOBJ)
+	$(DLLTOOL) \
+		--output-def $(OBJDIR)/$(LIBNAME).def \
+		--output-exp $(OBJDIR)/$(LIBNAME).exp \
+		--output-lib $(OBJDIR)/$(LIBNAME).lib \
+		$(addprefix $(OBJDIR)/,$(LIBOBJ))
+	$(DLLWRAP) -mwindows \
+		-def $(OBJDIR)/$(LIBNAME).def \
+		-o   $(OBJDIR)/$(LIBNAME).dll \
+		$(OBJDIR)/$(LIBNAME).exp \
+		$(addprefix $(OBJDIR)/,$(LIBOBJ))\
+		$(EXTRALIBS)
+	strip --strip-all $(OBJDIR)/$(LIBNAME).dll
+	-rm $(OBJDIR)/$(LIBNAME).lib
+
+#############################################################################
+# Rules for automated builds
+#
+
+.c.o:
+		$(CC) -o $(OBJDIR)/$@ $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+
+.c.s:
+		$(CC) -S -o $@ -fverbose-asm -Wa,ah $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+
+.rc.res:
+		$(RC) $(RCFLAGS) -i $< -o $(OBJDIR)/$@
+
+.c.dep:
+		$(CC) -M -o $(OBJDIR)/$(notdir $@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<

Added: trunk/platforms/win32/build/Squeak.ini.in
===================================================================
--- trunk/platforms/win32/build/Squeak.ini.in	                        (rev 0)
+++ trunk/platforms/win32/build/Squeak.ini.in	2012-09-16 01:25:14 UTC (rev 2606)
@@ -0,0 +1,11 @@
+[Global]
+DeferUpdate=1
+ShowConsole=0
+DynamicConsole=1
+ReduceCPUUsage=1
+ReduceCPUInBackground=0
+3ButtonMouse=0
+1ButtonMouse=0
+PriorityBoost=1
+B3DXUsesOpenGL=1
+CaseSensitiveFileMode=0

Added: trunk/platforms/win32/build/configure
===================================================================
--- trunk/platforms/win32/build/configure	                        (rev 0)
+++ trunk/platforms/win32/build/configure	2012-09-16 01:25:14 UTC (rev 2606)
@@ -0,0 +1,126 @@
+#!/bin/sh
+
+# Configure compilation of Win32 Squeak under MinGW+MSYS
+# 
+# Author: Ian Piumarta (first-name at last-name.com)
+# 
+# Last edited: 2012-09-16 10:08:56 by piumarta on W530
+
+usage () {
+    cat <<__EOT
+
+Usage: $0 [<option>...]
+Where '<option>' is one of:
+  help                  print this message
+  MINGW=<mingw-dir>     specify the location of MinGW
+  DX7SDK=<dx7sdk-dir>   specify the location of dx7sdk
+  SRC=<src-dir>         specify the location of the VM generated sources
+
+__EOT
+}
+
+CONFIG=$(dirname "$0")
+WIN32=$(dirname "${CONFIG}")
+PLATDIR=$(dirname "${WIN32}")
+SRC=${WIN32}/build/src
+
+MINGW=""
+DX7SDK=""
+
+for d in /d /c . ..; do
+  [ -d "${d}/MinGW" ]  && MINGW="${d}/MinGW"
+  [ -d "${d}/dx7sdk" ] && DX7SDK="${d}/dx7sdk"
+done
+
+while [ $# -gt 0 ]; do
+    case "$1" in
+	MINGW=*)	MINGW=`expr substr "$1" 7 99` ;;
+	DX7SDK=*)	DX7SDK=`expr substr "$1" 8 99` ;;
+	SRC=*)		SRC=`expr substr "$1" 5 99` ;;
+	*)		usage ; exit 1 ;;
+    esac
+    shift
+done
+
+reconf() {
+    echo "Please reconfigure with the option: $1=<dir>"
+    exit 1
+}
+
+checkdir () {
+    [ "x$2" == "x" ] && {
+        echo "Could not locate $1."
+        reconf $1
+    }
+    [ -d "$2" ] || {
+        echo "The directory '$2' does not exist."
+        reconf $1
+    }
+    [ -f "$2/$3" ] || {
+        echo "Could not find '$3' under '$2'."
+        reconf $1
+    }
+}
+
+checkvar () {
+    [ "x$2" == "x" ] && {
+	echo "Could not find a value for: $1"
+	exit 1
+    }
+}
+
+checkdir MINGW  "${MINGW}"  include/float.h
+checkdir DX7SDK "${DX7SDK}" include/d3d.h
+checkdir SRC    "${SRC}"    vm/interp.h
+
+PLATDIR=`(cd ${PLATDIR}; echo $PWD)`
+SRC=`(cd ${SRC}; echo $PWD)`
+MINGW=`(cd ${MINGW}; echo $PWD)`
+DX7SDK=`(cd ${DX7SDK}; echo $PWD)`
+
+VMMVERSION=`grep VMMAKER_VERSION ${SRC}/vm/interp.h | sed 's/[^"]*"//;s/".*//'`
+
+SUBVERSION=""
+if [ -d ${PLATDIR}/.svn ]; then SUBVERSION=`svn info ${WIN32} | grep Revision: | awk '{print $2}'`; fi
+if [ "x${SUBVERSION}" == "x" ]; then
+    if [ -f ${SRC}/revision.txt ]; then
+	SUBVERSION=`cat ${SRC}/revision.txt`
+    else
+	SUBVERSION=0
+    fi
+fi
+
+checkvar VMMVERSION "$VMMVERSION"
+checkvar SUBVERSION "$SUBVERSION"
+
+VM_VERSION=${VMMVERSION}-${SUBVERSION}
+RC_VERSION=`echo "${VMMVERSION}.${SUBVERSION}" | tr '.' ','`
+
+echo "PLATDIR=    ${PLATDIR}"
+echo "MINGW=      ${MINGW}"
+echo "DX7SDK=     ${DX7SDK}"
+echo "SRC=        ${SRC}"
+echo "VM_VERSION= ${VM_VERSION}"
+echo "RC_VERSION= ${RC_VERSION}"
+echo
+
+echo "Configuring: build directory"
+
+rm -rf mingw-include
+mkdir mingw-include
+ln -s -f ${MINGW}/include/float.h mingw-include/float.h
+
+for src in ${WIN32}/build/Makefile*.in; do
+    out=`basename "${src}" .in`
+    echo "Configuring: ${out}"
+    sed "
+s|@PLATDIR@|${PLATDIR}|g;
+s|@SRCDIR@|${SRC}|g;
+s|@MINGWDIR@|${MINGW}|g;
+s|@DX7DIR@|${DX7SDK}|g;
+s|@VMMVERSION@|${VMMVERSION}|g;
+s|@SUBVERSION@|${SUBVERSION}|g;
+s|@VM_VERSION@|${VM_VERSION}|g;
+s|@RC_VERSION@|${RC_VERSION}|g;
+" < "${src}" > "${out}"
+done



More information about the Vm-dev mailing list