callirhoe/make_pkg

45 lines
1009 B
Plaintext
Raw Normal View History

#!/bin/bash
set -e
make_archive() {
base="$1"
tempdir="$2"
curdir=`pwd`
cd $tempdir
zip -q -r $curdir/$base.zip *
cd $curdir
rm -rf $tempdir
echo '#!/usr/bin/env python2.7' | cat - $base.zip > $base
chmod 755 $base
rm -f $base.zip
}
# Create Callirhoe package
DIR=`mktemp -d -t callirhoe`
# TODO: do we need .pyc files? (my guess is yes, how do we force creation?)
cp -R geom lang layouts lib style "$DIR"
cp callirhoe.py "$DIR/__main__.py"
./make_resources_list > "$DIR/lib/resources.py"
make_archive callirhoe "$DIR"
# Create Calmagick package
DIR=`mktemp -d -t callirhoe`
mkdir "$DIR/lib"
cp lib/__init__.py lib/geom.py "$DIR/lib"
cp calmagick.py "$DIR/__main__.py"
make_archive calmagick "$DIR"
# Create Makefile
cat << END > Makefile
prefix=/usr
install:
install -Dm755 callirhoe \$(DESTDIR)/bin/callirhoe
install -Dm755 calmagick \$(DESTDIR)/bin/calmagick
END
find holidays/* -printf "\tinstall -Dm644 %p \$(DESTDIR)/share/callirhoe/%p\n" >> Makefile