Skip to content

Instantly share code, notes, and snippets.

@zachriggle
Created September 30, 2020 23:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachriggle/130e01cf4541615e2062ca66d1637a07 to your computer and use it in GitHub Desktop.
Save zachriggle/130e01cf4541615e2062ca66d1637a07 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
if [ $# == 0 ];
then
echo "Usage: $0 path-to-lib.a <name>"
else
filename=$(basename "$1")
extension="${filename##*.}"
filename="${filename%.*}"
filepath="$(dirname $1)/$filename"
name=$2
if [[ "$name" == "" ]];
then
name=$(basename $1)
fi
pelf "$filepath.a" "$filepath.pat"
rm -f "$filepath.exc"
sigmake -s -n"$name" "$filepath.pat" "$filepath.sig" || true
if [ -f "$filepath.exc" ]; then
rm -f "$filepath.sig"
sed -Ei 's|^;.*||' "$filepath.exc"
sigmake -s -n"$name" "$filepath.pat" "$filepath.sig"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment