mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 08:47:56 +01:00
Add $CC and $CXX variables to build-*.sh
This commit is contained in:
1 parent
eb108af98a
commit
b2d598aac5
3 files changed
+19
-10
No files matched your search
+8
-5
@@ -33,25 +33,28 @@
|
|||||||
# having to separately configure, build or install a library:
|
# having to separately configure, build or install a library:
|
||||||
#
|
#
|
||||||
# git clone https://github.com/google/wuffs.git
|
# git clone https://github.com/google/wuffs.git
|
||||||
# cd wuffs/example/zcat
|
# cd wuffs
|
||||||
# gcc zcat.c
|
# gcc ./example/zcat/zcat.c
|
||||||
# ./a.out < ../../test/data/romeo.txt.gz
|
# ./a.out < ./test/data/romeo.txt.gz
|
||||||
|
|
||||||
if [ ! -e release/c/wuffs-unsupported-snapshot.c ]; then
|
if [ ! -e release/c/wuffs-unsupported-snapshot.c ]; then
|
||||||
echo "$0 should be run from the Wuffs root directory."
|
echo "$0 should be run from the Wuffs root directory."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CC=${CC:-gcc}
|
||||||
|
CXX=${CXX:-g++}
|
||||||
|
|
||||||
go install github.com/google/wuffs/cmd/...
|
go install github.com/google/wuffs/cmd/...
|
||||||
go test github.com/google/wuffs/...
|
go test github.com/google/wuffs/...
|
||||||
wuffs gen
|
wuffs gen
|
||||||
|
|
||||||
echo "Checking snapshot compiles cleanly (as C)"
|
echo "Checking snapshot compiles cleanly (as C)"
|
||||||
gcc -c -Wall -Werror -DWUFFS_IMPLEMENTATION -std=c99 \
|
$CC -c -Wall -Werror -DWUFFS_IMPLEMENTATION -std=c99 \
|
||||||
release/c/wuffs-unsupported-snapshot.c -o /dev/null
|
release/c/wuffs-unsupported-snapshot.c -o /dev/null
|
||||||
|
|
||||||
echo "Checking snapshot compiles cleanly (as C++)"
|
echo "Checking snapshot compiles cleanly (as C++)"
|
||||||
g++ -c -Wall -Werror -DWUFFS_IMPLEMENTATION -std=c++11 \
|
$CXX -c -Wall -Werror -DWUFFS_IMPLEMENTATION -std=c++11 \
|
||||||
release/c/wuffs-unsupported-snapshot.c -o /dev/null
|
release/c/wuffs-unsupported-snapshot.c -o /dev/null
|
||||||
|
|
||||||
wuffs genlib -skipgen
|
wuffs genlib -skipgen
|
||||||
|
|||||||
+7
-4
@@ -22,6 +22,9 @@ if [ ! -e release/c/wuffs-unsupported-snapshot.c ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CC=${CC:-gcc}
|
||||||
|
CXX=${CXX:-g++}
|
||||||
|
|
||||||
mkdir -p gen/bin
|
mkdir -p gen/bin
|
||||||
|
|
||||||
sources=$@
|
sources=$@
|
||||||
@@ -39,19 +42,19 @@ for f in $sources; do
|
|||||||
if [ $f = crc32 ]; then
|
if [ $f = crc32 ]; then
|
||||||
echo "Building gen/bin/example-$f"
|
echo "Building gen/bin/example-$f"
|
||||||
# example/crc32 is unusual in that it's C++, not C.
|
# example/crc32 is unusual in that it's C++, not C.
|
||||||
g++ -O3 example/$f/*.cc -o gen/bin/example-$f
|
$CXX -O3 example/$f/*.cc -o gen/bin/example-$f
|
||||||
elif [ $f = library ]; then
|
elif [ $f = library ]; then
|
||||||
# example/library is unusual in that it uses separately compiled libraries
|
# example/library is unusual in that it uses separately compiled libraries
|
||||||
# (built by "wuffs genlib", e.g. by running build-all.sh) instead of
|
# (built by "wuffs genlib", e.g. by running build-all.sh) instead of
|
||||||
# directly #include'ing Wuffs' .c files.
|
# directly #include'ing Wuffs' .c files.
|
||||||
if [ -e gen/lib/c/gcc-static/libwuffs.a ]; then
|
if [ -e gen/lib/c/$CC-static/libwuffs.a ]; then
|
||||||
echo "Building gen/bin/example-$f"
|
echo "Building gen/bin/example-$f"
|
||||||
gcc -O3 -static -I.. example/$f/*.c gen/lib/c/gcc-static/libwuffs.a -o gen/bin/example-$f
|
$CC -O3 -static -I.. example/$f/*.c gen/lib/c/$CC-static/libwuffs.a -o gen/bin/example-$f
|
||||||
else
|
else
|
||||||
echo "Skipping gen/bin/example-$f; run \"wuffs genlib\" first"
|
echo "Skipping gen/bin/example-$f; run \"wuffs genlib\" first"
|
||||||
fi
|
fi
|
||||||
elif [ -e example/$f/*.c ]; then
|
elif [ -e example/$f/*.c ]; then
|
||||||
echo "Building gen/bin/example-$f"
|
echo "Building gen/bin/example-$f"
|
||||||
gcc -O3 example/$f/*.c -o gen/bin/example-$f
|
$CC -O3 example/$f/*.c -o gen/bin/example-$f
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
+4
-1
@@ -22,6 +22,9 @@ if [ ! -e release/c/wuffs-unsupported-snapshot.c ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CC=${CC:-gcc}
|
||||||
|
CXX=${CXX:-g++}
|
||||||
|
|
||||||
mkdir -p gen/bin
|
mkdir -p gen/bin
|
||||||
|
|
||||||
sources=$@
|
sources=$@
|
||||||
@@ -38,5 +41,5 @@ for f in $sources; do
|
|||||||
fi
|
fi
|
||||||
echo "Building gen/bin/fuzz-$f"
|
echo "Building gen/bin/fuzz-$f"
|
||||||
|
|
||||||
gcc -DWUFFS_CONFIG__FUZZLIB_MAIN fuzz/c/std/${f}_fuzzer.c -o gen/bin/fuzz-$f
|
$CC -DWUFFS_CONFIG__FUZZLIB_MAIN fuzz/c/std/${f}_fuzzer.c -o gen/bin/fuzz-$f
|
||||||
done
|
done
|
||||||
Reference in new issue
Block a user