summaryrefslogtreecommitdiff
path: root/p11-kit/gen-pkcs11-gnu.sh
diff options
context:
space:
mode:
Diffstat (limited to 'p11-kit/gen-pkcs11-gnu.sh')
-rwxr-xr-xp11-kit/gen-pkcs11-gnu.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/p11-kit/gen-pkcs11-gnu.sh b/p11-kit/gen-pkcs11-gnu.sh
new file mode 100755
index 0000000..a8b204d
--- /dev/null
+++ b/p11-kit/gen-pkcs11-gnu.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+source="$1"
+target="$2"
+
+rm -f $target-t $target && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ echo; \
+ echo '#include <stdlib.h>'; \
+ echo '#include "p11-kit/p11-kit.h"'; \
+ cat $source; \
+ echo "void *${target}_funcs[] = {" | sed 's/[^][ *a-z0-9_={]/_/g'; \
+ sed -n -e '/^typedef/d' -e 's/.* \(p11_kit_[^ ]*\) *(.*/ \1,/p' $source; \
+ echo '};'; \
+ } > $target-t && \
+ mv -f $target-t $target