diff options
author | ng0 <ng0@n0.is> | 2019-04-03 12:19:26 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-04-03 12:19:26 +0000 |
commit | cc3d270b525cdc4756fa706221fd4ad510539700 (patch) | |
tree | d7199304b17651d285dd09d41c2bc7fbc70950e9 | |
parent | f002ecb549ec33da77e4a034ad1cffe27922112d (diff) | |
parent | e96ba10771f6c6932607624c4645cf50b3d5b71f (diff) | |
download | gnunet-cc3d270b525cdc4756fa706221fd4ad510539700.tar.gz gnunet-cc3d270b525cdc4756fa706221fd4ad510539700.zip |
Merge branch 'master' of gnunet.org:gnunet
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | configure.ac | 39 | ||||
-rw-r--r-- | contrib/guix/gnu/packages/gnunet.scm | 123 | ||||
-rw-r--r-- | contrib/vagrant/bootstrap.ubuntu.sh | 2 | ||||
-rw-r--r-- | doc/system_specific/FROM_SOURCE | 4 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/util/Makefile.am | 32 | ||||
-rw-r--r-- | src/util/gnunet-qr.c | 314 | ||||
-rwxr-xr-x | src/util/gnunet-qr.in | 46 | ||||
-rw-r--r-- | src/util/gnunet-qr.py | 110 |
12 files changed, 500 insertions, 181 deletions
@@ -49,6 +49,7 @@ Eric Noack <corvus-gnunet@cybertrench.com> | |||
49 | Felix von Leitner [ diet libc snprintf for win32 ] | 49 | Felix von Leitner [ diet libc snprintf for win32 ] |
50 | Gerd Knorr <kraxel@bytesex.org> | 50 | Gerd Knorr <kraxel@bytesex.org> |
51 | Glenn McGrath <bug1@iinet.net.au> | 51 | Glenn McGrath <bug1@iinet.net.au> |
52 | Hartmut Goebel <h.goebel@crazy-compiler.com> | ||
52 | Hendrik Pagenhardt <Hendrik.Pagenhardt@gmx.net> | 53 | Hendrik Pagenhardt <Hendrik.Pagenhardt@gmx.net> |
53 | Heikki Lindholm <holin@iki.fi> | 54 | Heikki Lindholm <holin@iki.fi> |
54 | Igor Wronsky <iwronsky@users.sourceforge.net> | 55 | Igor Wronsky <iwronsky@users.sourceforge.net> |
@@ -1,3 +1,8 @@ | |||
1 | Wed 03 Apr 2019 01:54:44 PM CEST | ||
2 | Merged gnunet-qr-c-2 branch, replacing Python-based implementation | ||
3 | of gnunet-qr with C-based implementation that also integrates | ||
4 | gnunet-uri. -HG/MS/CG | ||
5 | |||
1 | Wed 03 Apr 2019 01:15:57 PM CEST | 6 | Wed 03 Apr 2019 01:15:57 PM CEST |
2 | Fixed a few test case regressions (GNS, FS). -CG | 7 | Fixed a few test case regressions (GNS, FS). -CG |
3 | 8 | ||
@@ -124,6 +124,7 @@ These are the optional dependencies: | |||
124 | - libogg >= 1.3.0 (for experimental conversation tool) | 124 | - libogg >= 1.3.0 (for experimental conversation tool) |
125 | - libnss (certtool binary (for convenient | 125 | - libnss (certtool binary (for convenient |
126 | installation of GNS proxy)) | 126 | installation of GNS proxy)) |
127 | - libzbar >= 0.10 (for gnunet-qr) | ||
127 | - libpbc >= 0.5.14 (for Attribute-Based Encryption and | 128 | - libpbc >= 0.5.14 (for Attribute-Based Encryption and |
128 | Identity Provider functionality) | 129 | Identity Provider functionality) |
129 | - libgabe (for Attribute-Based Encryption and | 130 | - libgabe (for Attribute-Based Encryption and |
@@ -133,9 +134,6 @@ These are the optional dependencies: | |||
133 | html output of man pages) | 134 | html output of man pages) |
134 | - miniupnpc | 135 | - miniupnpc |
135 | - perl5 (for some utilities) | 136 | - perl5 (for some utilities) |
136 | - python2.7 = 2.7 (for gnunet-qr, only python 2.7 | ||
137 | supported) | ||
138 | - python-zbar >= 0.10 (for gnunet-qr, not optional) | ||
139 | - TeX Live >= 2012 (for gnunet-bcd[*]) | 137 | - TeX Live >= 2012 (for gnunet-bcd[*]) |
140 | - texi2mdoc (for automatic mdoc generation [*2]) | 138 | - texi2mdoc (for automatic mdoc generation [*2]) |
141 | 139 | ||
diff --git a/configure.ac b/configure.ac index 96d7cbbc0..ac8ed60c2 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -534,6 +534,39 @@ else | |||
534 | AC_DEFINE([HAVE_LIBBLUETOOTH],[0],[Lacking bluetooth library]) | 534 | AC_DEFINE([HAVE_LIBBLUETOOTH],[0],[Lacking bluetooth library]) |
535 | fi | 535 | fi |
536 | 536 | ||
537 | # check for zbar library | ||
538 | zbar=0 | ||
539 | AC_MSG_CHECKING(for libzbar) | ||
540 | AC_ARG_WITH(zbar, | ||
541 | [ --with-zbar=PFX base of libzbar installation], | ||
542 | [AC_MSG_RESULT([$with_zbar]) | ||
543 | case $with_zbar in | ||
544 | no) | ||
545 | ;; | ||
546 | yes) | ||
547 | AC_CHECK_HEADERS(zbar.h, | ||
548 | AC_CHECK_LIB([zbar], [zbar_processor_create], | ||
549 | zbar=1)) | ||
550 | ;; | ||
551 | *) | ||
552 | LDFLAGS="-L$with_zbar/lib $LDFLAGS" | ||
553 | CPPFLAGS="-I$with_zbar/include $CPPFLAGS" | ||
554 | AC_CHECK_HEADERS(zbar.h, | ||
555 | AC_CHECK_LIB([zbar], [zbar_processor_create], | ||
556 | EXT_LIB_PATH="-L$with_zbar/lib $EXT_LIB_PATH" | ||
557 | zbar=1)) | ||
558 | ;; | ||
559 | esac | ||
560 | ], | ||
561 | [AC_MSG_RESULT([--with-zbar not specified]) | ||
562 | AC_CHECK_HEADERS(zbar.h, | ||
563 | AC_CHECK_LIB([zbar], [zbar_processor_create], | ||
564 | zbar=1))]) | ||
565 | AM_CONDITIONAL(HAVE_ZBAR, [test "$zbar" = 1]) | ||
566 | AS_IF([test "x$zbar" = x1], | ||
567 | [AC_DEFINE([HAVE_ZBAR],[1],[Have zbar library])], | ||
568 | [AC_DEFINE([HAVE_ZBAR],[0],[Lacking zbar library])]) | ||
569 | |||
537 | # check for jansson library | 570 | # check for jansson library |
538 | jansson=0 | 571 | jansson=0 |
539 | AC_MSG_CHECKING(for libjansson) | 572 | AC_MSG_CHECKING(for libjansson) |
@@ -563,6 +596,7 @@ AC_ARG_WITH(jansson, | |||
563 | AC_CHECK_LIB([jansson], [json_loads], | 596 | AC_CHECK_LIB([jansson], [json_loads], |
564 | jansson=1))]) | 597 | jansson=1))]) |
565 | AM_CONDITIONAL(HAVE_JANSSON, [test "$jansson" = 1]) | 598 | AM_CONDITIONAL(HAVE_JANSSON, [test "$jansson" = 1]) |
599 | AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1]) | ||
566 | AS_IF([test "x$jansson" = x1], | 600 | AS_IF([test "x$jansson" = x1], |
567 | [AC_DEFINE([HAVE_JANSSON],[1],[Have jansson library])], | 601 | [AC_DEFINE([HAVE_JANSSON],[1],[Have jansson library])], |
568 | [AC_DEFINE([HAVE_JANSSON],[0],[Lacking jansson library])]) | 602 | [AC_DEFINE([HAVE_JANSSON],[0],[Lacking jansson library])]) |
@@ -1432,6 +1466,7 @@ AM_CONDITIONAL(HAVE_GNUTLS_DANE, test x$gnutls_dane = x1) | |||
1432 | AC_DEFINE_UNQUOTED([HAVE_GNUTLS_DANE], $gnutls_dane, [We have GnuTLS with DANE support]) | 1466 | AC_DEFINE_UNQUOTED([HAVE_GNUTLS_DANE], $gnutls_dane, [We have GnuTLS with DANE support]) |
1433 | 1467 | ||
1434 | 1468 | ||
1469 | |||
1435 | # Test if we are building for superMUC | 1470 | # Test if we are building for superMUC |
1436 | AC_MSG_CHECKING(if GNUnet is being configured to run on the SuperMUC) | 1471 | AC_MSG_CHECKING(if GNUnet is being configured to run on the SuperMUC) |
1437 | AC_ARG_ENABLE([supermuc], | 1472 | AC_ARG_ENABLE([supermuc], |
@@ -1938,6 +1973,10 @@ AS_IF([test x$gnutls != xtrue], | |||
1938 | [AS_IF([test "x$gnutls_dane" != "x1"], | 1973 | [AS_IF([test "x$gnutls_dane" != "x1"], |
1939 | [AC_MSG_NOTICE([WARNING: GnuTLS has no DANE support, DANE validation will not be possible])])]) | 1974 | [AC_MSG_NOTICE([WARNING: GnuTLS has no DANE support, DANE validation will not be possible])])]) |
1940 | 1975 | ||
1976 | # warn user if libzbar is not found | ||
1977 | AS_IF([test "$have_zbar" = 0], | ||
1978 | [AC_MSG_NOTICE([WARNING: zbar not found, gnunet-qr will not be built.])]) | ||
1979 | |||
1941 | # java ports | 1980 | # java ports |
1942 | AS_IF([test "x$enable_java_ports" = "xyes"], | 1981 | AS_IF([test "x$enable_java_ports" = "xyes"], |
1943 | [AC_MSG_NOTICE([NOTICE: Opening ports for gnunet-java bindings by default.])]) | 1982 | [AC_MSG_NOTICE([NOTICE: Opening ports for gnunet-java bindings by default.])]) |
diff --git a/contrib/guix/gnu/packages/gnunet.scm b/contrib/guix/gnu/packages/gnunet.scm index 6089ee2fa..0039eeca4 100644 --- a/contrib/guix/gnu/packages/gnunet.scm +++ b/contrib/guix/gnu/packages/gnunet.scm | |||
@@ -43,6 +43,7 @@ | |||
43 | #:use-module (gnu packages gtk) | 43 | #:use-module (gnu packages gtk) |
44 | #:use-module (gnu packages guile) | 44 | #:use-module (gnu packages guile) |
45 | #:use-module (gnu packages gstreamer) | 45 | #:use-module (gnu packages gstreamer) |
46 | #:use-module (gnu packages imagemagick) | ||
46 | #:use-module (gnu packages libidn) | 47 | #:use-module (gnu packages libidn) |
47 | #:use-module (gnu packages linux) | 48 | #:use-module (gnu packages linux) |
48 | #:use-module (gnu packages image) | 49 | #:use-module (gnu packages image) |
@@ -56,11 +57,14 @@ | |||
56 | #:use-module (gnu packages perl) | 57 | #:use-module (gnu packages perl) |
57 | #:use-module (gnu packages pulseaudio) | 58 | #:use-module (gnu packages pulseaudio) |
58 | #:use-module (gnu packages python) | 59 | #:use-module (gnu packages python) |
60 | #:use-module (gnu packages qt) | ||
59 | #:use-module (gnu packages databases) | 61 | #:use-module (gnu packages databases) |
60 | #:use-module (gnu packages tls) | 62 | #:use-module (gnu packages tls) |
61 | #:use-module (gnu packages video) | 63 | #:use-module (gnu packages video) |
62 | #:use-module (gnu packages web) | 64 | #:use-module (gnu packages web) |
63 | #:use-module (gnu packages xiph) | 65 | #:use-module (gnu packages xiph) |
66 | #:use-module (gnu packages xml) | ||
67 | #:use-module (gnu packages xorg) | ||
64 | #:use-module (gnu packages backup) | 68 | #:use-module (gnu packages backup) |
65 | #:use-module ((guix licenses) #:prefix license:) | 69 | #:use-module ((guix licenses) #:prefix license:) |
66 | #:use-module ((guix build utils) #:prefix build-utils:) | 70 | #:use-module ((guix build utils) #:prefix build-utils:) |
@@ -191,6 +195,122 @@ authentication and support for SSL3 and TLS.") | |||
191 | (license license:lgpl2.1+) | 195 | (license license:lgpl2.1+) |
192 | (home-page "https://www.gnu.org/software/libmicrohttpd/"))) | 196 | (home-page "https://www.gnu.org/software/libmicrohttpd/"))) |
193 | 197 | ||
198 | (define-public zbar | ||
199 | (package | ||
200 | (name "zbar") | ||
201 | (version "0.22") | ||
202 | (source (origin | ||
203 | (method url-fetch) | ||
204 | (uri (string-append "https://www.linuxtv.org/downloads/zbar/zbar-" | ||
205 | version ".tar.bz2")) | ||
206 | (sha256 | ||
207 | (base32 | ||
208 | "1dsffj42gbasfq4sfhgirmi3lfgdygfspwzr00wbva0pf96fka8v")))) | ||
209 | (build-system gnu-build-system) | ||
210 | (outputs '("out" "gtk" "qt")) | ||
211 | (native-inputs | ||
212 | `(;;("coreutils" ,coreutils) | ||
213 | ("dbus" ,dbus) | ||
214 | ("glib:bin", glib "bin") | ||
215 | ("pkg-config" ,pkg-config) | ||
216 | ;; for testing | ||
217 | ("perl" ,perl) | ||
218 | ("python2" ,python-2.7) | ||
219 | )) | ||
220 | (inputs | ||
221 | `(("gtk+-2" ,gtk+-2) | ||
222 | ("imagemagick" ,imagemagick) | ||
223 | ("libjpeg" ,libjpeg) | ||
224 | ("libxv" ,libxv) | ||
225 | ;;("python2-pygtk" ,python2-pygtk) | ||
226 | ("qtbase" ,qtbase) | ||
227 | ("qt11extras" ,qtx11extras) | ||
228 | ("v4l-utils" ,v4l-utils) | ||
229 | ("xmlto" ,xmlto))) | ||
230 | (arguments | ||
231 | `(#:configure-flags | ||
232 | (list "--without-python2" | ||
233 | "--without-java" | ||
234 | (string-append | ||
235 | "--with-dbusconfdir=" (assoc-ref %outputs "out") "/etc") | ||
236 | "CXXFLAGS=-std=gnu++11" ;; for qt related | ||
237 | ;; Add the other outputs lib directories to the RUNPATH. | ||
238 | ;; (string-append "LDFLAGS=" | ||
239 | ;; "-Wl,-rpath=" (assoc-ref %outputs "gtk") "/lib" | ||
240 | ;; " " | ||
241 | ;; "-Wl,-rpath=" (assoc-ref %outputs "qt") "/lib" | ||
242 | ;; ) | ||
243 | ) | ||
244 | #:tests? #f | ||
245 | #:validate-runpath? #f | ||
246 | #:phases | ||
247 | (modify-phases %standard-phases | ||
248 | (add-before 'configure 'create-missing-file | ||
249 | ;; Create a file missing in the distribution archive, | ||
250 | ;; see https://github.com/mchehab/zbar/issues/35 | ||
251 | (lambda _ | ||
252 | (with-output-to-file "examples/sha1sum" | ||
253 | (lambda _ | ||
254 | (display " | ||
255 | a56811d078ea5cfac9be5deb4b6796177763e152 zbarimg codabar.png | ||
256 | cc53bf34878f769fc3611020c11e572f2853bd2a zbarimg code-128.png | ||
257 | 7537d593ea42393a43bc0eda0a896c0e31017dd8 zbarimg code-39.png | ||
258 | f8f55b828eb7d0400f300be021d29293bd4a3191 zbarimg code-93.png | ||
259 | aebbdbed0b32d7fd72f1245e3fb384822d492062 zbarimg databar.png | ||
260 | 9e245874d3229a575eabfdba1c668369c55960e3 zbarimg databar-exp.png | ||
261 | 53429fc04dfcf674349e2db6cfbaf73e301fc3dc zbarimg ean-13.png | ||
262 | 4095418b74efbb026dd730543558fefdda46f5b9 zbarimg ean-8.png | ||
263 | 5501245dbba21c153f690787fc97ab50c973b846 zbarimg i2-5.png | ||
264 | b350ca7efad7a50c5ac082d5c683a8e8d8d380a7 zbarimg qr-code.png | ||
265 | 84c0ce7072e2227073dc8bd1e5f4518d8f42ae3d zbarimg sqcode1-generated.png | ||
266 | 84c0ce7072e2227073dc8bd1e5f4518d8f42ae3d zbarimg sqcode1-scanned.png | ||
267 | 5ab2b518e2c9d827cedc5825d2e3c9646d43713a zbarimg -Sean2.enable ean-2.png | ||
268 | 668fef8cb9caac34df8cb8564c2cde62e4af5e65 zbarimg -Sean5.enable ean-5.png | ||
269 | b567e550216fe24f7652f683146365a9fe7ee867 zbarimg -Sisbn10.enable ean-13.png | ||
270 | d0f37aa076d42c270f7231c5490beea5605e2ba0 zbarimg -Sisbn13.enable ean-13.png | ||
271 | 3f041225df3b8364b5fd0daf9cf402e8a4731f9b zbarimg -Supca.enable code-upc-a.png | ||
272 | b350ca7efad7a50c5ac082d5c683a8e8d8d380a7 zbarimg -Stest-inverted qr-code-inverted.png\n"))))) | ||
273 | (replace 'check | ||
274 | ;; Run test-suite under a dbus session. | ||
275 | (lambda _ | ||
276 | ;; Don't fail on missing '/etc/machine-id'. | ||
277 | (setenv "DBUS_FATAL_WARNINGS" "0") | ||
278 | (invoke "dbus-launch" "make" "check"))) | ||
279 | (add-after 'install 'split | ||
280 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
281 | ;; Split the binaries to the various outputs. | ||
282 | (let* ((out (assoc-ref outputs "out")) | ||
283 | (gtk (assoc-ref outputs "gtk")) | ||
284 | (qt (assoc-ref outputs "qt")) | ||
285 | (mv (lambda (dest-out dir pattern) | ||
286 | (mkdir-p (string-append dest-out dir)) | ||
287 | (for-each | ||
288 | (lambda (file) | ||
289 | (rename-file | ||
290 | file | ||
291 | (string-append dest-out dir "/" (basename file)))) | ||
292 | (find-files (string-append out dir) pattern))))) | ||
293 | (mv qt "/bin" "zbarcam-qt") | ||
294 | (mv gtk "/bin" "zbarcam-gtk") | ||
295 | (mv qt "/lib" "libzbarqt\\..*") | ||
296 | (mv gtk "/lib" "libzbargtk\\..*") | ||
297 | (mv qt "/lib/pkgconfig" "zbar-qt\\.pc" ) | ||
298 | (mv gtk "/lib/pkgconfig" "zbar-gtk\\.pc" ) | ||
299 | (mv qt "/include/zbar" "QZBar.*\\.h") | ||
300 | (mv gtk "/include/zbar" "zbargtk\\.h")) | ||
301 | #t))))) | ||
302 | (synopsis "Read bar-codes from various sources") | ||
303 | (description "ZBar is a software suite for reading bar codes from | ||
304 | various sources, such as video streams, image files and raw intensity | ||
305 | sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, | ||
306 | Interleaved 2 of 5 and QR Code. Included with the library are basic | ||
307 | applications for decoding captured bar code images and using a video | ||
308 | device (eg, webcam) as a bar code scanner. For application developers, | ||
309 | language bindings are included for C, C++ and Perl as well as | ||
310 | GUI widgets for Qt and GTK") | ||
311 | (license license:lgpl2.1+) | ||
312 | (home-page "http://zbar.sourceforge.net/"))) | ||
313 | |||
194 | (define-public gnurl | 314 | (define-public gnurl |
195 | (package | 315 | (package |
196 | (name "gnurl") | 316 | (name "gnurl") |
@@ -301,7 +421,8 @@ newspace." | |||
301 | ("bluez" ,bluez) ; gnunet-transport | 421 | ("bluez" ,bluez) ; gnunet-transport |
302 | ("glib" ,glib) | 422 | ("glib" ,glib) |
303 | ("libogg" ,libogg) ; gnunet-conversation | 423 | ("libogg" ,libogg) ; gnunet-conversation |
304 | ("python-2" ,python-2))) ; tests, gnunet-qr | 424 | ("zbar" ,zbar) ; gnunet-qr |
425 | ("python-2" ,python-2))) ; tests | ||
305 | (native-inputs | 426 | (native-inputs |
306 | `(("pkg-config" ,pkg-config) | 427 | `(("pkg-config" ,pkg-config) |
307 | ("autoconf" ,autoconf) | 428 | ("autoconf" ,autoconf) |
diff --git a/contrib/vagrant/bootstrap.ubuntu.sh b/contrib/vagrant/bootstrap.ubuntu.sh index 6b28d3075..f0b7c454e 100644 --- a/contrib/vagrant/bootstrap.ubuntu.sh +++ b/contrib/vagrant/bootstrap.ubuntu.sh | |||
@@ -27,7 +27,7 @@ apt-get -y install zlib1g-dev | |||
27 | # optional for gnunet-conversation | 27 | # optional for gnunet-conversation |
28 | # apt-get -y install libpulse-dev libopus-dev libogg-dev gstreamer1.0 | 28 | # apt-get -y install libpulse-dev libopus-dev libogg-dev gstreamer1.0 |
29 | # optional for gnunet-qr | 29 | # optional for gnunet-qr |
30 | apt-get -y install python-zbar | 30 | apt-get -y install libzbar-dev |
31 | # optional for experimental code | 31 | # optional for experimental code |
32 | apt-get -y install libglpk-dev | 32 | apt-get -y install libglpk-dev |
33 | # | 33 | # |
diff --git a/doc/system_specific/FROM_SOURCE b/doc/system_specific/FROM_SOURCE index 72660798d..7b0ebf436 100644 --- a/doc/system_specific/FROM_SOURCE +++ b/doc/system_specific/FROM_SOURCE | |||
@@ -534,7 +534,7 @@ at all. | |||
534 | We begin by installing a few Debian packages from stable:@ | 534 | We begin by installing a few Debian packages from stable:@ |
535 | 535 | ||
536 | @example | 536 | @example |
537 | # apt-get install gcc make python-zbar libltdl-dev libsqlite3-dev \ | 537 | # apt-get install gcc make libzbar-dev libltdl-dev libsqlite3-dev \ |
538 | libunistring-dev libopus-dev libpulse-dev openssl libglpk-dev \ | 538 | libunistring-dev libopus-dev libpulse-dev openssl libglpk-dev \ |
539 | texlive libidn11-dev libmysqlclient-dev libpq-dev libarchive-dev \ | 539 | texlive libidn11-dev libmysqlclient-dev libpq-dev libarchive-dev \ |
540 | libbz2-dev libexiv2-dev libflac-dev libgif-dev libglib2.0-dev \ | 540 | libbz2-dev libexiv2-dev libflac-dev libgif-dev libglib2.0-dev \ |
@@ -778,7 +778,7 @@ as a normal user. | |||
778 | We begin by installing a few Debian packages from stable: | 778 | We begin by installing a few Debian packages from stable: |
779 | 779 | ||
780 | @example | 780 | @example |
781 | # apt-get install gcc make python-zbar libltdl-dev libsqlite3-dev \ | 781 | # apt-get install gcc make libzbar-dev libltdl-dev libsqlite3-dev \ |
782 | libunistring-dev libopus-dev libpulse-dev openssl libglpk-dev texlive \ | 782 | libunistring-dev libopus-dev libpulse-dev openssl libglpk-dev texlive \ |
783 | libidn11-dev libmysqlclient-dev libpq-dev libarchive-dev libbz2-dev \ | 783 | libidn11-dev libmysqlclient-dev libpq-dev libarchive-dev libbz2-dev \ |
784 | libflac-dev libgif-dev libglib2.0-dev libgtk-3-dev libmpeg2-4-dev \ | 784 | libflac-dev libgif-dev libglib2.0-dev libgtk-3-dev libmpeg2-4-dev \ |
diff --git a/po/POTFILES.in b/po/POTFILES.in index fe788fdae..67c22aaed 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -480,6 +480,7 @@ src/util/gnunet-config.c | |||
480 | src/util/gnunet-config-diff.c | 480 | src/util/gnunet-config-diff.c |
481 | src/util/gnunet-ecc.c | 481 | src/util/gnunet-ecc.c |
482 | src/util/gnunet-helper-w32-console.c | 482 | src/util/gnunet-helper-w32-console.c |
483 | src/util/gnunet-qr.c | ||
483 | src/util/gnunet-resolver.c | 484 | src/util/gnunet-resolver.c |
484 | src/util/gnunet-scrypt.c | 485 | src/util/gnunet-scrypt.c |
485 | src/util/gnunet-service-resolver.c | 486 | src/util/gnunet-service-resolver.c |
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index cd14fb4ca..89d0462c5 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -204,26 +204,15 @@ libexec_PROGRAMS = \ | |||
204 | gnunet-timeout \ | 204 | gnunet-timeout \ |
205 | $(W32CONSOLEHELPER) | 205 | $(W32CONSOLEHELPER) |
206 | 206 | ||
207 | do_subst = $(SED) -e 's,[@]PREFIX[@],$(prefix),g' | ||
208 | |||
209 | gnunet-qr: gnunet-qr.in Makefile | ||
210 | $(do_subst) < $(srcdir)/gnunet-qr.in > gnunet-qr | ||
211 | chmod +x gnunet-qr | ||
212 | |||
213 | CLEANFILES = gnunet-qr | ||
214 | |||
215 | pkgdata_DATA = \ | ||
216 | gnunet-qr.py | ||
217 | |||
218 | bin_SCRIPTS =\ | ||
219 | gnunet-qr | ||
220 | |||
221 | bin_PROGRAMS = \ | 207 | bin_PROGRAMS = \ |
222 | gnunet-resolver \ | 208 | gnunet-resolver \ |
223 | gnunet-config \ | 209 | gnunet-config \ |
224 | $(GNUNET_ECC) \ | 210 | $(GNUNET_ECC) \ |
225 | $(GNUNET_SCRYPT) \ | 211 | $(GNUNET_SCRYPT) \ |
226 | gnunet-uri | 212 | gnunet-uri |
213 | if HAVE_ZBAR | ||
214 | bin_PROGRAMS += gnunet-qr | ||
215 | endif | ||
227 | 216 | ||
228 | noinst_PROGRAMS = \ | 217 | noinst_PROGRAMS = \ |
229 | gnunet-config-diff \ | 218 | gnunet-config-diff \ |
@@ -283,13 +272,22 @@ gnunet_config_LDADD = \ | |||
283 | libgnunetutil.la \ | 272 | libgnunetutil.la \ |
284 | $(GN_LIBINTL) | 273 | $(GN_LIBINTL) |
285 | 274 | ||
286 | |||
287 | gnunet_uri_SOURCES = \ | 275 | gnunet_uri_SOURCES = \ |
288 | gnunet-uri.c | 276 | gnunet-uri.c |
289 | gnunet_uri_LDADD = \ | 277 | gnunet_uri_LDADD = \ |
290 | libgnunetutil.la \ | 278 | libgnunetutil.la \ |
291 | $(GN_LIBINTL) | 279 | $(GN_LIBINTL) |
292 | 280 | ||
281 | |||
282 | gnunet_qr_SOURCES = \ | ||
283 | gnunet-qr.c \ | ||
284 | gnunet-qr-utils.h | ||
285 | gnunet_qr_LDADD = \ | ||
286 | libgnunetutil.la \ | ||
287 | $(GN_LIBINTL) | ||
288 | gnunet_qr_LDFLAGS= $(libzbar_LIBS) | ||
289 | gnunet_qr_CFLAGS = $(libzbar_CFLAGS) -DBINDIR=\"@bindir@/\" | ||
290 | |||
293 | plugin_LTLIBRARIES = \ | 291 | plugin_LTLIBRARIES = \ |
294 | libgnunet_plugin_test.la | 292 | libgnunet_plugin_test.la |
295 | 293 | ||
@@ -670,6 +668,4 @@ EXTRA_DIST = \ | |||
670 | test_program_data.conf \ | 668 | test_program_data.conf \ |
671 | test_resolver_api_data.conf \ | 669 | test_resolver_api_data.conf \ |
672 | test_service_data.conf \ | 670 | test_service_data.conf \ |
673 | test_speedup_data.conf \ | 671 | test_speedup_data.conf |
674 | gnunet-qr.in \ | ||
675 | gnunet-qr.py | ||
diff --git a/src/util/gnunet-qr.c b/src/util/gnunet-qr.c new file mode 100644 index 000000000..fa95d6c05 --- /dev/null +++ b/src/util/gnunet-qr.c | |||
@@ -0,0 +1,314 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2013-2019 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file util/gnunet-qr.c | ||
22 | * @author Hartmut Goebel (original implementation) | ||
23 | * @author Martin Schanzenbach (integrate gnunet-uri) | ||
24 | * @author Christian Grothoff (error handling) | ||
25 | */ | ||
26 | #include <stdio.h> | ||
27 | #include <zbar.h> | ||
28 | #include <stdbool.h> | ||
29 | #include "platform.h" | ||
30 | #include "gnunet_util_lib.h" | ||
31 | |||
32 | #define LOG(fmt, ...) if (verbose == true) printf(fmt, ## __VA_ARGS__) | ||
33 | |||
34 | /** | ||
35 | * Video device to capture from. Sane default for GNU/Linux systems. | ||
36 | */ | ||
37 | static char* device = "/dev/video0"; | ||
38 | |||
39 | /** | ||
40 | * --verbose option | ||
41 | */ | ||
42 | static int verbose = false; | ||
43 | |||
44 | /** | ||
45 | * --silent option | ||
46 | */ | ||
47 | static int silent = false; | ||
48 | |||
49 | /** | ||
50 | * Handler exit code | ||
51 | */ | ||
52 | static long unsigned int exit_code = 1; | ||
53 | |||
54 | /** | ||
55 | * Helper process we started. | ||
56 | */ | ||
57 | static struct GNUNET_OS_Process *p; | ||
58 | |||
59 | |||
60 | /** | ||
61 | * Pipe used to communicate child death via signal. | ||
62 | */ | ||
63 | static struct GNUNET_DISK_PipeHandle *sigpipe; | ||
64 | |||
65 | |||
66 | /** | ||
67 | * Task triggered whenever we receive a SIGCHLD (child | ||
68 | * process died) or when user presses CTRL-C. | ||
69 | * | ||
70 | * @param cls closure, NULL | ||
71 | */ | ||
72 | static void | ||
73 | maint_child_death (void *cls) | ||
74 | { | ||
75 | enum GNUNET_OS_ProcessStatusType type; | ||
76 | |||
77 | if ( (GNUNET_OK != | ||
78 | GNUNET_OS_process_status (p, &type, &exit_code)) || | ||
79 | (type != GNUNET_OS_PROCESS_EXITED) ) | ||
80 | GNUNET_break (0 == GNUNET_OS_process_kill (p, GNUNET_TERM_SIG)); | ||
81 | GNUNET_OS_process_destroy (p); | ||
82 | } | ||
83 | |||
84 | |||
85 | /** | ||
86 | * Dispatch URIs to the appropriate GNUnet helper process | ||
87 | * | ||
88 | * @param cls closure | ||
89 | * @param uri uri to dispatch | ||
90 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
91 | * @param cfg configuration | ||
92 | */ | ||
93 | static void | ||
94 | gnunet_uri (void *cls, | ||
95 | const char *uri, | ||
96 | const char *cfgfile, | ||
97 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
98 | { | ||
99 | const char *orig_uri; | ||
100 | const char *slash; | ||
101 | char *subsystem; | ||
102 | char *program; | ||
103 | struct GNUNET_SCHEDULER_Task * rt; | ||
104 | |||
105 | orig_uri = uri; | ||
106 | if (0 != strncasecmp ("gnunet://", uri, strlen ("gnunet://"))) { | ||
107 | fprintf (stderr, | ||
108 | _("Invalid URI: does not start with `%s'\n"), | ||
109 | "gnunet://"); | ||
110 | return; | ||
111 | } | ||
112 | uri += strlen ("gnunet://"); | ||
113 | if (NULL == (slash = strchr (uri, '/'))) | ||
114 | { | ||
115 | fprintf (stderr, | ||
116 | _("Invalid URI: fails to specify subsystem\n")); | ||
117 | return; | ||
118 | } | ||
119 | subsystem = GNUNET_strndup (uri, slash - uri); | ||
120 | if (GNUNET_OK != | ||
121 | GNUNET_CONFIGURATION_get_value_string (cfg, | ||
122 | "uri", | ||
123 | subsystem, | ||
124 | &program)) | ||
125 | { | ||
126 | fprintf (stderr, | ||
127 | _("No handler known for subsystem `%s'\n"), | ||
128 | subsystem); | ||
129 | GNUNET_free (subsystem); | ||
130 | return; | ||
131 | } | ||
132 | GNUNET_free (subsystem); | ||
133 | rt = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
134 | GNUNET_DISK_pipe_handle (sigpipe, | ||
135 | GNUNET_DISK_PIPE_END_READ), | ||
136 | &maint_child_death, NULL); | ||
137 | p = GNUNET_OS_start_process (GNUNET_NO, 0, | ||
138 | NULL, NULL, NULL, | ||
139 | program, | ||
140 | program, | ||
141 | orig_uri, | ||
142 | NULL); | ||
143 | GNUNET_free (program); | ||
144 | if (NULL == p) | ||
145 | GNUNET_SCHEDULER_cancel (rt); | ||
146 | } | ||
147 | |||
148 | |||
149 | /** | ||
150 | * Obtain QR code 'symbol' from @a proc. | ||
151 | * | ||
152 | * @param proc zbar processor to use | ||
153 | * @return NULL on error | ||
154 | */ | ||
155 | static const zbar_symbol_t * | ||
156 | get_symbol (zbar_processor_t *proc) | ||
157 | { | ||
158 | const zbar_symbol_set_t* symbols; | ||
159 | int rc; | ||
160 | int n; | ||
161 | |||
162 | if (0 != | ||
163 | zbar_processor_parse_config (proc, "enable")) | ||
164 | { | ||
165 | GNUNET_break (0); | ||
166 | return NULL; | ||
167 | } | ||
168 | |||
169 | /* initialize the Processor */ | ||
170 | if (0 != | ||
171 | (rc = zbar_processor_init(proc, device, 1))) | ||
172 | { | ||
173 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
174 | "Failed to open device `%s': %d\n", | ||
175 | device, | ||
176 | rc); | ||
177 | return NULL; | ||
178 | } | ||
179 | |||
180 | /* enable the preview window */ | ||
181 | if ( (0 != (rc = zbar_processor_set_visible (proc, 1))) || | ||
182 | (0 != (rc = zbar_processor_set_active(proc, 1))) ) | ||
183 | { | ||
184 | GNUNET_break (0); | ||
185 | return NULL; | ||
186 | } | ||
187 | |||
188 | /* read at least one barcode (or until window closed) */ | ||
189 | LOG ("Capturing\n"); | ||
190 | n = zbar_process_one (proc, -1); | ||
191 | |||
192 | /* hide the preview window */ | ||
193 | (void) zbar_processor_set_active (proc, 0); | ||
194 | (void) zbar_processor_set_visible (proc, 0); | ||
195 | if (-1 == n) | ||
196 | return NULL; /* likely user closed the window */ | ||
197 | LOG ("Got %i images\n", | ||
198 | n); | ||
199 | /* extract results */ | ||
200 | symbols = zbar_processor_get_results (proc); | ||
201 | if (NULL == symbols) | ||
202 | { | ||
203 | GNUNET_break (0); | ||
204 | return NULL; | ||
205 | } | ||
206 | return zbar_symbol_set_first_symbol (symbols); | ||
207 | } | ||
208 | |||
209 | |||
210 | /** | ||
211 | * Run zbar QR code parser. | ||
212 | * | ||
213 | * @return NULL on error, otherwise the URI that we found | ||
214 | */ | ||
215 | static char * | ||
216 | run_zbar () | ||
217 | { | ||
218 | zbar_processor_t *proc; | ||
219 | const char *data; | ||
220 | char *ret; | ||
221 | const zbar_symbol_t* symbol; | ||
222 | |||
223 | /* configure the Processor */ | ||
224 | proc = zbar_processor_create (1); | ||
225 | if (NULL == proc) | ||
226 | { | ||
227 | GNUNET_break (0); | ||
228 | return NULL; | ||
229 | } | ||
230 | |||
231 | symbol = get_symbol (proc); | ||
232 | if (NULL == symbol) | ||
233 | { | ||
234 | zbar_processor_destroy (proc); | ||
235 | return NULL; | ||
236 | } | ||
237 | data = zbar_symbol_get_data (symbol); | ||
238 | if (NULL == data) | ||
239 | { | ||
240 | GNUNET_break (0); | ||
241 | zbar_processor_destroy (proc); | ||
242 | return NULL; | ||
243 | } | ||
244 | LOG ("Found %s \"%s\"\n", | ||
245 | zbar_get_symbol_name (zbar_symbol_get_type(symbol)), | ||
246 | data); | ||
247 | ret = GNUNET_strdup (data); | ||
248 | /* clean up */ | ||
249 | zbar_processor_destroy(proc); | ||
250 | return ret; | ||
251 | } | ||
252 | |||
253 | |||
254 | /** | ||
255 | * Main function that will be run by the scheduler. | ||
256 | * | ||
257 | * @param cls closure | ||
258 | * @param args remaining command-line arguments | ||
259 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
260 | * @param cfg configuration | ||
261 | */ | ||
262 | static void | ||
263 | run (void *cls, | ||
264 | char *const *args, | ||
265 | const char *cfgfile, | ||
266 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
267 | { | ||
268 | char *data; | ||
269 | |||
270 | data = run_zbar (); | ||
271 | if (NULL == data) | ||
272 | return; | ||
273 | gnunet_uri (cls, | ||
274 | data, | ||
275 | cfgfile, | ||
276 | cfg); | ||
277 | if (exit_code != 0) | ||
278 | { | ||
279 | printf ("Failed to add URI %s\n", | ||
280 | data); | ||
281 | } | ||
282 | else | ||
283 | { | ||
284 | printf ("Added URI %s\n", | ||
285 | data); | ||
286 | } | ||
287 | GNUNET_free (data); | ||
288 | }; | ||
289 | |||
290 | |||
291 | int | ||
292 | main (int argc, char *const *argv) | ||
293 | { | ||
294 | int ret; | ||
295 | struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
296 | GNUNET_GETOPT_option_string ('d', "device", "DEVICE", | ||
297 | gettext_noop ("use video-device DEVICE (default: /dev/video0"), | ||
298 | &device), | ||
299 | GNUNET_GETOPT_option_flag ('\0', "verbose", | ||
300 | gettext_noop ("be verbose"), | ||
301 | &verbose), | ||
302 | GNUNET_GETOPT_option_flag ('s', "silent", | ||
303 | gettext_noop ("do not show preview windows"), | ||
304 | &silent), | ||
305 | GNUNET_GETOPT_OPTION_END | ||
306 | }; | ||
307 | |||
308 | ret = GNUNET_PROGRAM_run (argc, | ||
309 | argv, | ||
310 | "gnunet-qr", | ||
311 | gettext_noop ("Scan a QR code using a video device and import the uri read"), | ||
312 | options, &run, NULL); | ||
313 | return ((GNUNET_OK == ret) && (0 == exit_code)) ? 0 : 1; | ||
314 | } | ||
diff --git a/src/util/gnunet-qr.in b/src/util/gnunet-qr.in deleted file mode 100755 index ce7a19b69..000000000 --- a/src/util/gnunet-qr.in +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # From curl's buildconf, making this script subject to the | ||
4 | # curl license: https://curl.haxx.se/docs/copyright.html | ||
5 | # Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. | ||
6 | # Copyright (C) 2019 GNUnet e.V. | ||
7 | |||
8 | # findtool works like which without relying on which (which is a problem | ||
9 | # for some limited shells. | ||
10 | findtool(){ | ||
11 | file="$1" | ||
12 | |||
13 | if { echo "$file" | grep "/" >/dev/null 2>&1; } then | ||
14 | # when file is given with a path check it first | ||
15 | if test -f "$file"; then | ||
16 | echo "$file" | ||
17 | return | ||
18 | fi | ||
19 | fi | ||
20 | |||
21 | old_IFS=$IFS; IFS=':' | ||
22 | for path in $PATH | ||
23 | do | ||
24 | IFS=$old_IFS | ||
25 | # echo "checks for $file in $path" >&2 | ||
26 | if test "$path" -a "$path" != '.' -a -f "$path/$file"; then | ||
27 | echo "$path/$file" | ||
28 | return | ||
29 | fi | ||
30 | done | ||
31 | IFS=$old_IFS | ||
32 | } | ||
33 | |||
34 | # end curl licensed code | ||
35 | pythonize=`findtool python2.7 2>/dev/null` | ||
36 | if test ! -x "$pythonize"; then | ||
37 | pythonize=`findtool ${PYTHON2:-python2.7}` | ||
38 | fi | ||
39 | |||
40 | if test -z "$pythonize"; then | ||
41 | echo "ERROR: python2.7 not found." | ||
42 | echo " You need python2.7 installed." | ||
43 | exit 1 | ||
44 | fi | ||
45 | |||
46 | ${pythonize} @PREFIX@/share/gnunet/gnunet-qr.py $@ | ||
diff --git a/src/util/gnunet-qr.py b/src/util/gnunet-qr.py deleted file mode 100644 index 0ee0b9507..000000000 --- a/src/util/gnunet-qr.py +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | import sys | ||
2 | import getopt | ||
3 | import subprocess | ||
4 | from sys import argv | ||
5 | try: | ||
6 | import zbar | ||
7 | except ImportError as e: | ||
8 | print('Cannot run gnunet-qr, please install the zbar module.') | ||
9 | print('For Debian, you can obtain it as "python-zbar".') | ||
10 | print('Upstream: http://zbar.sourceforge.net/') | ||
11 | sys.exit(1) | ||
12 | |||
13 | |||
14 | def help(): | ||
15 | print('gnunet-qr\n\ | ||
16 | Scan a QR code using a video device and import\n\ | ||
17 | Arguments mandatory for long options are also mandatory for short options.\n\ | ||
18 | -c, --config FILENAME use configuration file FILENAME\n\ | ||
19 | -d, --device DEVICE use device DEVICE\n\ | ||
20 | -s, --silent do not show preview windows\n\ | ||
21 | -h, --help print this help\n\ | ||
22 | -v, --verbose be verbose\n\ | ||
23 | Report bugs to gnunet-developers@gnu.org.\n\ | ||
24 | GNUnet home page: https://gnunet.org/\n\ | ||
25 | General help using GNU software: https://www.gnu.org/gethelp/') | ||
26 | |||
27 | |||
28 | if __name__ == '__main__': | ||
29 | configuration = '' | ||
30 | device = '/dev/video0' | ||
31 | url = '' | ||
32 | verbose = False | ||
33 | silent = False | ||
34 | # Parse arguments | ||
35 | try: | ||
36 | opts, args = getopt.gnu_getopt(sys.argv[1:], "c:hd:sv", ["config", "help", "device", "silent", "verbose"]) | ||
37 | except getopt.GetoptError as e: | ||
38 | help() | ||
39 | print(str(e)) | ||
40 | exit(1) | ||
41 | for o, a in opts: | ||
42 | if o in ("-h", "--help"): | ||
43 | help() | ||
44 | sys.exit(0) | ||
45 | elif o in ("-c", "--config"): | ||
46 | configuration = a | ||
47 | elif o in ("-d", "--device"): | ||
48 | device = a | ||
49 | elif o in ("-s", "--silent"): | ||
50 | silent = True | ||
51 | elif o in ("-v", "--verbose"): | ||
52 | verbose = True | ||
53 | if (True == verbose): | ||
54 | print('Initializing') | ||
55 | # create a Processor | ||
56 | proc = zbar.Processor() | ||
57 | |||
58 | # configure the Processor | ||
59 | proc.parse_config('enable') | ||
60 | |||
61 | # initialize the Processor | ||
62 | try: | ||
63 | if (True == verbose): | ||
64 | print('Opening video device ' + device) | ||
65 | proc.init(device) | ||
66 | except Exception as e: | ||
67 | print('Failed to open device ' + device) | ||
68 | exit(1) | ||
69 | |||
70 | # enable the preview window | ||
71 | # if (True == silent): | ||
72 | # proc.visible = True | ||
73 | # else: | ||
74 | # proc.visible = False | ||
75 | |||
76 | proc.visible = True | ||
77 | # read at least one barcode (or until window closed) | ||
78 | try: | ||
79 | if (True == verbose): | ||
80 | print('Capturing') | ||
81 | proc.process_one() | ||
82 | except Exception as e: | ||
83 | # Window was closed without finding code | ||
84 | exit(1) | ||
85 | |||
86 | # hide the preview window | ||
87 | proc.visible = False | ||
88 | |||
89 | # extract results | ||
90 | for symbol in proc.results: | ||
91 | # do something useful with results | ||
92 | if (True == verbose): | ||
93 | print('Found ', symbol.type, ' symbol ', '"%s"' % symbol.data) | ||
94 | args = list() | ||
95 | args.append("gnunet-uri") | ||
96 | if (configuration != ''): | ||
97 | args.append(str("-c " + str(configuration))) | ||
98 | args.append(str(symbol.data)) | ||
99 | cmd = '' | ||
100 | for a in args: | ||
101 | cmd += " " + str(a) | ||
102 | if (verbose): | ||
103 | print('Running `' + cmd +'`') | ||
104 | res = subprocess.call(args) | ||
105 | if (0 != res): | ||
106 | print('Failed to add URI ' + str(symbol.data)) | ||
107 | else: | ||
108 | print('Added URI ' + str(symbol.data)) | ||
109 | exit(res) | ||
110 | exit(1) | ||