-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b968a31
commit 4054fd9
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
CC=gcc | ||
CXX=g++ | ||
|
||
# determine target platform | ||
TARGET= | ||
if ( uname -s | grep -qi "MINGW\|MSYS" ); then | ||
if ( gcc --version | grep -q x86_64 ); then | ||
TARGET=win64 | ||
else | ||
TARGET=win32 | ||
fi | ||
fi | ||
if [ "$TARGET" = "" ]; then | ||
echo "Unsupported platform, currently only MinGW on Windows is supported" | ||
exit 1; | ||
fi | ||
|
||
VERSION=$(sed -ne "s/^#define\s*XLSXIO_VERSION_[A-Z]*\s*\([0-9]*\)\s*$/\1./p" include/xlsxio_version.h | tr -d "\n" | sed -e "s/\.$//") | ||
BUILDDST=build_$TARGET | ||
ZIPFILE=xlsxio-$VERSION-binary-$TARGET.zip | ||
#CFLAGS="-DUSE_LIBZIP" | ||
#LDFLAGS="-lzip -lz" | ||
CFLAGS="-DUSE_MINIZIP" | ||
LDFLAGS="-lminizip -lz" | ||
|
||
rm -f $ZIPFILE &> /dev/null | ||
mkdir -p $BUILDDST && | ||
$CC -mdll -static -o$BUILDDST/xlsxio_read.dll -Wl,--out-implib,$BUILDDST/libxlsxio_read.a -DBUILD_XLSXIO_DLL -DBUILD_XLSXIO_STATIC_DLL -Iinclude lib/xlsxio_read.c lib/xlsxio_read_sharedstrings.c $CFLAGS $LDFLAGS -lexpat && | ||
$CC -mdll -static -o$BUILDDST/xlsxio_write.dll -Wl,--out-implib,$BUILDDST/libxlsxio_write.a -DBUILD_XLSXIO_DLL -DBUILD_XLSXIO_STATIC_DLL -Iinclude lib/xlsxio_write.c $CFLAGS $LDFLAGS && | ||
$CC -mconsole -s -o$BUILDDST/xlsxio_xlsx2csv.exe src/xlsxio_xlsx2csv.c -Iinclude $BUILDDST/libxlsxio_read.a && | ||
$CC -mconsole -s -o$BUILDDST/xlsxio_csv2xlsx.exe src/xlsxio_csv2xlsx.c -Iinclude $BUILDDST/libxlsxio_write.a && | ||
zip -qj $ZIPFILE LICENSE.txt Changelog.txt README.md include/* $BUILDDST/* && | ||
echo Created $ZIPFILE && | ||
rm -rf $BUILDDST |