diff --git a/distros/debian/README.source b/distros/debian/README.source new file mode 100644 index 0000000..b546508 --- /dev/null +++ b/distros/debian/README.source @@ -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 diff --git a/distros/debian/changelog b/distros/debian/changelog new file mode 100644 index 0000000..8900882 --- /dev/null +++ b/distros/debian/changelog @@ -0,0 +1,17 @@ +openalpr (2.0.0-0.2) experimental; urgency=low + + * Non-maintainer upload + * Upstream release with several fixes: + - Merged Emmanuel's patches into the OpenALPR library + + -- Matthew Hill Mon, 15 Dec 2014 22:28:48 -0500 + +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 Sun, 14 Dec 2014 19:39:07 +0200 diff --git a/distros/debian/compat b/distros/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/distros/debian/compat @@ -0,0 +1 @@ +9 diff --git a/distros/debian/control b/distros/debian/control new file mode 100644 index 0000000..e087158 --- /dev/null +++ b/distros/debian/control @@ -0,0 +1,70 @@ +Source: openalpr +Section: video +Priority: optional +Maintainer: Matthew Hill +Build-Depends: debhelper (>= 9), git, cmake, quilt, libopencv-dev, + libtesseract-dev, libtesseract-dev, libleptonica-dev, liblog4cplus-dev, + libcurl3-dev, uuid-dev +Standards-Version: 3.9.6 +Homepage: https://github.com/openalpr/openalpr + +Package: libopenalpr2 +Section: libs +Architecture: amd64 +Depends: libopenalpr-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: libopenalpr2 (= ${binary:Version}), ${misc:Depends} +Description: Development files 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. + +Package: libopenalpr-data +Section: misc +Architecture: all +Depends: ${misc:Depends} +Description: Runtime data 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. + +Package: openalpr +Section: video +Architecture: amd64 +Depends: libopenalpr2 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Command line program to operate 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. + +Package: openalpr-daemon +Section: video +Architecture: amd64 +Depends: libopenalpr2 (= ${binary: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: libopenalpr2 (= ${binary: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. diff --git a/distros/debian/copyright b/distros/debian/copyright new file mode 100644 index 0000000..addaa1e --- /dev/null +++ b/distros/debian/copyright @@ -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 +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 . diff --git a/distros/debian/docs b/distros/debian/docs new file mode 100644 index 0000000..f678bec --- /dev/null +++ b/distros/debian/docs @@ -0,0 +1,2 @@ +cla.txt +README.md diff --git a/distros/debian/libopenalpr-data.install b/distros/debian/libopenalpr-data.install new file mode 100644 index 0000000..18afd4b --- /dev/null +++ b/distros/debian/libopenalpr-data.install @@ -0,0 +1,2 @@ +etc/openalpr/openalpr.conf +usr/share/openalpr/runtime_data diff --git a/distros/debian/libopenalpr-dev.install b/distros/debian/libopenalpr-dev.install new file mode 100644 index 0000000..877c682 --- /dev/null +++ b/distros/debian/libopenalpr-dev.install @@ -0,0 +1,3 @@ +usr/include/alpr.h +usr/lib/lib*.a +usr/lib/lib*so diff --git a/distros/debian/libopenalpr2.install b/distros/debian/libopenalpr2.install new file mode 100644 index 0000000..d0dbfd1 --- /dev/null +++ b/distros/debian/libopenalpr2.install @@ -0,0 +1 @@ +usr/lib/lib*.so.* diff --git a/distros/debian/openalpr-daemon.default b/distros/debian/openalpr-daemon.default new file mode 100644 index 0000000..58ae8c8 --- /dev/null +++ b/distros/debian/openalpr-daemon.default @@ -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="daemon" +#GROUP="daemon" + +# Additional options that are passed to the daemon +#DAEMON_OPTS= + diff --git a/distros/debian/openalpr-daemon.init b/distros/debian/openalpr-daemon.init new file mode 100644 index 0000000..9b5dff8 --- /dev/null +++ b/distros/debian/openalpr-daemon.init @@ -0,0 +1,170 @@ +#!/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: Emmanuel Papin + +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 + +# Run as `daemon' if USER is not specified or is `root' +if [ -z $USER ]; then + USER=daemon +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 + +: diff --git a/distros/debian/openalpr-daemon.install b/distros/debian/openalpr-daemon.install new file mode 100644 index 0000000..e13fe79 --- /dev/null +++ b/distros/debian/openalpr-daemon.install @@ -0,0 +1,2 @@ +etc/openalpr/alprd.conf +usr/bin/alprd diff --git a/distros/debian/openalpr-utils.install b/distros/debian/openalpr-utils.install new file mode 100644 index 0000000..e534461 --- /dev/null +++ b/distros/debian/openalpr-utils.install @@ -0,0 +1,5 @@ +usr/bin/openalpr-utils-sortstate +usr/bin/openalpr-utils-classifychars +usr/bin/openalpr-utils-benchmark +usr/bin/openalpr-utils-prepcharsfortraining +usr/bin/openalpr-utils-tagplates diff --git a/distros/debian/openalpr.install b/distros/debian/openalpr.install new file mode 100644 index 0000000..767fdb9 --- /dev/null +++ b/distros/debian/openalpr.install @@ -0,0 +1 @@ +usr/bin/alpr diff --git a/distros/debian/openalpr.manpages b/distros/debian/openalpr.manpages new file mode 100644 index 0000000..3587728 --- /dev/null +++ b/distros/debian/openalpr.manpages @@ -0,0 +1 @@ +doc/man/alpr.1 diff --git a/distros/debian/patches/series b/distros/debian/patches/series new file mode 100644 index 0000000..e69de29 diff --git a/distros/debian/rules b/distros/debian/rules new file mode 100755 index 0000000..50d77ea --- /dev/null +++ b/distros/debian/rules @@ -0,0 +1,79 @@ +#!/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 + +override_dh_auto_configure: + dh_auto_configure -- \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_SYSCONFDIR=/etc \ + -DCMAKE_VERBOSE_MAKEFILE=OFF \ + -DCMAKE_COLOR_MAKEFILE=ON + +# 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)" diff --git a/distros/debian/source/format b/distros/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/distros/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/distros/debian/source/local-options b/distros/debian/source/local-options new file mode 100644 index 0000000..9cdfca9 --- /dev/null +++ b/distros/debian/source/local-options @@ -0,0 +1,2 @@ +unapply-patches +abort-on-upstream-changes diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 196e831..15f685f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -71,7 +71,7 @@ set(CMAKE_CSS_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall ") ADD_EXECUTABLE( alpr main.cpp ) TARGET_LINK_LIBRARIES(alpr - openalpr-static + openalpr support video ${OpenCV_LIBS} diff --git a/src/misc_utilities/CMakeLists.txt b/src/misc_utilities/CMakeLists.txt index d7a81ba..108fa67 100644 --- 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( openalpr-utils-sortstate sortstate.cpp ) +TARGET_LINK_LIBRARIES(openalpr-utils-sortstate + openalpr support ${OpenCV_LIBS} ${Tesseract_LIBRARIES} ) -ADD_EXECUTABLE( classifychars EXCLUDE_FROM_ALL classifychars.cpp ) -TARGET_LINK_LIBRARIES(classifychars - openalpr-static +ADD_EXECUTABLE( openalpr-utils-classifychars classifychars.cpp ) +TARGET_LINK_LIBRARIES(openalpr-utils-classifychars + openalpr support ${OpenCV_LIBS} ${Tesseract_LIBRARIES} ) -ADD_EXECUTABLE(benchmark EXCLUDE_FROM_ALL +ADD_EXECUTABLE(openalpr-utils-benchmark benchmarks/benchmark.cpp benchmarks/benchmark_utils.cpp benchmarks/endtoendtest.cpp ) -TARGET_LINK_LIBRARIES(benchmark - openalpr-static +TARGET_LINK_LIBRARIES(openalpr-utils-benchmark + openalpr support pthread ${OpenCV_LIBS} @@ -30,16 +30,22 @@ TARGET_LINK_LIBRARIES(benchmark ) -ADD_EXECUTABLE( prepcharsfortraining EXCLUDE_FROM_ALL prepcharsfortraining.cpp ) -TARGET_LINK_LIBRARIES(prepcharsfortraining +ADD_EXECUTABLE( openalpr-utils-prepcharsfortraining prepcharsfortraining.cpp ) +TARGET_LINK_LIBRARIES(openalpr-utils-prepcharsfortraining support ${OpenCV_LIBS} ) -ADD_EXECUTABLE( tagplates EXCLUDE_FROM_ALL tagplates.cpp ) -TARGET_LINK_LIBRARIES(tagplates +ADD_EXECUTABLE( openalpr-utils-tagplates tagplates.cpp ) +TARGET_LINK_LIBRARIES(openalpr-utils-tagplates support ${OpenCV_LIBS} ) +install (TARGETS openalpr-utils-sortstate DESTINATION bin) +install (TARGETS openalpr-utils-classifychars DESTINATION bin) +install (TARGETS openalpr-utils-benchmark DESTINATION bin) +install (TARGETS openalpr-utils-prepcharsfortraining DESTINATION bin) +install (TARGETS openalpr-utils-tagplates DESTINATION bin) + diff --git a/src/openalpr/CMakeLists.txt b/src/openalpr/CMakeLists.txt index 9544380..787e336 100644 --- a/src/openalpr/CMakeLists.txt +++ b/src/openalpr/CMakeLists.txt @@ -53,6 +53,7 @@ TARGET_LINK_LIBRARIES(openalpr 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