Hello,

spent another day building VM, i found that our setup is still far
from being simple..
the jenkins jobs right now using a page-long scripts to configure &
build vm, and grown with many bells and whistless..

one of my goals when i created a configurations was to avoid that..
and keep these things 1-liners..
one of the reasons for doing that is that you can reproduce the whole
build on local machine from command line
by typing a simple commands like make , as well as simple doits in
VMMaker image.

So, here some of my suggestions:
 - create a single PharoVMBuilder class, which will encompass all the
details of platform-specificness,
and will pick the right configuration & default plugins based on our
preference and target platform.
By issuing:

PharoVMBuilder generate.

- it should generate sources
- it should generate cmake files, based on environment variable set
(btw, can we access an environment variables in our VMs now?)
if not, then based on platform that image runs now , which is not good
for cross-platform builds, but since now we don't have cross-builds,
it will work fine.
The approach , again is the same: lets encapsulate the information we
need in edible form, not like this one:

#!bash -lex
#
# build-vm.sh -- Builds Cog Virtual Machine. Have to be used together
with Jenkins.
#
# Copyright (c) 2012 Christophe Demarey
#


export PHARO_VM=`$WORKSPACE/pharo-shell-scripts/fetchLatestVM.sh`
if [ -z "$PHARO_VM" ] ; then
   echo "PHARO_VM environment variable is not set."
   exit 1
fi

# Set environment ============================================================
PROCESS_PLUGIN="UnixOSProcessPlugin"
EXTERNAL_PLUGINS="FT2Plugin"
ZIP_FILTER='*'

if [ "$OS" == "win" ]; then
    set -e # Stop the execution if a command fails!
    CONFIGNAME="CogWindowsConfig"
    PROCESS_PLUGIN="Win32OSProcessPlugin"
    ZIP_FILTER=' *.exe *.dll'
elif [ "$OS" == "mac" ]; then
    CONFIGNAME="CogCocoaIOSConfig"
    export MACOSX_DEPLOYMENT_TARGET=10.5
    export CC=/usr/bin/gcc-4.2
    export CXX=/usr/bin/g++-4.2
else # [ "$OS" == "linux" ]; then
    CONFIGNAME="CogUnixConfig"
    export EXTERNAL_PLUGINS="SqueakSSLPlugin $EXTERNAL_PLUGINS"
fi

# Unpack sources =============================================================
cd "$WORKSPACE"

rm -rf cog
tar -xzf cog.tar.gz || echo # echo needed for Windows build (error on
symlinks creation)

mkdir -p cog/build
mkdir -p cog/image

cd cog/image
unzip -o ../../vmmaker-image.zip


# Generate sources ===========================================================
echo "$CONFIGNAME new
  addExternalPlugins: #( $EXTERNAL_PLUGINS );
  addInternalPlugins: #( $PROCESS_PLUGIN );
  generateSources; generate.

Smalltalk snapshot: false andQuit: true." > ./script.st
"$PHARO_VM" -headless generator.image script.st -headless

cd ../../
tar -czf ${CONFIGNAME}-sources.tar.gz -C cog .


# Compile ====================================================================
cd cog/build
if [ "$OS" == "win" ]; then
  cmake -G "MSYS Makefiles" .
else
  cmake .
fi
make
if [ "$OS" == "mac" ]; then
    make install
fi
cd ..

# Install SSL Plugin =========================================================
SSL_PLUGIN_URL='http://squeakssl.googlecode.com/files/SqueakSSL-bin-0.1.5.zip'
SSL_PLUGIN_ZIP='SqueakSSL-bin-0.1.5.zip'
SSL_PLUGIN_OUT='SqueakSSL-bin'
test -e 'SqueakSSL-bin-0.1.5.zip' || \
    ($WORKSPACE/download.sh $SSL_PLUGIN_ZIP $SSL_PLUGIN_URL && unzip
-o $SSL_PLUGIN_ZIP)
if [ "$OS" == "win" ]; then
    cp $SSL_PLUGIN_OUT/win/* results/
#elif [ "$OS" == "linux" ]; then
#    cp $SSL_PLUGIN_OUT/unix/so.SqueakSSL results/libSqueakSSL.so
fi
rm -rf $SSL_PLUGIN_OUT

# Archive ====================================================================
cd results
COG_ZIP_FILE="Cog-${OS}.zip"

zip -r $COG_ZIP_FILE $ZIP_FILTER
mv -f $COG_ZIP_FILE ../../

#if [ "$OS" == "mac" ]; then
#    zip -r ../build/CogVM.zip CogVM.app
#    mv -f ../build/CogVM.zip ../../
#else
#    zip -r Cog.zip $ZIP_FILTER
#    mv Cog.zip ../../
#fi

# success
exit 0


Another thing, which i discussed locally , i thinking about creating a
dedicated blog for VM developers, where we can share the news and
describe
details about changes and stuff..
In a way, that it will serve as a source of information about VM ,
jenkins , configurations, settings , building etc etc..
Because all of the bits of knowledge , which we collected till now is
kind of floating in the air, and like any energy it tends to dissipate
(things we remember and forget, the more things we should keep in
head, the faster it happens).
Also, blog is preferable to just simple CHANGELOG file (or similar),
because it is two-way communication , and people can comment and
discuss things.

-- 
Best regards,
Igor Stasenko.

Reply via email to