Skip to content

Commit

Permalink
Fixed issue #13 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
sumeetchhetri committed Jun 15, 2017
1 parent a0a29ef commit 25ede8d
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 53 deletions.
29 changes: 17 additions & 12 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -216,22 +216,27 @@ install-data-hook:

build-apps: install
cd tests/autotools && make
${buildapachemod}
cd web/default/src/autotools && make
cd web/flexApp/src/autotools && make
cd web/oauthApp/src/autotools && make
cd web/markers/src/autotools && make
cd web/te-benchmark/src/autotools && make
cp -f tests/autotools/.libs/tests tests/test.csv \
tests/testValues.prop tests/runTests.sh \
tests/*.pem tests/security.prop ${prefix}/tests
cp -f web/default/src/autotools/.libs/*default* ${prefix}/lib
cp -f web/flexApp/src/autotools/.libs/*flexApp* ${prefix}/lib
cp -f web/oauthApp/src/autotools/.libs/*oauthApp* ${prefix}/lib
cp -f web/markers/src/autotools/.libs/*markers* ${prefix}/lib
cp -f web/te-benchmark/src/autotools/.libs/*te_benchmark* ${prefix}/lib
${buildapachemod}
for webdir in web/*/ ; do \
dir=$${webdir%*/}; \
wdir=`echo $${dir##*/}`; \
echo $${wdir}; \
if [ -d "$${webdir}/src/" ] && [ -d "$${webdir}/src/autotools" ] && [ -d "$${webdir}/include" ]; then \
hc=`ls $${webdir}/include/*.h 2>/dev/null|wc -l`; \
sc=`ls $${webdir}/src/*.cpp 2>/dev/null|wc -l`; \
if [ $$hc != 0 ] && [ $$sc != 0 ] && [ -f "$${webdir}/src/autotools/Makefile" ]; then \
weblibname=`echo "$${wdir}" | tr '-' '_'`; \
cd $${webdir}/src/autotools && make; \
cd -; \
cp -f $${webdir}/src/autotools/.libs/*$${weblibname}* ${prefix}/lib; \
rm -rf $(prefix)/web/$${wdir}/src/; \
fi \
fi \
done
-rm -f ${prefix}/lib/*.la ${prefix}/lib/*.lai
-rm -rf $(prefix)/web/default/src/ $(prefix)/web/flexApp/src/ $(prefix)/web/oauthApp/src/ $(prefix)/web/markers/src/ $(prefix)/web/te-benchmark/src/

build-bin-dist: install
tardir=$(packageIdentifier) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(packageIdentifier).tar.gz
Expand Down
5 changes: 4 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,9 @@ AM_CONDITIONAL(BUILT_WITH_CONFGURE, test "x1" = "x1")
AC_CHECK_HEADER([_mingw_mac.h],
[AC_DEFINE(OS_MINGW_W64, [1], [Define to 1 if you have _mingw_mac.h])],
[AC_DEFINE(OS_MINGW_W64, [0], [Define to 0 if you don't have _mingw_mac.h])])

AC_CHECK_HEADER([sys/sendfile.h],
[AC_DEFINE(IS_SENDFILE, [1], [Define to 1 if you have sys/sendfile.h])],
[AC_DEFINE(IS_SENDFILE, [0], [Define to 0 if you don't have sys/sendfile.h])])
dnl# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])
AC_CHECK_HEADER([sys/epoll.h],
Expand Down Expand Up @@ -941,3 +943,4 @@ echo "LDFLAGS: $LDFLAGS"
echo "Debug mode: $support_debug"
echo "Make Executable: $MAKE"
echo "Generate Apache Module: $generate_apache_module"

42 changes: 30 additions & 12 deletions configure.ac.old
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ AS_HELP_STRING([--enable-apachemod],
[generate_apache_module=$enableval]
)

generate_nginx_module=no
AC_ARG_ENABLE(nginxmod,
AS_HELP_STRING([--enable-nginxmod],
[enable nginxmod, default: no]),
[generate_nginx_module=$enableval]
)

AC_CANONICAL_HOST
local_os_type="unknown"
is_librt_available="yes"
Expand Down Expand Up @@ -650,13 +657,13 @@ if test "x$mod_httpframework" = "xyes"; then

AC_ARG_ENABLE(mod_appflow,
AS_HELP_STRING([--enable-mod_appflow],
[enable mod_appflow, default: yes]),
[enable mod_appflow, default: no]),
[case "${enableval}" in
yes) mod_appflow=yes ;;
no) mod_appflow=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-mod_appflow]) ;;
esac],
[mod_appflow=yes])
[mod_appflow=no])
AM_CONDITIONAL(MOD_APPFLOW, test "x$mod_appflow" = "xyes")
if test "x$mod_appflow" = "xyes"; then
AC_DEFINE(INC_APPFLOW, [], [enable http framework application flow module])
Expand All @@ -678,13 +685,13 @@ if test "x$mod_httpframework" = "xyes"; then

AC_ARG_ENABLE(mod_script,
AS_HELP_STRING([--enable-mod_script],
[enable mod_script, default: yes]),
[enable mod_script, default: no]),
[case "${enableval}" in
yes) mod_script=yes ;;
no) mod_script=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-mod_script]) ;;
esac],
[mod_script=yes])
[mod_script=no])
AM_CONDITIONAL(MOD_SCRH, test "x$mod_script" = "xyes")
if test "x$mod_script" = "xyes"; then
AC_DEFINE(INC_SCRH, [], [enable http framework scripting support module])
Expand Down Expand Up @@ -748,8 +755,9 @@ AX_CXX_COMPILE_STDCXX_11(,mandatory)
# AC_MSG_ERROR([Please install GNU GCC/G++ to continue.])
#fi

AM_CONDITIONAL(MOD_APACHEMOD, test "x$generate_apache_module" = "xyes")
if test "x$generate_apache_module" = "xyes"; then
AC_SUBST(GENERATE_APACHEMOD,[apache_mod_ffeadcpp/autotools])
AC_SUBST(GENERATE_APACHEMOD,[modules/apache_mod_ffeadcpp/autotools])
if test "x$local_os_type" = "xcygwin"; then
AC_SUBST(LIB_TYPE,[-l])
AC_SUBST(LIBRARY_EXTENSION,[dll])
Expand Down Expand Up @@ -802,7 +810,9 @@ AM_CONDITIONAL(BUILT_WITH_CONFGURE, test "x1" = "x1")
AC_CHECK_HEADER([_mingw_mac.h],
[AC_DEFINE(OS_MINGW_W64, [1], [Define to 1 if you have _mingw_mac.h])],
[AC_DEFINE(OS_MINGW_W64, [0], [Define to 0 if you don't have _mingw_mac.h])])

AC_CHECK_HEADER([sys/sendfile.h],
[AC_DEFINE(IS_SENDFILE, [1], [Define to 1 if you have sys/sendfile.h])],
[AC_DEFINE(IS_SENDFILE, [0], [Define to 0 if you don't have sys/sendfile.h])])
dnl# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])
AC_CHECK_HEADER([sys/epoll.h],
Expand Down Expand Up @@ -904,15 +914,22 @@ AM_CXXFLAGS="$AM_CXXFLAGS $STDCXX_11_SWITCH"
AC_SUBST([AM_CXXFLAGS])
AC_SUBST([ADD_LIBDL])

AM_CONDITIONAL(MOD_NGINXMOD, test "x$generate_nginx_module" = "xyes")
if test "x$generate_nginx_module" = "xyes"; then
INC_PATHSNGX="$CPPFLAGS $AM_CXXFLAGS"
AC_SUBST(GENERATE_NGINXMOD,[modules/nginx_mod_ffeadcpp])
AC_SUBST(INCPATHS_NGINXMOD,[$INC_PATHSNGX])

AC_SUBST(LIBPATHS_NGINXMOD,[$LDFLAGS])
else
AC_SUBST(GENERATE_NGINXMOD,[ ])
fi

AC_CONFIG_FILES([Makefile
src/autotools/Makefile
tests/autotools/Makefile
src/apache_mod_ffeadcpp/autotools/Makefile
web/default/src/autotools/Makefile
web/flexApp/src/autotools/Makefile
web/oauthApp/src/autotools/Makefile
web/markers/src/autotools/Makefile
web/te-benchmark/src/autotools/Makefile])
modules/apache_mod_ffeadcpp/autotools/Makefile
web/hello_world/src/autotools/Makefile])
AC_OUTPUT

echo "Host: $host"
Expand All @@ -922,3 +939,4 @@ echo "LDFLAGS: $LDFLAGS"
echo "Debug mode: $support_debug"
echo "Make Executable: $MAKE"
echo "Generate Apache Module: $generate_apache_module"

29 changes: 21 additions & 8 deletions ffead_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,20 @@ controllers () {
done
}
controllers_create () {
rm -f $FFEAD_CPP_PATH/web/$APP_NAME/src/.cpp
rm -f $FFEAD_CPP_PATH/web/$APP_NAME/include/.h
for var in "${APP_CONTROLLERS_CLASSES[@]}"
do
if [ "${var}" != "" ]; then
uvar=`echo $var |tr '[:lower:]' '[:upper:]'`
cp -f $FFEAD_CPP_PATH/resources/ffead-gen/$FCNF_TYPE/TControllerHeader.t $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
cp -f $FFEAD_CPP_PATH/resources/ffead-gen/$FCNF_TYPE/TControllerHeader.t $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
sed -Ei "s/@TCLASS@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
sed -Ei "s/@TCLASSU@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/include/${uvar}.h
sed -Ei "s/@TCLASSU@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
cp -f $FFEAD_CPP_PATH/resources/ffead-gen/xml/TControllerDef.t $FFEAD_CPP_PATH/web/$APP_NAME/src/${var}.cpp
sed -Ei "s/@TCLASS@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/src/${var}.cpp
APP_CLASSES+="\.\.\/${var}\.cpp "
CONTOLLER_CONF+="\\n\\t\\t<controller class=\"${var}\" path=\"*\" \/>"
fi
done
}

Expand All @@ -115,18 +119,22 @@ filters () {
done
}
filters_create () {
rm -f $FFEAD_CPP_PATH/web/$APP_NAME/src/.cpp
rm -f $FFEAD_CPP_PATH/web/$APP_NAME/include/.h
for var in "${APP_FILTERS_CLASSES[@]}"
do
if [ "${var}" != "" ]; then
uvar=`echo $var |tr '[:lower:]' '[:upper:]'`
cp -f $FFEAD_CPP_PATH/resources/ffead-gen/$FCNF_TYPE/TFilterHeader.t $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
cp -f $FFEAD_CPP_PATH/resources/ffead-gen/$FCNF_TYPE/TFilterHeader.t $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
sed -Ei "s/@TCLASS@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
sed -Ei "s/@TCLASSU@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/include/${uvar}.h
sed -Ei "s/@TCLASSU@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
cp -f $FFEAD_CPP_PATH/resources/ffead-gen/xml/TFilterDef.t $FFEAD_CPP_PATH/web/$APP_NAME/src/${var}.cpp
sed -Ei "s/@TCLASS@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/src/${var}.cpp
APP_CLASSES+="\.\.\/${var}\.cpp "
FILTER_CONF+="\\n\\t\\t<filter class=\"${var}\" type=\"in\" \/>\\n"
FILTER_CONF+="\\t\\t<filter class=\"${var}\" type=\"out\" \/>\\n"
FILTER_CONF+="\\t\\t<filter class=\"${var}\" type=\"handle\" \/>"
fi
done
}

Expand All @@ -148,19 +156,23 @@ restapis () {
done
}
restapis_create () {
rm -f $FFEAD_CPP_PATH/web/$APP_NAME/src/.cpp
rm -f $FFEAD_CPP_PATH/web/$APP_NAME/include/.h
for var in "${APP_RESTAPIS_CLASSES[@]}"
do
if [ "${var}" != "" ]; then
uvar=`echo $var |tr '[:lower:]' '[:upper:]'`
cp -f $FFEAD_CPP_PATH/resources/ffead-gen/$FCNF_TYPE/TRestApiHeader.t $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
cp -f $FFEAD_CPP_PATH/resources/ffead-gen/$FCNF_TYPE/TRestApiHeader.t $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
sed -Ei "s/@TCLASS@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
sed -Ei "s/@TCLASSU@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/include/${uvar}.h
sed -Ei "s/@TCLASSU@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/include/${var}.h
cp -f $FFEAD_CPP_PATH/resources/ffead-gen/xml/TRestApiDef.t $FFEAD_CPP_PATH/web/$APP_NAME/src/${var}.cpp
sed -Ei "s/@TCLASS@/${var}/g" $FFEAD_CPP_PATH/web/$APP_NAME/src/${var}.cpp
APP_CLASSES+="\.\.\/${var}\.cpp "
lvar=`echo $var |tr '[:upper:]' '[:lower:]'`
RESTAPI_CONF+="\\n\\t\\t<restcontroller class=\"${var}\" path=\"\/$lvar\">\\n"
RESTAPI_CONF+="\\t\\t\\t<restfunction name=\"serve\" path=\"\/serve\" meth=\"GET\" statusCode=\"200\"\/>\\n"
RESTAPI_CONF+="\\t\\t<\/restcontroller>"
fi
done
}

Expand All @@ -179,13 +191,14 @@ config_setup () {

main () {
echo 1>&2 "The generator will now create application directories and makefile,
configure.ac will also be modified, Do you want to proceed (y/n): "
configure.ac will also be modified, also delete any existing web directories by the same name, Do you want to proceed (y/n): "
read CONFIRM
RE="^[y|n|Y|N]$"
if [[ "$CONFIRM" =~ $RE ]]; then
echo "Application Name: $APP_NAME"
echo "Library Dependencies: $FAPP_LIBS"
echo "Generator will now generate a new application directory $FFEAD_CPP_PATH/web/$APP_NAME"
rm -rf $FFEAD_CPP_PATH/web/$APP_NAME
mkdir $FFEAD_CPP_PATH/web/$APP_NAME
mkdir $FFEAD_CPP_PATH/web/$APP_NAME/config
mkdir $FFEAD_CPP_PATH/web/$APP_NAME/include
Expand Down Expand Up @@ -261,4 +274,4 @@ done
artifact
if [[ "$FARTIFACT_TYPE" = "e" ]]; then
main
fi
fi
50 changes: 38 additions & 12 deletions resources/ffead-gen/configure.ac.orig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ AS_HELP_STRING([--enable-apachemod],
[generate_apache_module=$enableval]
)

generate_nginx_module=no
AC_ARG_ENABLE(nginxmod,
AS_HELP_STRING([--enable-nginxmod],
[enable nginxmod, default: no]),
[generate_nginx_module=$enableval]
)

AC_CANONICAL_HOST
local_os_type="unknown"
is_librt_available="yes"
Expand Down Expand Up @@ -650,13 +657,13 @@ if test "x$mod_httpframework" = "xyes"; then

AC_ARG_ENABLE(mod_appflow,
AS_HELP_STRING([--enable-mod_appflow],
[enable mod_appflow, default: yes]),
[enable mod_appflow, default: no]),
[case "${enableval}" in
yes) mod_appflow=yes ;;
no) mod_appflow=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-mod_appflow]) ;;
esac],
[mod_appflow=yes])
[mod_appflow=no])
AM_CONDITIONAL(MOD_APPFLOW, test "x$mod_appflow" = "xyes")
if test "x$mod_appflow" = "xyes"; then
AC_DEFINE(INC_APPFLOW, [], [enable http framework application flow module])
Expand All @@ -678,13 +685,13 @@ if test "x$mod_httpframework" = "xyes"; then

AC_ARG_ENABLE(mod_script,
AS_HELP_STRING([--enable-mod_script],
[enable mod_script, default: yes]),
[enable mod_script, default: no]),
[case "${enableval}" in
yes) mod_script=yes ;;
no) mod_script=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-mod_script]) ;;
esac],
[mod_script=yes])
[mod_script=no])
AM_CONDITIONAL(MOD_SCRH, test "x$mod_script" = "xyes")
if test "x$mod_script" = "xyes"; then
AC_DEFINE(INC_SCRH, [], [enable http framework scripting support module])
Expand Down Expand Up @@ -748,8 +755,9 @@ AX_CXX_COMPILE_STDCXX_11(,mandatory)
# AC_MSG_ERROR([Please install GNU GCC/G++ to continue.])
#fi

AM_CONDITIONAL(MOD_APACHEMOD, test "x$generate_apache_module" = "xyes")
if test "x$generate_apache_module" = "xyes"; then
AC_SUBST(GENERATE_APACHEMOD,[apache_mod_ffeadcpp/autotools])
AC_SUBST(GENERATE_APACHEMOD,[modules/apache_mod_ffeadcpp/autotools])
if test "x$local_os_type" = "xcygwin"; then
AC_SUBST(LIB_TYPE,[-l])
AC_SUBST(LIBRARY_EXTENSION,[dll])
Expand Down Expand Up @@ -802,7 +810,9 @@ AM_CONDITIONAL(BUILT_WITH_CONFGURE, test "x1" = "x1")
AC_CHECK_HEADER([_mingw_mac.h],
[AC_DEFINE(OS_MINGW_W64, [1], [Define to 1 if you have _mingw_mac.h])],
[AC_DEFINE(OS_MINGW_W64, [0], [Define to 0 if you don't have _mingw_mac.h])])

AC_CHECK_HEADER([sys/sendfile.h],
[AC_DEFINE(IS_SENDFILE, [1], [Define to 1 if you have sys/sendfile.h])],
[AC_DEFINE(IS_SENDFILE, [0], [Define to 0 if you don't have sys/sendfile.h])])
dnl# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])
AC_CHECK_HEADER([sys/epoll.h],
Expand Down Expand Up @@ -855,6 +865,8 @@ AC_CHECK_SIZEOF(void *)
AC_CHECK_TYPES(long long)
AC_CHECK_TYPES(signed char)

ADD_LIBDL=

dnl# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
Expand All @@ -865,7 +877,8 @@ AC_CHECK_LIB(pthreads, pthread_create,[], [AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(ssl, SSL_read, [], [AC_MSG_ERROR([ssl library not found])])
AC_CHECK_LIB([crypto], [SHA1_Init], [], [AC_MSG_ERROR([libcrypto not found])])
AC_CHECK_LIB(z, compress,,AC_MSG_ERROR([no zlib; please install zlib or equivalent]))
AC_CHECK_LIB(c, dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")])
#AC_CHECK_LIB(c, dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")])
AC_CHECK_LIB(c, dlopen, ADD_LIBDL="", [AC_CHECK_LIB(dl, dlopen, ADD_LIBDL="-ldl")])
AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])], [])

if test "x$mod_sdormsql" = "xyes"; then
Expand Down Expand Up @@ -895,15 +908,27 @@ if test "x$mod_gtm" = "xyes"; then
AC_CHECK_LIB(gtmshr, main, , [AC_MSG_ERROR([Not found libgtmshr library])])
fi

AM_CXXFLAGS="$AM_CXXFLAGS $STDCXX_11_SWITCH"
AM_CXXFLAGS="$AM_CXXFLAGS $STDCXX_11_SWITCH"
# distribute additional compiler and linker flags among Makefiles
# --> set and change these variables instead of CXXFLAGS or LDFLAGS (for user only)
AC_SUBST([AM_CXXFLAGS])

AC_SUBST([ADD_LIBDL])

AM_CONDITIONAL(MOD_NGINXMOD, test "x$generate_nginx_module" = "xyes")
if test "x$generate_nginx_module" = "xyes"; then
INC_PATHSNGX="$CPPFLAGS $AM_CXXFLAGS"
AC_SUBST(GENERATE_NGINXMOD,[modules/nginx_mod_ffeadcpp])
AC_SUBST(INCPATHS_NGINXMOD,[$INC_PATHSNGX])

AC_SUBST(LIBPATHS_NGINXMOD,[$LDFLAGS])
else
AC_SUBST(GENERATE_NGINXMOD,[ ])
fi

AC_CONFIG_FILES([Makefile
src/autotools/Makefile
tests/autotools/Makefile
src/apache_mod_ffeadcpp/autotools/Makefile
src/autotools/Makefile
tests/autotools/Makefile
modules/apache_mod_ffeadcpp/autotools/Makefile
WEB_APPS])
AC_OUTPUT

Expand All @@ -914,3 +939,4 @@ echo "LDFLAGS: $LDFLAGS"
echo "Debug mode: $support_debug"
echo "Make Executable: $MAKE"
echo "Generate Apache Module: $generate_apache_module"

4 changes: 2 additions & 2 deletions resources/ffead-gen/xml/TControllerDef.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

bool @TCLASS@::service(HttpRequest* req, HttpResponse* res)
{
res->setHTTPResponseStatus(HTTPResponseStatus:ok);
res->setHTTPResponseStatus(HTTPResponseStatus::Ok);
res->addHeaderValue(HttpResponse::ContentType, "text/plain");
res->setContent("Hello World");
return true;
}
}
Loading

0 comments on commit 25ede8d

Please # to comment.