Initial import (#1715296).

This commit is contained in:
Elliott Sales de Andrade 2019-06-10 15:55:25 -04:00
parent 2f17097fb6
commit 4f8a6744c5
5 changed files with 213 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/libinsane-1.0.tar.gz

View File

@ -0,0 +1,32 @@
From 038a7856695cea40c0ec02075fbbb427a64d6d43 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Wed, 29 May 2019 04:47:32 -0400
Subject: [PATCH 1/2] Fix reading bits-per-pixel from BMP header.
This seem to work on little-endian machines since the following data was
apparently zeros, but doesn't work on big-endian machines.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
subprojects/libinsane/src/bmp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/subprojects/libinsane/src/bmp.c b/subprojects/libinsane/src/bmp.c
index 5841d6f..886a368 100644
--- a/subprojects/libinsane/src/bmp.c
+++ b/subprojects/libinsane/src/bmp.c
@@ -67,9 +67,9 @@ enum lis_error lis_bmp2scan_params(
);
return LIS_ERR_INTERNAL_IMG_FORMAT_NOT_SUPPORTED;
}
- if (le32toh(header->nb_bits_per_pixel) != 24) {
+ if (le16toh(header->nb_bits_per_pixel) != 24) {
lis_log_error("BMP: Unexpected nb bits per pixel: %u (0x%X)",
- le32toh(header->nb_bits_per_pixel),
+ le16toh(header->nb_bits_per_pixel),
header->nb_bits_per_pixel);
return LIS_ERR_INTERNAL_IMG_FORMAT_NOT_SUPPORTED;
}
--
2.21.0

View File

@ -0,0 +1,53 @@
From 5ed21edab66dbfb50366d32a50f384ecf66918ad Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Wed, 29 May 2019 21:18:00 -0400
Subject: [PATCH 2/2] Fix broken tests using incorrect types.
These tests were using the wrong type for the given options.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
subprojects/libinsane/tests/tests_workaround_cache.c | 4 ++--
.../libinsane/tests/tests_workaround_check_capabilities.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/subprojects/libinsane/tests/tests_workaround_cache.c b/subprojects/libinsane/tests/tests_workaround_cache.c
index 78def74..7650243 100644
--- a/subprojects/libinsane/tests/tests_workaround_cache.c
+++ b/subprojects/libinsane/tests/tests_workaround_cache.c
@@ -279,7 +279,7 @@ static void test_cache_set_value_2(void)
LIS_ASSERT_EQUAL(lis_dumb_get_nb_get(g_dumb), 1);
LIS_ASSERT_EQUAL(lis_dumb_get_nb_set(g_dumb), 0);
- value.string = OPT_VALUE_SOURCE_ADF;
+ value.integer = 240;
err = opts[1]->fn.set_value(opts[1], value, &set_flags);
LIS_ASSERT_TRUE(LIS_IS_OK(err));
LIS_ASSERT_EQUAL(
@@ -293,7 +293,7 @@ static void test_cache_set_value_2(void)
// since we got flag 'reload_options', this get_value() will go through
err = opts[1]->fn.get_value(opts[1], &value);
LIS_ASSERT_TRUE(LIS_IS_OK(err));
- LIS_ASSERT_EQUAL(strcmp(value.string, OPT_VALUE_SOURCE_ADF), 0);
+ LIS_ASSERT_EQUAL(value.integer, 240);
LIS_ASSERT_EQUAL(lis_dumb_get_nb_get(g_dumb), 3);
LIS_ASSERT_EQUAL(lis_dumb_get_nb_set(g_dumb), 1);
diff --git a/subprojects/libinsane/tests/tests_workaround_check_capabilities.c b/subprojects/libinsane/tests/tests_workaround_check_capabilities.c
index d055e94..2abdb25 100644
--- a/subprojects/libinsane/tests/tests_workaround_check_capabilities.c
+++ b/subprojects/libinsane/tests/tests_workaround_check_capabilities.c
@@ -73,8 +73,8 @@ static int tests_init(void)
.desc = "source desc",
.capabilities = LIS_CAP_SW_SELECT,
.value = {
- .type = LIS_TYPE_INTEGER,
- .unit = LIS_UNIT_DPI,
+ .type = LIS_TYPE_STRING,
+ .unit = LIS_UNIT_NONE,
},
.constraint = {
.type = LIS_CONSTRAINT_LIST,
--
2.21.0

126
libinsane.spec Normal file
View File

@ -0,0 +1,126 @@
Name: libinsane
Version: 1.0
Release: 1%{?dist}
Summary: Cross-platform access to image scanners
License: LGPLv3+
URL: https://doc.openpaper.work/libinsane/latest/
Source0: https://gitlab.gnome.org/World/OpenPaperwork/%{name}/-/archive/%{version}/%{name}-%{version}.tar.gz
# https://gitlab.gnome.org/World/OpenPaperwork/libinsane/merge_requests/31
Patch0001: 0001-Fix-reading-bits-per-pixel-from-BMP-header.patch
# https://gitlab.gnome.org/World/OpenPaperwork/libinsane/merge_requests/33
Patch0002: 0002-Fix-broken-tests-using-incorrect-types.patch
BuildRequires: meson
BuildRequires: gcc
BuildRequires: pkgconfig(sane-backends)
BuildRequires: doxygen
BuildRequires: pkgconfig(cunit)
BuildRequires: valgrind
%description
Libinsane is the library to access scanners on both Linux and Windows. It's
cross-platform, cross-programming languages, cross-scanners :-). It takes care
of all the quirks of all the platforms and scanners.
%package devel
Summary: Development files for libinsane
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Development libraries and header files for libinsane.
%package gobject
Summary: GObject access to image scanners
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: gobject-introspection-devel
BuildRequires: gtk-doc
Requires: %{name}%{?_isa} = %{version}-%{release}
%description gobject
Libinsane is the library to access scanners on both Linux and Windows. It's
cross-platform, cross-programming languages, cross-scanners :-). It takes care
of all the quirks of all the platforms and scanners.
This package provides GObject wrappers around the main library.
%package gobject-devel
Summary: Development files for libinsane-gobject
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
Requires: %{name}-gobject%{?_isa} = %{version}-%{release}
%description gobject-devel
Development libraries and header files for libinsane-gobject.
%package vala
Summary: Vala bindings for libinsane
BuildArch: noarch
BuildRequires: vala
Requires: %{name}-gobject-devel = %{version}-%{release}
%description vala
Vala bindings for libinsane.
%prep
%autosetup -p1
%build
%meson
%meson_build
%meson_build subprojects/libinsane/doc/doc_out
%install
%meson_install
%check
meson test -v -t 5 -C %{_vpath_builddir}
%files
%doc README.markdown ChangeLog
%license LICENSE
%{_libdir}/%{name}.so.1
%{_libdir}/%{name}.so.1.*
%files devel
%doc doc
%{_includedir}/%{name}
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%files gobject
%{_libdir}/%{name}_gobject.so.1
%{_libdir}/%{name}_gobject.so.1.*
%dir %{_libdir}/girepository-1.0
%{_libdir}/girepository-1.0/Libinsane-1.0.typelib
%files gobject-devel
%{_includedir}/%{name}-gobject
%{_libdir}/%{name}_gobject.so
%dir %{_datadir}/gir-1.0
%{_datadir}/gir-1.0/Libinsane-1.0.gir
%{_datadir}/gtk-doc
%files vala
%{_datadir}/vala/vapi/%{name}.deps
%{_datadir}/vala/vapi/%{name}.vapi
%changelog
* Thu Mar 21 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.0-1
- Initial release

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (libinsane-1.0.tar.gz) = 65bfbcd1f004b7217b624df0ef0630c36faa1e2dad9be8bd9fef32427224d5290e16811bdd75c268e0b212fbe6674020fd5293ddf659e167ca8651bd8fc8ab2f