Skip to content

Commit

Permalink
First cut at Debian build materials.
Browse files Browse the repository at this point in the history
  • Loading branch information
Schuyler Erle authored and ieure committed Aug 23, 2010
1 parent b800a57 commit 4383b5a
Show file tree
Hide file tree
Showing 11 changed files with 357 additions and 0 deletions.
6 changes: 6 additions & 0 deletions debian/README.Debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
geocoder-us for Debian
----------------------

<possible notes regarding this package - if none, delete this file>

-- Schuyler Erle <sderle@unknown> Sat, 07 Aug 2010 00:51:40 +0000
9 changes: 9 additions & 0 deletions debian/README.source
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
geocoder-us for Debian
----------------------

<this file describes information about the source package, see Debian policy
manual section 4.14. You WILL either need to modify or delete this file>




5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
geocoder-us (2.0.1-1sg0) unstable; urgency=low

* Initial release

-- Schuyler Erle <[email protected]> Sat, 07 Aug 2010 00:51:40 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
13 changes: 13 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Source: geocoder-us
Section: unknown
Priority: extra
Maintainer: Schuyler Erle <[email protected]>
Build-Depends: cdbs, debhelper (>= 7)
Standards-Version: 3.8.3
Homepage: http://github.com/simplegeo/geocoder/

Package: geocoder-us
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libsqlite3-ruby >= 1.3.0, libsinatra-ruby
Description: A US address geocoder.
A US address geocoder. Requires a suitable database.
35 changes: 35 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
This work was packaged for Debian by:

Schuyler Erle <sderle@unknown> on Sat, 07 Aug 2010 00:51:40 +0000

It was downloaded from <url://example.com>

Upstream Author(s):

<put author's name and email here>
<likewise for another author>

Copyright:

<Copyright (C) YYYY Name OfAuthor>
<likewise for another author>

License:

<Put the license of the package here indented by 4 spaces>

The Debian packaging is:

Copyright (C) 2010 Schuyler Erle <sderle@unknown>

# Please chose a license for your packaging work. If the program you package
# uses a mainstream license, using the same license is the safest choice.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
# If you just want it to be GPL version 3, leave the following lines in.

and is licensed under the GPL version 3,
see `/usr/share/common-licenses/GPL-3'.

# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
5 changes: 5 additions & 0 deletions debian/docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
History.txt
Manifest.txt
README.rdoc
TODO.txt
TODO.txt
Empty file added debian/geocoder-us.default.eg
Empty file.
157 changes: 157 additions & 0 deletions debian/init.d.eg
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
#! /bin/sh
#
# skeleton example file to build /etc/init.d/ scripts.
# This file should be used to construct scripts for /etc/init.d.
#
# Written by Miquel van Smoorenburg <[email protected]>.
# Modified for Debian
# by Ian Murdock <[email protected]>.
# Further changes by Javier Fernandez-Sanguino <[email protected]>
#
# Version: @(#)skeleton 1.9 26-Feb-2001 [email protected]
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/geocoder-us
NAME=geocoder-us
DESC=geocoder-us

test -x $DAEMON || exit 0

LOGDIR=/var/log/geocoder-us
PIDFILE=/var/run/$NAME.pid
DODTIME=1 # Time to wait for the server to die, in seconds
# If this value is set too low you might not
# let some servers to die gracefully and
# 'restart' will not work

# Include geocoder-us defaults if available
if [ -f /etc/default/geocoder-us ] ; then
. /etc/default/geocoder-us
fi

set -e

running_pid()
{
# Check if a given process pid's cmdline matches a given name
pid=$1
name=$2
[ -z "$pid" ] && return 1
[ ! -d /proc/$pid ] && return 1
cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
# Is this the expected child?
[ "$cmd" != "$name" ] && return 1
return 0
}

running()
{
# Check if the process is running looking at /proc
# (works for all users)

# No pidfile, probably no daemon present
[ ! -f "$PIDFILE" ] && return 1
# Obtain the pid and check it against the binary name
pid=`cat $PIDFILE`
running_pid $pid $DAEMON || return 1
return 0
}

force_stop() {
# Forcefully kill the process
[ ! -f "$PIDFILE" ] && return
if running ; then
kill -15 $pid
# Is it really dead?
[ -n "$DODTIME" ] && sleep "$DODTIME"s
if running ; then
kill -9 $pid
[ -n "$DODTIME" ] && sleep "$DODTIME"s
if running ; then
echo "Cannot kill $LABEL (pid=$pid)!"
exit 1
fi
fi
fi
rm -f $PIDFILE
return 0
}

case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--exec $DAEMON -- $DAEMON_OPTS
if running ; then
echo "$NAME."
else
echo " ERROR."
fi
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--exec $DAEMON
echo "$NAME."
;;
force-stop)
echo -n "Forcefully stopping $DESC: "
force_stop
if ! running ; then
echo "$NAME."
else
echo " ERROR."
fi
;;
#reload)
#
# If the daemon can reload its config files on the fly
# for example by sending it SIGHUP, do it here.
#
# If the daemon responds to changes in its config file
# directly anyway, make this a do-nothing entry.
#
# echo "Reloading $DESC configuration files."
# start-stop-daemon --stop --signal 1 --quiet --pidfile \
# /var/run/$NAME.pid --exec $DAEMON
#;;
force-reload)
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart" except that it does nothing if the
# daemon isn't already running.
# check wether $DAEMON is running. If so, restart
start-stop-daemon --stop --test --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON \
&& $0 restart \
|| exit 0
;;
restart)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON
[ -n "$DODTIME" ] && sleep $DODTIME
start-stop-daemon --start --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
status)
echo -n "$LABEL is "
if running ; then
echo "running"
else
echo " not running."
exit 1
fi
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2
exit 1
;;
esac

exit 0
119 changes: 119 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/make -f
SHELL = /bin/bash

tmp = debian/tmp
bindir = /usr/bin
libdir18 = $(shell ruby1.8 -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
archdir18 = $(shell ruby1.8 -r rbconfig -e 'print Config::CONFIG["archdir"]')
libdir19 = $(shell ruby1.9.1 -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
archdir19 = $(shell ruby1.9.1 -r rbconfig -e 'print Config::CONFIG["archdir"]')

build: build-sqlite3-ext build-ruby1.8-stamp build-ruby1.9.1-stamp

build-sqlite3-ext:
make -C src/libsqlite3_geocoder
cp src/libsqlite3_geocoder/*.so lib/geocoder/us/sqlite3.so

build-ruby1.8-stamp:
dh_testdir

# clean
# mv ext/sqlite3_api/sqlite3_api_wrap.c ext/sqlite3_api/sqlite3_api_wrap.c.dist
ruby1.8 setup.rb clean

# configure
ruby1.8 setup.rb config \
--bin-dir=$(shell pwd)/$(tmp)$(bindir) \
--rb-dir=$(shell pwd)/$(tmp)$(libdir18) \
--so-dir=$(shell pwd)/$(tmp)$(archdir18)

# build
ruby1.8 setup.rb setup

# install
ruby1.8 setup.rb install
#mv ext/sqlite3_api/sqlite3_api_wrap.c.dist ext/sqlite3_api/sqlite3_api_wrap.c

touch build-ruby1.8-stamp

build-ruby1.9.1-stamp: $(QUILT_STAMPFN)
dh_testdir

# clean
#mv ext/sqlite3_api/sqlite3_api_wrap.c ext/sqlite3_api/sqlite3_api_wrap.c.dist
ruby1.9.1 setup.rb clean

# configure
ruby1.9.1 setup.rb config \
--bin-dir=$(shell pwd)/$(tmp)$(bindir) \
--rb-dir=$(shell pwd)/$(tmp)$(libdir19) \
--so-dir=$(shell pwd)/$(tmp)$(archdir19)

# build
ruby1.9.1 setup.rb setup

# install
ruby1.9.1 setup.rb install
#mv ext/sqlite3_api/sqlite3_api_wrap.c.dist ext/sqlite3_api/sqlite3_api_wrap.c

touch build-ruby1.9.1-stamp

install: build
dh_testdir
dh_testroot

echo $(tmp)$(libdir18) >debian/libsqlite3-ruby1.8.install
echo $(tmp)$(archdir18) >>debian/libsqlite3-ruby1.8.install

echo $(tmp)$(libdir19) >debian/libsqlite3-ruby1.9.1.install
echo $(tmp)$(archdir19) >>debian/libsqlite3-ruby1.9.1.install

dh_install

binary: binary-indep binary-arch

binary-indep: install
dh_testdir -i
dh_testroot -i

# dh_installchangelogs -i CHANGELOG.rdoc
dh_installdocs -i
dh_link -i
dh_compress -i -X.rb -X.html
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i

binary-arch: install
dh_testdir -a
dh_testroot -a

# dh_installchangelogs -a CHANGELOG.rdoc
dh_installdocs -a -A README.rdoc
dh_link -a
dh_strip -a
dh_compress -a -X.rb -X.html
dh_fixperms -a
dh_makeshlibs -a
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a

clean: unpatch
dh_testdir
dh_testroot
make -C src/libsqlite3_geocoder clean
-ruby1.8 setup.rb clean
-ruby1.9.1 setup.rb clean
-rm -f config.save
-rm -f build-ruby1.[689]-stamp
-rm -f lib/geocoder/us/sqlite3.so
-rm -f debian/*.install

dh_clean

.PHONY: build binary binary-indep binary-arch clean
7 changes: 7 additions & 0 deletions debian/rules.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/makefile.mk


# Add here any variable or target overrides you need.

0 comments on commit 4383b5a

Please sign in to comment.