Provide a debian folder to allow build of upstream package

This commit is contained in:
Emmanuel Papin
2014-12-14 20:47:56 +01:00
parent 711a47db88
commit 6a97f907a6
20 changed files with 483 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
This package uses quilt to manage all modifications to the upstream source.
Changes are stored in the source package as diffs in debian/patches and applied
during the build.
See /usr/share/doc/quilt/README.source for a detailed explanation.
This package uses the version 3.0 of the debian source package; An upstream
tarball is required to build it. This tarball can be generated automagically by
downloading the sources from the github repository with the following command:
fakeroot debian/rules get-orig-source

9
distros/debian/changelog Normal file
View File

@@ -0,0 +1,9 @@
openalpr (2.0.0-0.1) experimental; urgency=low
* Non maintainer upload.
* Upstream release with several fixes:
- Compilation of utilities enabled
- installation of static library
- alpr build against shared library
-- Emmanuel Papin <manupap01@gmail.com> Sun, 14 Dec 2014 19:39:07 +0200

1
distros/debian/compat Normal file
View File

@@ -0,0 +1 @@
9

58
distros/debian/control Normal file
View File

@@ -0,0 +1,58 @@
Source: openalpr
Section: video
Priority: optional
Maintainer: Matt Hill <matt@ndu.com>
Build-Depends: debhelper (>= 9), libopencv-dev, libtesseract-dev, git, cmake,
build-essential, libtesseract-dev, libleptonica-dev, liblog4cplus-dev,
libcurl3-dev, uuid-dev
Standards-Version: 3.9.5
Homepage: https://github.com/openalpr/openalpr
Package: libopenalpr1
Section: libs
Architecture: amd64
Depends: openalpr-data (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Automated License Plate Recognition library (OpenALPR)
OpenALPR is an open source Automatic License Plate Recognition library written
in C++. The library analyzes images and identifies license plates. The output
is the text representation of any license plate characters found in the image.
Package: libopenalpr-dev
Section: libdevel
Architecture: amd64
Depends: libopenalpr1 (= ${binary:Version}), ${misc:Depends}
Description: Development files for OpenALPR library
OpenALPR is an open source Automatic License Plate Recognition library written
in C++. The library analyzes images and identifies license plates. The output
is the text representation of any license plate characters found in the image.
Package: openalpr-data
Section: misc
Architecture: all
Depends: ${misc:Depends}
Description: Runtime data for OpenALPR library
OpenALPR is an open source Automatic License Plate Recognition library written
in C++. The library analyzes images and identifies license plates. The output
is the text representation of any license plate characters found in the image.
Package: openalpr-daemon
Section: video
Architecture: amd64
Depends: openalpr-data (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Daemon to run OpenALPR in the background
OpenALPR is an open source Automatic License Plate Recognition library written
in C++. The library analyzes images and identifies license plates. The output
is the text representation of any license plate characters found in the image.
The OpenALPR daemon allows you to monitor a camera stream for license plate
numbers in the background. Alprd runs as a daemon process on Linux.
The plate numbers can be streamed to another server (via HTTP posts) or can be
consumed programmatically via a beanstalkd queue.
Package: openalpr-utils
Section: utils
Architecture: amd64
Depends: openalpr-data (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Utilities for the OpenALPR library
OpenALPR is an open source Automatic License Plate Recognition library written
in C++. The library analyzes images and identifies license plates. The output
is the text representation of any license plate characters found in the image.

19
distros/debian/copyright Normal file
View File

@@ -0,0 +1,19 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: openalpr
Source: https://github.com/openalpr/openalpr
Files: *
Copyright: 2013-2015 Matt Hill <matt@ndu.com>
License: AGPL-3.0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

2
distros/debian/docs Normal file
View File

@@ -0,0 +1,2 @@
cla.txt
README.md

View File

@@ -0,0 +1,3 @@
usr/include/alpr.h
usr/lib/lib*.a
usr/lib/lib*so

View File

@@ -0,0 +1,2 @@
usr/lib/lib*.so.*
usr/etc/openalpr/openalpr.conf etc/openalpr

View File

@@ -0,0 +1,22 @@
# Defaults for alprd initscript
# sourced by /etc/init.d/openalpr-daemon
# installed at /etc/default/openalpr-daemon by the maintainer scripts
#
# This is a POSIX shell fragment
#
# These options can be set to modify the behavior of the openalr-daemon init script.
# The options commented out show the default values.
# Start the daemon if set to "yes"
START_DAEMON="yes"
# Path to the log file
#LOGFILE="/var/log/alpr.log"
# User and group the daemon should run as
#USER="www-data"
#GROUP="www-data"
# Additional options that are passed to the daemon
#DAEMON_OPTS="-n 20"

View File

@@ -0,0 +1,175 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: openalpr-daemon
# Required-Start: $local_fs $network $remote_fs $syslog
# Required-Stop: $local_fs $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenALPR daemon for license plate recognition
# Description: OpenALPR daemon detects license plate in the background
### END INIT INFO
# Author: lokidor <lokidor@lokiworld.net>
unset USER
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OpenALPR daemon"
NAME=openalpr-daemon
DAEMON=/usr/bin/alprd
PIDFILE=/var/run/alprd.pid
SCRIPTNAME=/etc/init.d/$NAME
DEFAULT=/etc/default/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r $DEFAULT ] && . $DEFAULT
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
# Do not start the daemon if NO_START is enabled in DEFAULT
if [ "$START_DAEMON" != "yes" ] && [ "$1" != "stop" ]; then
log_warning_msg "$NAME: Not starting $DESC."
log_warning_msg "$NAME: Disabled in $DEFAULT."
exit 0
fi
# Set the default log file
if [ -z $LOGFILE ]; then
LOGFILE=/var/log/alpr.log
fi
# Set the default daemon options
if [ -z $DAEMON_OPTS ]; then
DAEMON_OPTS="-n 20"
fi
# Run as `www-data' if USER is not specified or is `root'
if [ -z $USER ]; then
USER=www-data
fi
# If no group is specified, use USER
if [ -z $GROUP ]; then
GROUP=$USER
fi
DAEMON_ARGS="-l $LOGFILE $DAEMON_OPTS"
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
[ ! -f $LOGFILE ] && touch $LOGFILE && chown $USER:$GROUP $LOGFILE \
|| return 2
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--chuid $USER:$GROUP --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--chuid $USER:$GROUP --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View File

@@ -0,0 +1,2 @@
usr/bin/alprd
usr/etc/openalpr/alprd.conf etc/openalpr

View File

@@ -0,0 +1 @@
usr/share/openalpr/runtime_data

View File

@@ -0,0 +1,6 @@
usr/bin/alpr
usr/bin/sortstate-openalpr-utils
usr/bin/classifychars-openalpr-utils
usr/bin/benchmark-openalpr-utils
usr/bin/prepcharsfortraining-openalpr-utils
usr/bin/tagplates-openalpr-utils

View File

@@ -0,0 +1 @@
doc/man/alpr.1

View File

@@ -0,0 +1,67 @@
--- a/src/misc_utilities/CMakeLists.txt
+++ b/src/misc_utilities/CMakeLists.txt
@@ -1,28 +1,28 @@
-ADD_EXECUTABLE( sortstate EXCLUDE_FROM_ALL sortstate.cpp )
-TARGET_LINK_LIBRARIES(sortstate
- openalpr-static
+ADD_EXECUTABLE( sortstate-openalpr-utils sortstate.cpp )
+TARGET_LINK_LIBRARIES(sortstate-openalpr-utils
+ openalpr
support
${OpenCV_LIBS}
${Tesseract_LIBRARIES}
)
-ADD_EXECUTABLE( classifychars EXCLUDE_FROM_ALL classifychars.cpp )
-TARGET_LINK_LIBRARIES(classifychars
- openalpr-static
+ADD_EXECUTABLE( classifychars-openalpr-utils classifychars.cpp )
+TARGET_LINK_LIBRARIES(classifychars-openalpr-utils
+ openalpr
support
${OpenCV_LIBS}
${Tesseract_LIBRARIES}
)
-ADD_EXECUTABLE(benchmark EXCLUDE_FROM_ALL
+ADD_EXECUTABLE(benchmark-openalpr-utils
benchmarks/benchmark.cpp
benchmarks/benchmark_utils.cpp
benchmarks/endtoendtest.cpp
)
-TARGET_LINK_LIBRARIES(benchmark
- openalpr-static
+TARGET_LINK_LIBRARIES(benchmark-openalpr-utils
+ openalpr
support
pthread
${OpenCV_LIBS}
@@ -30,16 +30,22 @@
)
-ADD_EXECUTABLE( prepcharsfortraining EXCLUDE_FROM_ALL prepcharsfortraining.cpp )
-TARGET_LINK_LIBRARIES(prepcharsfortraining
+ADD_EXECUTABLE( prepcharsfortraining-openalpr-utils prepcharsfortraining.cpp )
+TARGET_LINK_LIBRARIES(prepcharsfortraining-openalpr-utils
support
${OpenCV_LIBS}
)
-ADD_EXECUTABLE( tagplates EXCLUDE_FROM_ALL tagplates.cpp )
-TARGET_LINK_LIBRARIES(tagplates
+ADD_EXECUTABLE( tagplates-openalpr-utils tagplates.cpp )
+TARGET_LINK_LIBRARIES(tagplates-openalpr-utils
support
${OpenCV_LIBS}
)
+install (TARGETS sortstate-openalpr-utils DESTINATION bin)
+install (TARGETS classifychars-openalpr-utils DESTINATION bin)
+install (TARGETS benchmark-openalpr-utils DESTINATION bin)
+install (TARGETS prepcharsfortraining-openalpr-utils DESTINATION bin)
+install (TARGETS tagplates-openalpr-utils DESTINATION bin)
+

View File

@@ -0,0 +1,10 @@
--- a/src/openalpr/CMakeLists.txt
+++ b/src/openalpr/CMakeLists.txt
@@ -47,6 +47,7 @@
install (FILES alpr.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
+install (TARGETS openalpr-static DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install (TARGETS openalpr DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
# Add definition for default config file

View File

@@ -0,0 +1,11 @@
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -55,7 +55,7 @@
ADD_EXECUTABLE( alpr main.cpp )
TARGET_LINK_LIBRARIES(alpr
- openalpr-static
+ openalpr
support
video
${OpenCV_LIBS}

View File

@@ -0,0 +1,3 @@
install_static_library.diff
make_alpr_dependent_to_shared_library.diff
enable_utilities.diff

78
distros/debian/rules Executable file
View File

@@ -0,0 +1,78 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
# DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
#
# These are used to get the most recent version of the original sources from github
UURL = $(shell git config --get remote.origin.url)
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
HEAD = $(shell git rev-parse HEAD)
PKD = $(shell pwd)/debian
PKG = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
VER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
DTYPE =
TARBALL = ../$(PKG)_$(VER)$(DTYPE).orig.tar.xz
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
# main packaging script based on dh7 syntax
%:
dh $@ --sourcedirectory=src --with quilt
# debmake generated override targets
# This is example for Cmake (See http://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- \
# -DCMAKE_BUILD_TYPE:STRING=Debug
# Inspired by https://wiki.debian.org/onlyjob/get-orig-source
.PHONY: get-orig-source
get-orig-source: $(TARBALL) $(info I: $(PKG)_$(VER)$(DTYPE))
@
$(TARBALL):
$(if $(wildcard $(PKG)-$(VER)),$(error folder '$(PKG)-$(VER)' exists, aborting...))
@echo "# Cloning origin repository..."; \
if ! git clone $(UURL) $(PKG)-$(VER); then \
$(RM) -r $(PKG)-$(VER); \
echo "failed to clone repository, aborting..."; \
false; \
fi
@if [ $(BRANCH) != "master" ]; then \
cd $(PKG)-$(VER); \
echo "# Not on master branch, fetching origin branch '$(BRANCH)'..."; \
git fetch origin $(BRANCH):$(BRANCH) || false; \
echo "# Switching to branch '$(BRANCH)'..."; \
git checkout $(BRANCH) || false; \
fi
@echo "# Checking local source..."
@if [ $$(cd $(PKG)-$(VER) && git rev-parse HEAD) = $(HEAD) ]; then \
echo "even with origin, ok"; \
true; \
else \
echo "not even with origin, aborting..."; \
false; \
fi
@echo "# Setting times..."
@cd $(PKG)-$(VER) \
&& for F in $$(git ls-tree -r --name-only HEAD | sed -e "s/\s/\*/g"); do \
touch --no-dereference -d "$$(git log -1 --format="%ai" -- $$F)" "$$F"; \
done
@echo "# Cleaning-up..."
cd $(PKG)-$(VER) && $(RM) -r .git
@echo "# Packing file '$(TARBALL)'..."
@find -L "$(PKG)-$(VER)" -xdev -type f -print | sort \
| XZ_OPT="-6v" tar -caf "$(TARBALL)" -T- --owner=root --group=root --mode=a+rX \
&& $(RM) -r "$(PKG)-$(VER)"

View File

@@ -0,0 +1 @@
3.0 (quilt)