Last active
January 17, 2023 01:19
-
-
Save tetsu-koba/d463638bfedcdba72e3c7cc680ef10e8 to your computer and use it in GitHub Desktop.
shell script for zig translate-c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <cfilename> ending '.c' or '.h'" | |
exit 1 | |
fi | |
if [[ $1 == *.c ]]; then | |
OUTPUT=$(basename $1 .c)_translated.zig | |
elif [[ $1 == *.h ]]; then | |
OUTPUT=$(basename $1 .h)_h_translated.zig | |
else | |
echo "Usage: $0 <cfilename> ending '.c' or '.h'" | |
exit 1 | |
fi | |
ZIGDIR=/opt/zig-linux-aarch64-0.10.0 | |
zig translate-c \ | |
-I $ZIGDIR/lib/libc/include/aarch64-linux-gnu \ | |
-I $ZIGDIR/lib/libc/include/generic-glibc \ | |
-I $ZIGDIR/lib/libc/include/any-linux-any \ | |
$1 > $OUTPUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment