Blob Blame History Raw
From c5e8baac5bfb57c3c96f03c9534cc38002de3cca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Wed, 4 Dec 2019 15:08:12 +0100
Subject: [PATCH 074/181] cleanup: Don't make nbis depend on libfprint
 built-sources

Now that nbis is a static library it should be possible to compile it
without any fprint-built dependency, although since it included fp_internal
there was a compile-time dependency on the fp-enums that can be generated at
later times.

So:
 - Move nbis-helpers to nbis includes (and remove inclusion in fp_internal)
 - Move the Minutiae definitions inside a standalone fpi-minutiae header
 - Include fpi-minutiae.h in fp_internal.h
 - Include nbis-hepers.h and fpi-minutiae.h in nbis' lfs.h
 - Adapt missing definitions in libfprint
---
 libfprint/fp-image.c                          |  1 +
 libfprint/fp-print.c                          |  1 +
 libfprint/fp_internal.h                       | 35 ++-------------
 libfprint/fpi-minutiae.h                      | 45 +++++++++++++++++++
 libfprint/nbis/include/lfs.h                  |  3 +-
 libfprint/nbis/lfs.h.patch                    | 13 +++---
 .../libfprint-include}/nbis-helpers.h         |  0
 7 files changed, 59 insertions(+), 39 deletions(-)
 create mode 100644 libfprint/fpi-minutiae.h
 rename libfprint/{ => nbis/libfprint-include}/nbis-helpers.h (100%)

diff --git a/libfprint/fp-image.c b/libfprint/fp-image.c
index c66b010..16837a8 100644
--- a/libfprint/fp-image.c
+++ b/libfprint/fp-image.c
@@ -19,6 +19,7 @@
  */
 
 #include "fpi-image.h"
+#include "fpi-log.h"
 
 #include <nbis.h>
 
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
index ed29ec1..f724c77 100644
--- a/libfprint/fp-print.c
+++ b/libfprint/fp-print.c
@@ -20,6 +20,7 @@
 
 #include "fpi-print.h"
 #include "fpi-image.h"
+#include "fpi-log.h"
 #include "fpi-device.h"
 
 #include <nbis.h>
diff --git a/libfprint/fp_internal.h b/libfprint/fp_internal.h
index 8147089..56ada18 100644
--- a/libfprint/fp_internal.h
+++ b/libfprint/fp_internal.h
@@ -1,6 +1,6 @@
 /*
  * Internal/private definitions for libfprint
- * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
+ * Copyright (C) 2019 Marco Trevisan <marco.trevisan@canonical.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,38 +17,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef __FPRINT_INTERNAL_H__
-#define __FPRINT_INTERNAL_H__
+#pragma once
 
 #include "fpi-log.h"
-#include "nbis-helpers.h"
 #include "fpi-image.h"
 #include "fpi-image-device.h"
-
-/* fp_minutia structure definition */
-struct fp_minutia
-{
-  int    x;
-  int    y;
-  int    ex;
-  int    ey;
-  int    direction;
-  double reliability;
-  int    type;
-  int    appearing;
-  int    feature_id;
-  int   *nbrs;
-  int   *ridge_counts;
-  int    num_nbrs;
-};
-
-/* fp_minutiae structure definition */
-struct fp_minutiae
-{
-  int                 alloc;
-  int                 num;
-  struct fp_minutia **list;
-};
-
-
-#endif
+#include "fpi-minutiae.h"
diff --git a/libfprint/fpi-minutiae.h b/libfprint/fpi-minutiae.h
new file mode 100644
index 0000000..24dc761
--- /dev/null
+++ b/libfprint/fpi-minutiae.h
@@ -0,0 +1,45 @@
+/*
+ * Internal/private definitions for libfprint
+ * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#pragma once
+
+/* fp_minutia structure definition */
+struct fp_minutia
+{
+  int    x;
+  int    y;
+  int    ex;
+  int    ey;
+  int    direction;
+  double reliability;
+  int    type;
+  int    appearing;
+  int    feature_id;
+  int   *nbrs;
+  int   *ridge_counts;
+  int    num_nbrs;
+};
+
+/* fp_minutiae structure definition */
+struct fp_minutiae
+{
+  int                 alloc;
+  int                 num;
+  struct fp_minutia **list;
+};
diff --git a/libfprint/nbis/include/lfs.h b/libfprint/nbis/include/lfs.h
index ae7aee5..f4f38d7 100644
--- a/libfprint/nbis/include/lfs.h
+++ b/libfprint/nbis/include/lfs.h
@@ -66,7 +66,8 @@ of the software.
 
 #include <math.h>
 #include <stdio.h>
-#include <fp_internal.h>
+#include <nbis-helpers.h>
+#include <fpi-minutiae.h>
 
 /*************************************************************************/
 /*        OUTPUT FILE EXTENSIONS                                         */
diff --git a/libfprint/nbis/lfs.h.patch b/libfprint/nbis/lfs.h.patch
index 2be6ebf..3342bc5 100644
--- a/libfprint/nbis/lfs.h.patch
+++ b/libfprint/nbis/lfs.h.patch
@@ -1,15 +1,16 @@
---- include/lfs.h	2018-08-24 15:31:54.535579623 +0200
-+++ include/lfs.h.orig	2018-08-24 15:31:48.781587933 +0200
-@@ -66,7 +43,7 @@ of the software.
+--- include/lfs.h
++++ include/lfs.h
+@@ -66,7 +66,8 @@ of the software.
  
  #include <math.h>
  #include <stdio.h>
 -#include <an2k.h>  /* Needed by to_type9.c */
-+#include <fp_internal.h>
++#include <nbis-helpers.h>
++#include <fpi-minutiae.h>
  
  /*************************************************************************/
  /*        OUTPUT FILE EXTENSIONS                                         */
-@@ -154,26 +131,8 @@ typedef struct rotgrids{
+@@ -154,26 +155,8 @@ typedef struct rotgrids{
  #define DISAPPEARING    0
  #define APPEARING       1
  
@@ -38,7 +39,7 @@
  
  typedef struct feature_pattern{
     int type;
-@@ -1185,17 +1185,6 @@ extern void bubble_sort_double_inc_2(double *, int *, const int);
+@@ -1203,17 +1186,6 @@ extern void bubble_sort_double_inc_2(double *, int *, const int);
  extern void bubble_sort_double_dec_2(double *, int *,  const int);
  extern void bubble_sort_int_inc(int *, const int);
  
diff --git a/libfprint/nbis-helpers.h b/libfprint/nbis/libfprint-include/nbis-helpers.h
similarity index 100%
rename from libfprint/nbis-helpers.h
rename to libfprint/nbis/libfprint-include/nbis-helpers.h
-- 
2.24.1