Skip to content

Create a new FEMhub spkg package

aayush edited this page Feb 5, 2011 · 14 revisions

1- First create a directory like this do

$ mkdir mypackage-version # first the name of your package and then version

Then inside that directory put the script spkg-install, and also create a directory src/. Then put all your source codes within that src directory. Please see a sample of spkg-install script below.

2- Then you can create the package by typing

$ tar cjf mypackage-version.spkg mypackage-version

After you create mypackage-version.spkg you can install it in FEMhub easily. To do so go to FEMhub top directory and type

A sample spkg-install script

if [ ":math:`SPKG_LOCAL" = "" ]; then
   echo "SPKG_LOCAL undefined ... exiting";
   echo "Maybe run 'femhub --shell'?"
   exit 1
fi

PACKAGE_NAME=hermes

PY_VER=`python -c "import sys;print '%d.%d' % sys.version_info[:2]"`
echo "Detected Python version: `PY_VER"

cmake -DCMAKE_INSTALL_PREFIX=":math:`SPKG_LOCAL" \
    -DPYTHON_INCLUDE_PATH="`SPKG_LOCAL/include/python:math:`PY_VER" \
    -DPYTHON_LIBRARY="`SPKG_LOCAL/lib/python2.6/config/libpython2.6.dll.a" \
    .
if [ :math:`? -ne 0 ]; then
    echo "Error configuring `PACKAGE_NAME."
    exit 1
fi

make
if [ :math:`? -ne 0 ]; then
   echo "Error building `PACKAGE_NAME."
   exit 1
fi

make install
if [ :math:`? -ne 0 ]; then
    echo "Error installing `PACKAGE_NAME."
    exit 1
fi

In the spkg-install script above you can see a variable SPKG_LOCAL which points to path/to/femhub/local.

Installing SPKG Package

You can install any spkg package in femhub directly by typing

$ ./femhub -i path/to/spkg-package

To install the package forcefully do

$ ./femhub -f -i path/to/spkg-package

You can install the package directly from the internet too. For example, to install FiPy package you can type

$ ./femhub -i http://femhub.org/stpack/fipy-2.1-51f1360.spkg

Then you can test whether your package worked correctly in FEMhub. You can test your patches without creating spkg tar by following the instructions below.

Clone this wiki locally