diff options
Diffstat (limited to 'meta/recipes-support/libgpg-error/libgpg-error/0005-src-gen-lock-obj.sh-add-a-file.patch')
-rw-r--r-- | meta/recipes-support/libgpg-error/libgpg-error/0005-src-gen-lock-obj.sh-add-a-file.patch | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/meta/recipes-support/libgpg-error/libgpg-error/0005-src-gen-lock-obj.sh-add-a-file.patch b/meta/recipes-support/libgpg-error/libgpg-error/0005-src-gen-lock-obj.sh-add-a-file.patch new file mode 100644 index 0000000000..e6f6c09bac --- /dev/null +++ b/meta/recipes-support/libgpg-error/libgpg-error/0005-src-gen-lock-obj.sh-add-a-file.patch | |||
@@ -0,0 +1,134 @@ | |||
1 | From fcb414abb62223e66dba413d0ca86eab3ea5bbc3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Sun, 21 Jun 2020 13:54:47 +0000 | ||
4 | Subject: [PATCH] src-gen-lock-obj.sh: add a file | ||
5 | |||
6 | This is erroneously missing from the tarball; it will show | ||
7 | up in the next release tarball, as upstream has fixed the | ||
8 | packaging in master. | ||
9 | |||
10 | Upstream-Status: Inappropriate | ||
11 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
12 | --- | ||
13 | src/gen-lock-obj.sh | 112 ++++++++++++++++++++++++++++++++++++++++++++ | ||
14 | 1 file changed, 112 insertions(+) | ||
15 | create mode 100755 src/gen-lock-obj.sh | ||
16 | |||
17 | diff --git a/src/gen-lock-obj.sh b/src/gen-lock-obj.sh | ||
18 | new file mode 100755 | ||
19 | index 0000000..13858cf | ||
20 | --- /dev/null | ||
21 | +++ b/src/gen-lock-obj.sh | ||
22 | @@ -0,0 +1,112 @@ | ||
23 | +#! /bin/sh | ||
24 | +# | ||
25 | +# gen-lock-obj.sh - Build tool to construct the lock object. | ||
26 | +# | ||
27 | +# Copyright (C) 2020 g10 Code GmbH | ||
28 | +# | ||
29 | +# This file is part of libgpg-error. | ||
30 | +# | ||
31 | +# libgpg-error is free software; you can redistribute it and/or | ||
32 | +# modify it under the terms of the GNU Lesser General Public License | ||
33 | +# as published by the Free Software Foundation; either version 2.1 of | ||
34 | +# the License, or (at your option) any later version. | ||
35 | +# | ||
36 | +# libgpg-error is distributed in the hope that it will be useful, but | ||
37 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
38 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
39 | +# Lesser General Public License for more details. | ||
40 | +# | ||
41 | +# You should have received a copy of the GNU Lesser General Public | ||
42 | +# License along with this program; if not, see <https://www.gnu.org/licenses/>. | ||
43 | +# | ||
44 | + | ||
45 | +# | ||
46 | +# Following variables should be defined to invoke this script | ||
47 | +# | ||
48 | +# CC | ||
49 | +# OBJDUMP | ||
50 | +# AWK | ||
51 | +# ac_ext | ||
52 | +# ac_object | ||
53 | +# host | ||
54 | +# LOCK_ABI_VERSION | ||
55 | +# | ||
56 | +# An example: | ||
57 | +# | ||
58 | +# LOCK_ABI_VERSION=1 host=x86_64-pc-linux-gnu host_alias=x86_64-linux-gnu \ | ||
59 | +# CC=$host_alias-gcc OBJDUMP=$host_alias-objdump ac_ext=c ac_objext=o \ | ||
60 | +# AWK=gawk ./gen-lock-obj.sh | ||
61 | +# | ||
62 | + | ||
63 | +AWK_VERSION_OUTPUT=$($AWK 'BEGIN { print PROCINFO["version"] }') | ||
64 | +if test -n "$AWK_VERSION_OUTPUT"; then | ||
65 | + # It's GNU awk, which supports PROCINFO. | ||
66 | + AWK_OPTION=--non-decimal-data | ||
67 | +fi | ||
68 | + | ||
69 | +cat <<'EOF' >conftest.$ac_ext | ||
70 | +#include <pthread.h> | ||
71 | +pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; | ||
72 | +EOF | ||
73 | + | ||
74 | +if $CC -c conftest.$ac_ext; then : | ||
75 | + ac_mtx_size=$($OBJDUMP -j .bss -t conftest.$ac_objext \ | ||
76 | + | $AWK $AWK_OPTION ' | ||
77 | +/mtx$/ { mtx_size = int("0x" $5) } | ||
78 | +END { print mtx_size }') | ||
79 | +else | ||
80 | + echo "Can't determine mutex size" | ||
81 | + exit 1 | ||
82 | +fi | ||
83 | +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
84 | + | ||
85 | +cat <<EOF | ||
86 | +## lock-obj-pub.$host.h | ||
87 | +## File created by gen-lock-obj.sh - DO NOT EDIT | ||
88 | +## To be included by mkheader into gpg-error.h | ||
89 | + | ||
90 | +typedef struct | ||
91 | +{ | ||
92 | + long _vers; | ||
93 | + union { | ||
94 | + volatile char _priv[$ac_mtx_size]; | ||
95 | + long _x_align; | ||
96 | + long *_xp_align; | ||
97 | + } u; | ||
98 | +} gpgrt_lock_t; | ||
99 | + | ||
100 | +EOF | ||
101 | + | ||
102 | +# FIXME: Support different alignment conditions of: | ||
103 | +# | ||
104 | +# USE_16BYTE_ALIGNMENT | ||
105 | +# USE_DOUBLE_FOR_ALIGNMENT | ||
106 | +# USE_LONG_DOUBLE_FOR_ALIGNMENT | ||
107 | +# | ||
108 | + | ||
109 | +echo -n "#define GPGRT_LOCK_INITIALIZER {$LOCK_ABI_VERSION,{{" | ||
110 | + | ||
111 | +i=0 | ||
112 | +while test "$i" -lt $ac_mtx_size; do | ||
113 | + if test "$i" -ne 0 -a "$(( $i % 8 ))" -eq 0; then | ||
114 | + echo ' \' | ||
115 | + echo -n " " | ||
116 | + fi | ||
117 | + echo -n '0' | ||
118 | + if test "$i" -lt $(($ac_mtx_size - 1)); then | ||
119 | + echo -n ',' | ||
120 | + fi | ||
121 | + i=$(( i + 1 )) | ||
122 | +done | ||
123 | + | ||
124 | +cat <<'EOF' | ||
125 | +}}} | ||
126 | +## | ||
127 | +## Local Variables: | ||
128 | +## mode: c | ||
129 | +## buffer-read-only: t | ||
130 | +## End: | ||
131 | +## | ||
132 | +EOF | ||
133 | + | ||
134 | +exit 0 | ||