package.sh 1.62 KB
Newer Older
1
2
3
4
5
6
7
#!/bin/bash

# Packaging script for Linux distribution, for use in automated packaging.
# Note that this must be run from outside the checked-out openmm/ directory.

# CONFIGURE HERE
export PACKAGE_DIR="packaging" # directory to stuff packaged source distribution
8
export VERSION=$(sed -nr "s/OPENMM_VERSION:STRING=(.*)/\1/p" build/CMakeCache.txt)
9
10
11
export PACKAGE_SUBDIR="OpenMM-${VERSION}-Linux" # directory where distribution will be unpacked
export DISTRO_PREFIX="OpenMM-${VERSION}-Linux" # prefix for source distribution (e.g. ${DISTRIBUTION_NAME}.zip)

12
13
14
15
16
17
# DEBUG
echo "DEBUG 1"
pwd
ls -ltr .
# END DEBUG

18
19
20
# Perform all work in a work directory.
cd work

21
22
23
24
25
26
# DEBUG
echo "DEBUG 1"
pwd
ls -ltr .
# END DEBUG

27
28
29
30
# Clean up.
rm -rf $PACKAGE_DIR

# Make a directory to contain packaged source distribution
31
echo "DEBUG 3"
32
33
34
mkdir $PACKAGE_DIR
mkdir $PACKAGE_DIR/$PACKAGE_SUBDIR
for filename in $( cat openmm/devtools/packaging/manifests/binary/manifest.txt ); do
35
36
37
   # DEBUG: List contents of each directory.
   ls -ltr install/$filename
   # END DEBUG
38
39
40
41
42
43
44
45
46
47
48
49
   CMD="cp -r install/$filename $PACKAGE_DIR/$PACKAGE_SUBDIR"
   echo $CMD
   `$CMD`
done

# Add the install.sh script
CMD="cp -r openmm/install.sh $PACKAGE_DIR/$PACKAGE_SUBDIR"
echo $CMD
`$CMD`

# Make Python source distribution.
echo "Building Python source distribution..."
50
pushd .
51
52
53
54
55
cd build
make PythonSdist
cd python/dist
tar zxf OpenMM-${VERSION}.tar.gz
mv OpenMM-${VERSION} python
56
popd
57
58
59
60
61
62
63
64
cp -r build/python/dist/python $PACKAGE_DIR/$PACKAGE_SUBDIR

# Create archives.
cd $PACKAGE_DIR
mkdir compressed
tar zcf compressed/${DISTRO_PREFIX}.tgz $PACKAGE_SUBDIR
zip -r compressed/${DISTRO_PREFIX}.zip $PACKAGE_SUBDIR
cd ..