From 30528bf58036bfe9c4f17995ebec29501b062962 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Fri, 18 Sep 2015 17:54:49 +0200 Subject: [PATCH] Also build a libgf-complete1-sse package, which contains the optimized version of the library. --- debian/changelog | 7 ++ debian/check_sse.c | 14 +++ debian/control | 25 ++++++ .../{patches => }/do-not-use-sse-ac-ext.patch | 0 debian/libgf-complete1-sse.symbols | 85 +++++++++++++++++++ debian/patches/series | 1 - debian/rules | 48 +++++++++++ 7 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 debian/check_sse.c rename debian/{patches => }/do-not-use-sse-ac-ext.patch (100%) create mode 100644 debian/libgf-complete1-sse.symbols delete mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index 06a3330..1e03520 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +gf-complete (1.0.2-3) unstable; urgency=medium + + * Also build a libgf-complete1-sse package, which contains the optimized + version of the library. + + -- Thomas Goirand Fri, 18 Sep 2015 17:48:52 +0200 + gf-complete (1.0.2-2) unstable; urgency=medium * Team upload. diff --git a/debian/check_sse.c b/debian/check_sse.c new file mode 100644 index 0000000..bd064fc --- /dev/null +++ b/debian/check_sse.c @@ -0,0 +1,14 @@ +#include +#include + +#include + +static inline bool can_sse41(void){ + int a, b, c, d; + __cpuid (1, a, b, c, d); + return c & bit_SSE4_1; +} + +int main(int argc, char** argv){ + return (int) can_sse41(); +} diff --git a/debian/control b/debian/control index 494e967..00e716d 100644 --- a/debian/control +++ b/debian/control @@ -37,6 +37,9 @@ Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends}, Multi-Arch: same +Breaks: libgf-complete1-sse +Replaces: libgf-complete1-sse +Provides: libgf-complete1-sse Description: Galois Field Arithmetic - shared library Galois Field arithmetic forms the backbone of erasure-coded storage systems, most famously the Reed-Solomon erasure code. A Galois Field is defined over @@ -50,6 +53,28 @@ Description: Galois Field Arithmetic - shared library . This package contains the shared library. +Package: libgf-complete1-sse +Architecture: amd64 +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Multi-Arch: same +Breaks: libgf-complete1 +Replaces: libgf-complete1 +Provides: libgf-complete1 +Description: Galois Field Arithmetic - shared library with SSE support + Galois Field arithmetic forms the backbone of erasure-coded storage systems, + most famously the Reed-Solomon erasure code. A Galois Field is defined over + w-bit words and is termed GF(2w). As such, the elements of a Galois Field are + the integers 0, 1, . . ., 2^w − 1. Galois Field arithmetic defines addition + and multiplication over these closed sets of integers in such a way that they + work as you would hope they would work. Specifically, every number has a + unique multiplicative inverse. Moreover, there is a value, typically the value + 2, which has the property that you can enumerate all of the non-zero elements + of the field by taking that value to successively higher powers. + . + This package contains the shared library, compiled with the SSE instructions + support for better optimization. + Package: gf-complete-tools Architecture: any Depends: libgf-complete1 (= ${binary:Version}), diff --git a/debian/patches/do-not-use-sse-ac-ext.patch b/debian/do-not-use-sse-ac-ext.patch similarity index 100% rename from debian/patches/do-not-use-sse-ac-ext.patch rename to debian/do-not-use-sse-ac-ext.patch diff --git a/debian/libgf-complete1-sse.symbols b/debian/libgf-complete1-sse.symbols new file mode 100644 index 0000000..813176a --- /dev/null +++ b/debian/libgf-complete1-sse.symbols @@ -0,0 +1,85 @@ +libgf_complete.so.1 libgf-complete1 #MINVER# + MOA_Fill_Random_Region@Base 1.0.2 + MOA_Random_128@Base 1.0.2 + MOA_Random_32@Base 1.0.2 + MOA_Random_64@Base 1.0.2 + MOA_Random_W@Base 1.0.2 + MOA_Seed@Base 1.0.2 + _gf_errno@Base 1.0.2 + bits@Base 1.0.2 + bits_56@Base 1.0.2 + create_gf_from_argv@Base 1.0.2 + gf_alignment_error@Base 1.0.2 + gf_bitmatrix_inverse@Base 1.0.2 + gf_composite_get_default_poly@Base 1.0.2 + gf_do_final_region_alignment@Base 1.0.2 + gf_do_initial_region_alignment@Base 1.0.2 + gf_error@Base 1.0.2 + gf_error_check@Base 1.0.2 + gf_free@Base 1.0.2 + gf_general_add@Base 1.0.2 + gf_general_are_equal@Base 1.0.2 + gf_general_divide@Base 1.0.2 + gf_general_do_region_check@Base 1.0.2 + gf_general_do_region_multiply@Base 1.0.2 + gf_general_do_single_timing_test@Base 1.0.2 + gf_general_inverse@Base 1.0.2 + gf_general_is_one@Base 1.0.2 + gf_general_is_zero@Base 1.0.2 + gf_general_multiply@Base 1.0.2 + gf_general_s_to_val@Base 1.0.2 + gf_general_set_one@Base 1.0.2 + gf_general_set_random@Base 1.0.2 + gf_general_set_two@Base 1.0.2 + gf_general_set_up_single_timing_test@Base 1.0.2 + gf_general_set_zero@Base 1.0.2 + gf_general_val_to_s@Base 1.0.2 + gf_init_easy@Base 1.0.2 + gf_init_hard@Base 1.0.2 + gf_multby_one@Base 1.0.2 + gf_multby_zero@Base 1.0.2 + gf_scratch_size@Base 1.0.2 + gf_set_region_data@Base 1.0.2 + gf_size@Base 1.0.2 + gf_two_byte_region_table_multiply@Base 1.0.2 + gf_w128_bytwo_b_multiply@Base 1.0.2 + gf_w128_bytwo_b_multiply_region@Base 1.0.2 + gf_w128_bytwo_p_multiply@Base 1.0.2 + gf_w128_clm_multiply@Base 1.0.2 + gf_w128_divide_from_inverse@Base 1.0.2 + gf_w128_euclid@Base 1.0.2 + gf_w128_extract_word@Base 1.0.2 + gf_w128_group_multiply@Base 1.0.2 + gf_w128_init@Base 1.0.2 + gf_w128_inverse_from_divide@Base 1.0.2 + gf_w128_scratch_size@Base 1.0.2 + gf_w128_shift_multiply@Base 1.0.2 + gf_w128_sse_bytwo_b_multiply@Base 1.0.2 + gf_w128_sse_bytwo_p_multiply@Base 1.0.2 + gf_w16_get_div_alog_table@Base 1.0.2 + gf_w16_get_log_table@Base 1.0.2 + gf_w16_get_mult_alog_table@Base 1.0.2 + gf_w16_init@Base 1.0.2 + gf_w16_scratch_size@Base 1.0.2 + gf_w16_split_8_8_multiply@Base 1.0.2 + gf_w32_init@Base 1.0.2 + gf_w32_scratch_size@Base 1.0.2 + gf_w4_get_div_table@Base 1.0.2 + gf_w4_get_mult_table@Base 1.0.2 + gf_w4_init@Base 1.0.2 + gf_w4_scratch_size@Base 1.0.2 + gf_w64_bytwo_p_sse_multiply_region@Base 1.0.2 + gf_w64_clm_multiply_region@Base 1.0.2 + gf_w64_init@Base 1.0.2 + gf_w64_scratch_size@Base 1.0.2 + gf_w64_split_16_64_lazy_multiply_region@Base 1.0.2 + gf_w64_split_4_64_lazy_multiply_region@Base 1.0.2 + gf_w64_split_8_64_lazy_multiply_region@Base 1.0.2 + gf_w8_get_div_table@Base 1.0.2 + gf_w8_get_mult_table@Base 1.0.2 + gf_w8_init@Base 1.0.2 + gf_w8_scratch_size@Base 1.0.2 + gf_wgen_cauchy_region@Base 1.0.2 + gf_wgen_extract_word@Base 1.0.2 + gf_wgen_init@Base 1.0.2 + gf_wgen_scratch_size@Base 1.0.2 diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index c85ad29..0000000 --- a/debian/patches/series +++ /dev/null @@ -1 +0,0 @@ -do-not-use-sse-ac-ext.patch diff --git a/debian/rules b/debian/rules index 487dbe6..c5da048 100755 --- a/debian/rules +++ b/debian/rules @@ -1,5 +1,7 @@ #!/usr/bin/make -f +include /usr/share/dpkg/architecture.mk + UPSTREAM_GIT ?= https://bitbucket.org/jimplank/gf-complete.git DEBVERS ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p') @@ -11,8 +13,54 @@ GIT_TAG ?= $(shell echo '$(VERSION)' | sed -e 's/~/_/') %: dh $@ --with autoreconf --parallel +override_dh_autoreconf: + echo "Please don't do anything!" + +override_dh_auto_configure: + echo "Please don't do anything!" + +override_dh_auto_install: +ifeq ($(DEB_HOST_ARCH_CPU),amd64) + set -e ; set -x ; if ! [ -x debian/check_sse ] ; then \ + gcc debian/check_sse.c -o debian/check_sse ; \ + fi + set -e ; set -x ; if ./debian/check_sse ; then \ + echo "No SSE support here..." ; \ + else \ + dh_autoreconf ; \ + dh_auto_configure ; \ + dh_auto_build ; \ + dh_auto_install ; \ + dh_autoreconf_clean ; \ + mv debian/tmp debian/tmp-with-sse ; \ + fi +endif + patch -p1