Skip to content

Commit

Permalink
Merge branch 'Cog' of github.com:OpenSmalltalk/opensmalltalk-vm into …
Browse files Browse the repository at this point in the history
…merge-with-pharo
  • Loading branch information
estebanlm committed Nov 28, 2016
2 parents 69dccb5 + 662dc14 commit 29d76fb
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 52 deletions.
79 changes: 47 additions & 32 deletions .travis_build.sh
Expand Up @@ -6,7 +6,7 @@ source ./.travis_helpers.sh
if [[ "${APPVEYOR}" ]]; then
TRAVIS_BUILD_DIR="$(pwd)"
TRAVIS_TAG="${APPVEYOR_REPO_TAG}"
PLATFORM="Windows"
PLATFORM="windows"

# Appveyor's GCC is pretty new, patch the Makefiles and replace the tools to
# make it work
Expand All @@ -17,9 +17,8 @@ if [[ "${APPVEYOR}" ]]; then
echo
test -d /usr/i686-w64-mingw32/sys-root/mingw/lib || echo "No lib dir"
test -d /usr/i686-w64-mingw32/sys-root/mingw/include || echo "No inc dir"

else
PLATFORM="$(uname -s)"
PLATFORM="${TRAVIS_OS_NAME}"
fi

[[ -z "${ARCH}" ]] && exit 2
Expand All @@ -39,7 +38,7 @@ echo "`cat platforms/Cross/plugins/sqPluginsSCCSVersion.h | .git_filters/RevDate

REV=$(grep -m1 "SvnRawRevisionString" platforms/Cross/vm/sqSCCSVersion.h | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')

echo $PATH
# echo $PATH

output_file="${TRAVIS_BUILD_DIR}/cog_${ARCH}_${FLAVOR}_${REV}"

Expand All @@ -48,28 +47,44 @@ export COGVDATE="$(git show -s --format=%cd HEAD)"
export COGVURL="$(git config --get remote.origin.url)"
export COGVOPTS="-DCOGVREV=\"${COGVREV}\" -DCOGVDATE=\"${COGVDATE// /_}\" -DCOGVURL=\"${COGVURL//\//\\\/}\""

case "$PLATFORM" in
"Linux")
build_directory="./build.${ARCH}/${FLAVOR}/build"
if [[ "${HEARTBEAT}" == "itimer" ]]; then
build_directory="${build_directory}.itimerheartbeat"
fi
build_linux_in() {
local build_dir=$1
local fold_name=$2

pushd "${build_dir}"
travis_fold start "${fold_name}" "Building OpenSmalltalk VM in ${build_dir}..."
echo n | bash -e ./mvm
travis_fold end "${fold_name}"
# cat config.log
popd
}

tar_linux_product() {
local file_path=$1
pushd "./products"
tar czf "${file_path}.tar.gz" "./"
popd
}

build_linux() {
build_directory="./build.${ARCH}/${FLAVOR}/build"
[[ ! -d "${build_directory}" ]] && exit 10

pushd "${build_directory}"
build_linux_in "${build_directory}" "build_vm"
tar_linux_product "${output_file}"

travis_fold start build_vm "Building OpenSmalltalk VM..."
echo n | bash -e ./mvm
travis_fold end build_vm
# Also build VM with itimerheartbeat if available
if [[ ! -d "${build_directory}.itimerheartbeat" ]]; then
return
fi

# cat config.log
popd
rm -rf "./products" # Clear products directory

output_file="${output_file}.tar.gz"
tar czf "${output_file}" "./products"
;;
"Darwin")
build_linux_in "${build_directory}.itimerheartbeat" "build_itimer_vm"
tar_linux_product "${output_file}_itimer"
}

build_osx() {
build_directory="./build.${ARCH}/${FLAVOR}"

[[ ! -d "${build_directory}" ]] && exit 50
Expand All @@ -80,26 +95,26 @@ case "$PLATFORM" in
bash -e ./mvm -f
travis_fold end build_vm

output_file="${output_file}.tar.gz"
echo "Archiving files into $output_file"
tar cvzf "${output_file}" ./*.app
tar cvzf "${output_file}.tar.gz" ./*.app
popd
;;
"Windows")
}

build_windows() {
build_directory="./build.${ARCH}/${FLAVOR}/"
output_zip="${output_file}.zip"

[[ ! -d "${build_directory}" ]] && exit 100

pushd "${build_directory}"
# remove bochs plugins
sed -i 's/Bochs.* //g' plugins.ext
bash -e ./mvm -f || exit 1
zip -r "${output_zip}" "./builddbg/vm/" "./buildast/vm/" "./build/vm/"
zip -r "${output_file}.zip" "./builddbg/vm/" "./buildast/vm/" "./build/vm/"
popd
;;
*)
echo "Unsupported platform '${os_name}'." 1>&2
}

if [[ ! $(type -t build_$PLATFORM) ]]; then
echo "Unsupported platform '$(uname -s)'." 1>&2
exit 99
;;
esac
fi

build_$PLATFORM
18 changes: 11 additions & 7 deletions build.win64x64/common/Makefile
Expand Up @@ -11,6 +11,9 @@
# CONFIGURATION configuration of VM to build from product, assert & debug
# THREADING whether to build a multi-threaded FFI VM

.PHONY: all
all: default

VM?=Squeak
VM_NAME?=$(VM)
CONFIGURATION=product
Expand Down Expand Up @@ -47,6 +50,7 @@ OBJDIR:= $(BUILD)/vm
PLATDIR:=../../platforms
CROSSDIR:=$(PLATDIR)/Cross/vm
WIN32DIR:=$(PLATDIR)/win32/vm
WIN32PLUGINSDIR:=$(PLATDIR)/win32/plugins
WIN32MISCDIR:=$(PLATDIR)/win32/misc
WIN32UTILDIR:=$(PLATDIR)/win32/util

Expand Down Expand Up @@ -250,24 +254,24 @@ $(VMDEF) $(VMEXP) $(VMLIB): $(VMOBJ)
.PHONY: $(OBJDIR)/%.lib $(OBJDIR)/%.dll

# Check for Makefile in win32 plugins directory otherwise use default Makefile
plugin-makefile = $(firstword $(realpath \
$(PLATDIR)/win32/plugins/$(*F)/Makefile.plugin \
../common/Makefile.plugin))
plugin-makefile = $(realpath $(firstword $(wildcard $(WIN32PLUGINSDIR)/$(1)/Makefile.plugin ../common/Makefile.plugin)))

# Internal plugin. Build as lib then link in lib
$(OBJDIR)/%.lib: $(call plugin-makefile,$(*F))
@-mkdir $(BUILD)/$(*F)
$(MAKE) $(MFLAGS) CONFIGURATION=$(CONFIGURATION) BUILD=$(BUILD) \
@-mkdir -p $(BUILD)/$(*F)
$(MAKE) $(MFLAGS) BUILD=$(BUILD) \
-f $(call plugin-makefile,$(*F)) \
CONFIGURATION=$(CONFIGURATION) TOOLPREFIX=$(TOOLPREFIX) \
PLATDIR=$(PLATDIR) PLUGINSRCDIR=$(PLUGINSRCDIR) VMSRCDIR=$(VMSRCDIR) \
LIBNAME=$(*F) COGDEFS="$(COGDEFS)" XDEFS=-DSQUEAK_BUILTIN_PLUGIN \
$(OBJDIR)/$(*F).lib

# External plugin. Build as dll and copy to vm dir ($(OBJDIR)).
$(OBJDIR)/%.dll: $(call plugin-makefile,$(*F))
@-mkdir $(BUILD)/$(*F)
$(MAKE) $(MFLAGS) CONFIGURATION=$(CONFIGURATION) BUILD=$(BUILD) \
@-mkdir -p $(BUILD)/$(*F)
$(MAKE) $(MFLAGS) BUILD=$(BUILD) \
-f $(call plugin-makefile,$(*F)) \
CONFIGURATION=$(CONFIGURATION) TOOLPREFIX=$(TOOLPREFIX) \
PLATDIR=$(PLATDIR) PLUGINSRCDIR=$(PLUGINSRCDIR) VMSRCDIR=$(VMSRCDIR) \
COGDEFS="$(COGDEFS)" LIBNAME=$(*F) $(OBJDIR)/$(*F).dll

Expand Down
4 changes: 3 additions & 1 deletion platforms/Cross/plugins/SqueakFFIPrims/sqFFI.h
Expand Up @@ -14,6 +14,8 @@
#ifndef SQ_FFI_H
#define SQ_FFI_H

#include "sqMemoryAccess.h"

/* What follows is the old FFI API when spread across several marshalling files.
* With the ThreadedFFIPlugin all marshalling is in a single generated plugin
* and so the following API is not wanted.
Expand Down Expand Up @@ -81,7 +83,7 @@ int ffiCleanup(void);

/* Allocate/free external memory */
int ffiAlloc(int byteSize);
int ffiFree(int ptr);
int ffiFree(sqIntptr_t ptr);

/* general <=32bit integer loads */
int ffiPushSignedByte(int value);
Expand Down
Expand Up @@ -147,7 +147,7 @@ int ffiAlloc(int byteSize)
}


int ffiFree(int ptr)
int ffiFree(sqIntptr_t ptr)
{
DPRINTF(("ffiFree(%08x)\n", ptr));
if (ptr) free((void *)ptr);
Expand Down
2 changes: 1 addition & 1 deletion platforms/Mac OS/plugins/SqueakFFIPrims/sqMacFFIPPC.c
Expand Up @@ -145,7 +145,7 @@ int ffiAlloc(int byteSize)
return data;
}

int ffiFree(int ptr)
int ffiFree(sqIntptr_t ptr)
{
DPRINTF(("ffiFree (%08x)\n",ptr));
if(ptr) free((void*)ptr);
Expand Down
2 changes: 1 addition & 1 deletion platforms/Mac OS/plugins/SqueakFFIPrims/sqMacIntel-Win32.c
Expand Up @@ -110,7 +110,7 @@ int ffiAlloc(int byteSize)
return (int) malloc(byteSize);
}

int ffiFree(int ptr)
int ffiFree(sqIntptr_t ptr)
{
if(ptr) free((void*)ptr);
return 1;
Expand Down
Expand Up @@ -135,7 +135,7 @@ int ffiAlloc(int byteSize)
}


int ffiFree(int ptr)
int ffiFree(sqIntptr_t ptr)
{
if (ptr) free((void *)ptr);
return 1;
Expand Down
2 changes: 1 addition & 1 deletion platforms/iOS/plugins/SqueakFFIPrims/dummyFFI.c
Expand Up @@ -157,7 +157,7 @@ int ffiAlloc(int byteSize)

/* ffiFree:
Free space from the external heap */
int ffiFree(long pointer)
int ffiFree(sqIntptr_t pointer)
{
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion platforms/iOS/vm/iPhone/plugins/SqueakFFIPrims/dummyFFI.c
Expand Up @@ -157,7 +157,7 @@ int ffiAlloc(int byteSize)
}


int ffiFree(long ptr)
int ffiFree(sqIntptr_t ptr)
{
if (ptr) free((void *)ptr);
return 1;
Expand Down
2 changes: 1 addition & 1 deletion platforms/unix/plugins/LocalePlugin/sqUnixLocale.c
Expand Up @@ -613,7 +613,7 @@ sqInt sqLocCurrencyNotation(void)
* does precisely this.
*/
#define safestrcpy(str,source) do { \
char *src = (source); \
const char *src = (source); \
int len = strlen(src); \
strncpy(str,src,len); \
} while (0)
Expand Down
2 changes: 1 addition & 1 deletion platforms/unix/plugins/SqueakFFIPrims/any-libffi.c
Expand Up @@ -126,7 +126,7 @@ int ffiAlloc(int byteSize)
}
/* ffiFree:
Free space from the external heap */
int ffiFree(int pointer)
int ffiFree(sqIntptr_t pointer)
{
if(pointer) free((void*)pointer);
return 1;
Expand Down
2 changes: 1 addition & 1 deletion platforms/unix/plugins/SqueakFFIPrims/ppc-darwin.c
Expand Up @@ -137,7 +137,7 @@ int ffiAlloc(int byteSize)
}


int ffiFree(int ptr)
int ffiFree(sqIntptr_t ptr)
{
DPRINTF(("ffiFree(%08x)\n", ptr));
if (ptr) free((void *)ptr);
Expand Down
2 changes: 1 addition & 1 deletion platforms/unix/plugins/SqueakFFIPrims/ppc-sysv.c
Expand Up @@ -135,7 +135,7 @@ int ffiAlloc(int byteSize)
}


int ffiFree(int ptr)
int ffiFree(sqIntptr_t ptr)
{
if (ptr) free((void *)ptr);
return 1;
Expand Down
2 changes: 1 addition & 1 deletion platforms/unix/plugins/SqueakFFIPrims/x86-sysv.c
Expand Up @@ -129,7 +129,7 @@ int ffiAlloc(int byteSize)
}


int ffiFree(int ptr)
int ffiFree(sqIntptr_t ptr)
{
if (ptr) free((void *)ptr);
return 1;
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/plugins/SqueakFFIPrims/sqWin32FFI.c
Expand Up @@ -69,7 +69,7 @@ int ffiAlloc(int byteSize)
return (int) malloc(byteSize);
}

int ffiFree(int ptr)
int ffiFree(sqIntptr_t ptr)
{
if(ptr) free((void*)ptr);
return 1;
Expand Down

0 comments on commit 29d76fb

Please sign in to comment.