swiftlyfalling / SQLiteLib

Easily build a custom SQLite static library for use in macOS and iOS frameworks and apps.
MIT License
64 stars 23 forks source link

Include SQLite-SEE if present in project #39

Closed barnettben closed 5 years ago

barnettben commented 5 years ago

I have amended the script that builds the amalgamation to incorporate files from SQLite-SEE if they are present in the project directory.

If they are present, the two files are concatenated with into sqlite3-see.c. At the end of the build process, this new file replaces the old sqlite3.c

If the files are not present, nothing changes.

It's hard to see from the diff, so here's the added code:

hasSEE=false
if [ -e "${PROJECT_DIR}/see-prefix.txt" ] && [ -e "${DERIVED_SOURCES_DIR}/sqlite3.c" ] && [ -e "${PROJECT_DIR}/see.c" ]
then
echo "Found sqlite-see"
hasSEE=true
cat "${PROJECT_DIR}/see-prefix.txt" "${DERIVED_SOURCES_DIR}/sqlite3.c" "${PROJECT_DIR}/see.c" > "${DERIVED_SOURCES_DIR}/sqlite3-see.c"
fi

and

if [ "$hasSEE" = true ] ;
then
echo "Overwriting sqlite3.c to with sqlite3-see.c"
cp ./sqlite3-see.c "${SQLITE_OUTPUT_DIR}/sqlite3.c"
fi
barnettben commented 5 years ago

I have a better way and will submit a different pul request.