Rev 20 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 20 | Rev 23 | ||
|---|---|---|---|
| 1 | #! /bin/sh |
1 | #! /bin/sh |
| 2 | ## 11_pthread_stub.dpatch by Magnus Holmgren <holmgren@debian.org> |
2 | ## 11_pthread_stub.dpatch by Magnus Holmgren <holmgren@debian.org> |
| 3 | ## |
3 | ## |
| 4 | ## DP: Add check for stubbiness of pthread_atfork(). |
4 | ## DP: Add check for stubbiness of pthread_atfork(). |
| 5 | 5 | ||
| 6 | dpatch_patch() {
|
6 | dpatch_patch() {
|
| 7 | perl -pi - src/configure <<'END_PERL' |
7 | perl -pi - src/configure <<'END_PERL' |
| 8 | $already_patched = 1 if (/^\Q#if defined(__stub_pthread_atfork)\E/); |
8 | $already_patched = 1 if (/^\Q#if defined(__stub_pthread_atfork)\E/); |
| 9 | if (/\Qpthread_atfork(0,0,0)\E/ && !$already_patched) {
|
9 | if (/\Qpthread_atfork(0,0,0)\E/ && !$already_patched) {
|
| 10 | $found = 1; print <<'EOT'; |
10 | $found = 1; print <<'EOT'; |
| 11 | #if defined(__stub_pthread_atfork) || defined(__stub___pthread_atfork) |
11 | #if defined(__stub_pthread_atfork) || defined(__stub___pthread_atfork) |
| 12 | #error pthread_atfork is just a stub |
12 | #error pthread_atfork is just a stub |
| 13 | #endif |
13 | #endif |
| 14 | EOT |
14 | EOT |
| 15 | } |
15 | } |
| 16 | END { exit !$found }
|
16 | END { exit !$found }
|
| 17 | END_PERL |
17 | END_PERL |
| 18 | } |
18 | } |
| 19 | 19 | ||
| 20 | dpatch_unpatch() {
|
20 | dpatch_unpatch() {
|
| 21 | perl -pi - src/configure <<'END_PERL' |
21 | perl -pi - src/configure <<'END_PERL' |
| 22 | if (/\Q#if defined(__stub_pthread_atfork)\E/ .. /#endif/) {
|
22 | if (/\Q#if defined(__stub_pthread_atfork)\E/ .. /#endif/) {
|
| 23 | $found = 1; $_ = ''; |
23 | $found = 1; $_ = ''; |
| 24 | } |
24 | } |
| 25 | END { exit !$found }
|
25 | END { exit !$found }
|
| 26 | END_PERL |
26 | END_PERL |
| 27 | } |
27 | } |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | DPATCH_LIB_NO_DEFAULT=1 |
30 | DPATCH_LIB_NO_DEFAULT=1 |
| 31 | 31 | ||
| 32 | . /usr/share/dpatch/dpatch.lib.sh |
32 | . /usr/share/dpatch/dpatch.lib.sh |