File size: 2,860 Bytes
7e59e4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
# Copyright (C) 2015 by Pedro Mendes, Virginia Tech Intellectual 
# Properties, Inc., University of Heidelberg, and The University 
# of Manchester. 
# All rights reserved. 

#
# This script expects up to three arguments: 
#
# 1: the version to create (defaults to 4.14.92)
# 2: the source dir (defaults to ../COPASI)
# 3: the binary dir (defaults to ../package)
# 4: the dependency dir (defaults to /mnt/hgfs/share
#
DIRECTORY=$(cd `dirname $0` && pwd)

DEP_DIR=$4
if [ "_$DEP_DIR" = "_" ]; then
DEP_DIR=/mnt/hgfs/share
fi

OS=LINUX
DEP_SUFFIX=-32
VERSION=$1

if [ "_$VERSION" = "_" ]; then
VERSION=4.15.93
fi

ARCH=`uname -m`
if [ $ARCH = "x86_64" ]; then
DEP_SUFFIX=-64
fi

if [ -d "/Applications/" ]; then
OS=DARWIN
DEP_SUFFIX=
fi

DEP_DIR_NAME=dependencies$DEP_SUFFIX

SRC_DIR=$2
if [ "_$SRC_DIR" = "_" ]; then
SRC_DIR=$DIRECTORY/../COPASI
fi

BIN_DIR=$3
if [ "_$BIN_DIR" = "_" ]; then
BIN_DIR=$DIRECTORY/../package
fi

if [ ! -d $BIN_DIR/copasi ]; then

  echo invalid bin dir
  exit 1;

fi

if [ ! -d $BIN_DIR/copasi/bindings/python ]; then

  echo copasi has not been configured with python. 
  exit 1;

fi

if [ ! -f $BIN_DIR/copasi/bindings/python/copasi_wrapper.cpp ]; then

  echo swig bindings have not been created. Please build copasi with python bindings.  
  exit 1;

fi


PKG_DIR=$DIRECTORY/python-copasi-$VERSION
if [ -d "$PKG_DIR" ]; then

  echo Already have a dir for $VERSION;
  exit 1;

fi;

mkdir $PKG_DIR
mkdir $PKG_DIR/cpp-api
mkdir $PKG_DIR/common
mkdir $PKG_DIR/COPASI
mkdir $PKG_DIR/script
mkdir $PKG_DIR/src
mkdir $PKG_DIR/LINUX
mkdir $PKG_DIR/LINUX/dependencies-32
mkdir $PKG_DIR/LINUX/dependencies-64
mkdir $PKG_DIR/DARWIN

# create the files
sed 's/@VERSION@/$VERSION/g' $DIRECTORY/PKG-INFO    > $PKG_DIR/PKG-INFO
sed 's/@VERSION@/$VERSION/g' $DIRECTORY/setup.py.in > $PKG_DIR/setup.py

# copy cpp headers
(cd $SRC_DIR && find -name '*.h' -print | tar --create --files-from -) | (cd $PKG_DIR/cpp-api && tar xfp -)


# copy SWIG files
cp $SRC_DIR/copasi/bindings/common/*.cpp $PKG_DIR/common
cp $SRC_DIR/copasi/bindings/python/*.cpp $PKG_DIR/src
cp $BIN_DIR/copasi/bindings/python/*.cpp $PKG_DIR/src
cp $BIN_DIR/copasi/bindings/python/*.py  $PKG_DIR/script

# copy dependencies
pushd $PKG_DIR/LINUX/dependencies-32
tar zxf $DEP_DIR/LINUX/dependencies-32.tar.gz
cd $PKG_DIR/$OS/dependencies-32/lib
tar zxf $DEP_DIR/LINUX/se-32.tar.gz

popd
pushd $PKG_DIR/LINUX/dependencies-64
tar zxf $DEP_DIR/LINUX/dependencies-64.tar.gz
cd $PKG_DIR/$OS/dependencies-64/lib
tar zxf $DEP_DIR/LINUX/se-64.tar.gz
popd


# copy se libraries
cp $BIN_DIR/copasi/libCOPASISE.a $PKG_DIR/$OS/dependencies$DEP_SUFFIX/lib

cd $DIRECTORY
if [ -d $PKG_DIR/build ]; then
rm -rf $PKG_DIR/build
fi

tar -cf python-copasi-$VERSION.tar python-copasi-$VERSION
gzip python-copasi-$VERSION.tar



# test build
pushd $PKG_DIR
python setup.py build
popd