Skip to content

Commit

Permalink
Merge pull request #15 from MarwanG/packaging
Browse files Browse the repository at this point in the history
Packaging
  • Loading branch information
fredokun committed Jul 13, 2013
2 parents f066d7f + 1cc6cf5 commit c73ea04
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 77 deletions.
56 changes: 39 additions & 17 deletions Makefile.in
@@ -1,28 +1,50 @@
# where to install
PREFIX = @prefix@
BINDIR = $(PREFIX)/bin
# where to install the binaries
prefix=/usr/local
exec_prefix=${prefix}
BINDIR=${exec_prefix}/bin

SRCS = $(wildcard src/*.ml src/*.mli src/*.mll src/*.mly)
TARGS = arbogen
KIND = native # d.byte
FLAGS = -w,Ae,-warn-error,A
# where to install the man page
MANDIR=${prefix}/share/man

all: $(TARGS)
# other variables set by ./configure
OCAMLC = ocamlc
OCAMLOPT = ocamlopt
OCAMLDEP = ocamldep
OCAMLLEX = ocamllex
OCAMLYACC= ocamlyacc
OCAMLLIB = /usr/lib/ocaml
OCAMLBEST= op

OCAMLFLAG= -I src/

SRCS = src/Options.ml src/Util.ml src/Grammar.ml src/CombSys.ml src/OracleSimple.ml src/Tree.ml src/Gen.ml src/GParser.ml src/ArboLib.ml src/Arbogen.ml


all: arbogen

arbogen: $(SRCS)
mkdir bin
$(OCAMLOPT) $(OCAMLFLAG) -o bin/arbogen $(SRCS)

arbogen.byte: $(SRCS)
mkdir bin
$(OCAMLC) $(OCAMLFLAG) -o bin/arbogen.byte $(SRCS)

arbogen: _build/src/Arbogen.$(KIND)
cp $< $@

install:: arbogen
mkdir -p $(BINDIR)
mv arbogen $(BINDIR)
mv bin/arbogen $(BINDIR)
mkdir -p $(MANDIR)/man1
cp -f doc/$(TARGS).1 /usr/local/man/man1/$(TARGS).1

_build/src/%.$(KIND): $(SRCS)
ocamlbuild -cflags $(FLAGS) -no-links -I src $*.$(KIND)

clean:
@ocamlbuild -clean
@rm -f *~ $(TARGS)
rm -f src/*~
rm -f src/*.cmi
rm -f src/*.cmx
rm -f src/*.cmo
rm -f src/*.o

.PHONY: all clean
cleanall: clean
rm -f bin/arbogen
rm -f bin/arbogen.byte
rm -rf bin
13 changes: 13 additions & 0 deletions cleanup.sh
@@ -0,0 +1,13 @@
#!/bin/sh
#cleanup.sh

if [ -f Makefile ]; then
make cleanall
fi
rm -rf Makefile
rm -rf configure
rm -rf config.status
rm -rf autom4te.cache
rm -rf config.log
rm -rf arbogen_`cat VERSION`_1
rm -rf *~
31 changes: 31 additions & 0 deletions compile.sh
@@ -0,0 +1,31 @@
#!/bin/sh
#config.sh
#if output of makefile needs to be a byte pass as parameter arbogen.byte

if [ -f configure ]; then
echo "checking for configure file... ok"
else
echo "checking for configure file... no"
if which autoconf >/dev/null; then
echo "checking for autoconf... ok"
autoconf
echo "creating configure file... ok"
else
echo "checking for autoconf... no"
exit 1;
fi
fi

echo "executing configure script"
./configure

if [ -f Makefile ]; then
echo "checking for Makefile... ok"
make $1
else
echo "checking for Makefile... no"
echo "error... Aborting"
exit 1;
fi


22 changes: 16 additions & 6 deletions debianBin.sh → debianBin_amd64.sh
Expand Up @@ -2,12 +2,14 @@
#debianBin.sh
#creates a binary debian package from source files

file=arbogen_`cat VERSION`_1

if [ ! -f arbogen ]; then
echo "checking for binary file... no"
#testing if in correct folder
if [ ! -f configure.in ]; then
echo "checking if in correct folder... no"
exit 1;
else
echo "checking for binary file... ok"
echo "checking if in correct folder... ok"
fi

if which dpkg >/dev/null; then
Expand All @@ -23,8 +25,9 @@ else
echo "checking for fakeroot... no"
exit 1;
fi

#creating of directories
file=arbogen_$1_1

mkdir $file
mkdir -p $file/DEBIAN
mkdir -p $file/usr/bin
Expand All @@ -36,7 +39,7 @@ mkdir -p $file/usr/share/man/man1
#creation of text files
cat <<EOF > $file/DEBIAN/control
Package: arbogen
Version: $1
Version: `cat VERSION`
Section: ocaml
Priority: optional
Source: arbogen
Expand All @@ -49,10 +52,17 @@ EOF
cp doc/arbogen.1 $file/usr/share/man/man1/arbogen.1
gzip --best $file/usr/share/man/man1/arbogen.1
cp LICENSE.txt $file/usr/share/doc/arbogen/copyright
cp arbogen $file/usr/bin/

#compiling to create a executable.
./compile.sh
cp bin/arbogen $file/usr/bin/


chmod -R 755 $file
chmod a-x $file/usr/share/man/man1/arbogen.1.gz
chmod a-x $file/usr/share/doc/arbogen/copyright
#packaging
fakeroot dpkg-deb --build $file

#cleaning up
./cleanup.sh
22 changes: 15 additions & 7 deletions debianBin_i386.sh
Expand Up @@ -2,12 +2,12 @@
#debianBin.sh
#creates a binary debian package from source files


if [ ! -f arbogen ]; then
echo "checking for binary file... no"
#testing if in correct folder
if [ ! -f configure.in ]; then
echo "checking if in correct folder... no"
exit 1;
else
echo "checking for binary file... ok"
echo "checking if in correct folder... ok"
fi

if which dpkg >/dev/null; then
Expand All @@ -24,7 +24,8 @@ else
exit 1;
fi
#creating of directories
file=arbogen_$1_1
file=arbogen_`cat VERSION`_1

mkdir $file
mkdir -p $file/DEBIAN
mkdir -p $file/usr/bin
Expand All @@ -36,7 +37,7 @@ mkdir -p $file/usr/share/man/man1
#creation of text files
cat <<EOF > $file/DEBIAN/control
Package: arbogen
Version: $1
Version: `cat VERSION`
Section: ocaml
Priority: optional
Source: arbogen
Expand All @@ -45,14 +46,21 @@ Maintainer: Frédéric Peschanski <Frederic.Peschanski@lip6.fr>
Description: Generates trees
Trees are generated randomly in different formats depending on grammar.
EOF

#placing files in correct place
cp doc/arbogen.1 $file/usr/share/man/man1/arbogen.1
gzip --best $file/usr/share/man/man1/arbogen.1
cp LICENSE.txt $file/usr/share/doc/arbogen/copyright
cp arbogen $file/usr/bin/

#compiling
./compile.sh
cp bin/arbogen $file/usr/bin/

chmod -R 755 $file
chmod a-x $file/usr/share/man/man1/arbogen.1.gz
chmod a-x $file/usr/share/doc/arbogen/copyright
#packaging
fakeroot dpkg-deb --build $file

#clean up
./cleanup.sh
2 changes: 1 addition & 1 deletion opampackaging.sh
Expand Up @@ -3,7 +3,7 @@
#creates an opam package
#the verision is passed as a parameter

file=arbogen.$1
file=arbogen.`cat VERSION`
mkdir $file

cat <<EOF > $file/descr
Expand Down
1 change: 0 additions & 1 deletion packaging.sh
@@ -1,7 +1,6 @@
#!/bin/sh
#packaging.sh
#creates an install package for using the files in its directory
#the verision is passed as a parameter

pack=arbogen_`cat VERSION`

Expand Down
45 changes: 0 additions & 45 deletions src/Makefile

This file was deleted.

0 comments on commit c73ea04

Please sign in to comment.