Artifact 6b6e0d92157f9e21cde9f6b5bc84727617e2b47b:
#!/bin/bash
########################################################################
# Generates an "amalgamation build" for cson, including only the components
# needed for adding cson to the Fossil SCM system.
# Output is two files, cson_amalgamation_fossil.{c,h}.
########################################################################
LIB_BASH=createAmalgamation-lib.bash
. ${LIB_BASH} || {
echo "Could not source config/lib script [${LIB_BASH}]."
exit 127
}
AMAL_SOURCES="
parser/JSON_parser.h
parser/JSON_parser.c
${dir_src}/cson.c
${dir_src}/cson_lists.h
${dir_src}/cson_session.c
${dir_src}/cson_session_file.c
${dir_src}/cson_sqlite3.c
cgi/whuuid.h
cgi/whuuid.c
cgi/cson_cgi.c
"
# Reminder: fossil doesn't need cson_session_file.c
# but it is the reference session impl and is used without any sort of
# #if block.
# The ordering of headers is important for the amalgamation build
AMAL_HEADERS="
${inc_cson}/cson.h
${inc_cson}/cson_sqlite3.h
${inc_cson}/cson_session.h
${inc_cson}/cson_cgi.h
"
#set -x
AMAL_FOSSIL_C=cson_amalgamation_fossil.c
AMAL_FOSSIL_H=cson_amalgamation_fossil.h
wh_create_code \
${AMAL_HEADERS} > ${AMAL_FOSSIL_H}
wh_create_code \
-i ${AMAL_FOSSIL_H} \
${AMAL_SOURCES} > ${AMAL_FOSSIL_C}
perl -i -p \
-e 's|\s*#\s*define\s*CSON_ENABLE_SQLITE3.*|#define CSON_ENABLE_SQLITE3 1|' \
${AMAL_FOSSIL_H}
echo "Done:"
ls -la ${AMAL_FOSSIL_C} ${AMAL_FOSSIL_H}
CFLAGS="${CFLAGS} -std=c89 -DCSON_ENABLE_SQLITE3=1"
wh_try_compilers ${AMAL_FOSSIL_C}
myfsl=$HOME/cvs/fossil/fossil-sgb
if [[ -d $myfsl ]]; then
echo "Copying to fossil tree [${myfsl}] ..."
cp ${AMAL_FOSSIL_H} $myfsl/src/cson_amalgamation.h
sed -e "s|${AMAL_FOSSIL_H}|cson_amalgamation.h|" \
${AMAL_FOSSIL_C} > $myfsl/src/cson_amalgamation.c
fi