From rspencer at reidspencer.com Mon May 22 14:05:25 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Mon, 22 May 2006 15:05:25 -0400 Subject: [hlvm-commits] r105 - / autoconf Message-ID: <200605221905.k4MJ5PVV002821@sneezy.swagora.com> Author: reid Date: 2006-05-22 15:05:24 -0400 (Mon, 22 May 2006) New Revision: 105 Log: Remove expat and syck. They're not needed/used at the moment. Modified: autoconf/configure.ac configure Modified: autoconf/configure.ac =================================================================== --- autoconf/configure.ac 2006-05-22 02:43:34 UTC (rev 104) +++ autoconf/configure.ac 2006-05-22 19:05:24 UTC (rev 105) @@ -293,7 +293,6 @@ [Apache Portable Runtime Utilities]) HLVM_FIND_LIBRARY([xml2],[libxml/parser.h],[xml2], [xmlCreateFileParserCtxt],[libxml2 XML C Parser]) -HLVM_FIND_LIBRARY([syck],[syck.h],[syck],[syck_parse],[Syck Yaml Handler]) dnl -- Check for specific libraries we depend on. if test "$HLVM_EFENCE" = true ; then @@ -306,7 +305,7 @@ dnl -- SECTION 5: Check For Needed Header Files dnl -- dnl ---------------------------------------------------------------------------- -AC_CHECK_HEADERS([expat_external.h llvm/Module.h syck_st.h]) +AC_CHECK_HEADERS([llvm/Module.h]) dnl ---------------------------------------------------------------------------- dnl -- Modified: configure =================================================================== --- configure 2006-05-22 02:43:34 UTC (rev 104) +++ configure 2006-05-22 19:05:24 UTC (rev 105) @@ -315,7 +315,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS HLVM_COPYRIGHT HLVM_PACKAGE HLVM_VERSION HLVM_SO_VERSION HLVM_SO_CURRENT HLVM_SO_REVISION HLVM_SO_AGE HLVM_SHAREDPREFIX HLVM_DEBUG HLVM_OPTIMIZE HLVM_INLINE HLVM_ASSERT HLVM_TRACE HLVM_SMALL HLVM_EFENCE HLVM_PROFILING HLVM_WITH_WORKSPACE HLVM_WITH_INCLUDES HLVM_WITH_LLVM_SRC HLVM_WITH_LLVM_OBJ HLVM_WITH_LLVMGCC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX ifGNUmake apr_INC apr_LIB apru_INC apru_LIB xml2_INC xml2_LIB syck_INC syck_LIB EGREP HLVM_CFGNAME HLVM_CONFIGTIME HLVM_PREFIX LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS HLVM_COPYRIGHT HLVM_PACKAGE HLVM_VERSION HLVM_SO_VERSION HLVM_SO_CURRENT HLVM_SO_REVISION HLVM_SO_AGE HLVM_SHAREDPREFIX HLVM_DEBUG HLVM_OPTIMIZE HLVM_INLINE HLVM_ASSERT HLVM_TRACE HLVM_SMALL HLVM_EFENCE HLVM_PROFILING HLVM_WITH_WORKSPACE HLVM_WITH_INCLUDES HLVM_WITH_LLVM_SRC HLVM_WITH_LLVM_OBJ HLVM_WITH_LLVMGCC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX ifGNUmake apr_INC apr_LIB apru_INC apru_LIB xml2_INC xml2_LIB EGREP HLVM_CFGNAME HLVM_CONFIGTIME HLVM_PREFIX LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -901,11 +901,6 @@ DIR --with-XML2-inc=DIR Specify that the libxml2 XML C Parser includes are in DIR - --with-SYCK=DIR Specify that the Syck Yaml Handler install prefix is - DIR - --with-SYCK-lib=DIR Specify that Syck Yaml Handler libraries are in DIR - --with-SYCK-inc=DIR Specify that the Syck Yaml Handler includes are in - DIR Some influential environment variables: CC C compiler command @@ -5271,521 +5266,6 @@ fi - -# Check whether --with-SYCK or --without-SYCK was given. -if test "${with_SYCK+set}" = set; then - withval="$with_SYCK" - syckpfxdir=$withval -else - syckpfxdir=nada -fi; - -# Check whether --with-SYCK-lib or --without-SYCK-lib was given. -if test "${with_SYCK_lib+set}" = set; then - withval="$with_SYCK_lib" - sycklibdir=$withval -else - sycklibdir=nada -fi; - -# Check whether --with-SYCK-inc or --without-SYCK-inc was given. -if test "${with_SYCK_inc+set}" = set; then - withval="$with_SYCK_inc" - syckincdir=$withval -else - syckincdir=nada -fi; -pfxval="${syckpfxdir}" -incval="${syckincdir}" -libval="${sycklibdir}" -echo "$as_me:$LINENO: checking for Syck Yaml Handler library and header" >&5 -echo $ECHO_N "checking for Syck Yaml Handler library and header... $ECHO_C" >&6 -hlvm_found_lib=0 -hlvm_found_inc=0 -if test "${pfxval}" != "nada" ; then - if test -d "${pfxval}" ; then - -hlvm_found_inc=0 -if test -d "${pfxval}" ; then - if test -n "syck.h" ; then - for dir in "${pfxval}/include" "${pfxval}" "${pfxval}/include/syck" ; do - if test -d "$dir" ; then - if test -f "$dir/syck.h" ; then - syck_INC="$dir" - - hlvm_found_inc=1 - fi - fi - done - fi -fi - - -hlvm_found_lib=0 -if test -d "${pfxval}" ; then - if test -n "syck" ; then - for dir in "${pfxval}" "${pfxval}/lib" ; do - if test -d "$dir" ; then - if test -f "$dir/libsyck.so" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.a" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.la" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - fi - fi - done - fi -fi - - else - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6; - { { echo "$as_me:$LINENO: error: The --with-syck value must be a directory" >&5 -echo "$as_me: error: The --with-syck value must be a directory" >&2;} - { (exit 1); exit 1; }; } - fi -else - if test "${libval}" != "nada" ; then - -hlvm_found_lib=0 -if test -d "${libval}" ; then - if test -n "syck" ; then - for dir in "${libval}" "${libval}/lib" ; do - if test -d "$dir" ; then - if test -f "$dir/libsyck.so" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.a" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.la" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - fi - fi - done - fi -fi - - fi - if test "${incval}" != "nada" ; then - -hlvm_found_inc=0 -if test -d "${incval}" ; then - if test -n "syck.h" ; then - for dir in "${incval}/include" "${incval}" "${incval}/include/syck" ; do - if test -d "$dir" ; then - if test -f "$dir/syck.h" ; then - syck_INC="$dir" - - hlvm_found_inc=1 - fi - fi - done - fi -fi - - fi -fi -if test "$hlvm_found_lib" != 1 ; then - -hlvm_found_lib=0 -if test -d "/usr" ; then - if test -n "syck" ; then - for dir in "/usr" "/usr/lib" ; do - if test -d "$dir" ; then - if test -f "$dir/libsyck.so" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.a" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.la" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - fi - fi - done - fi -fi - -fi -if test "$hlvm_found_lib" != 1 ; then - -hlvm_found_lib=0 -if test -d "/usr/local" ; then - if test -n "syck" ; then - for dir in "/usr/local" "/usr/local/lib" ; do - if test -d "$dir" ; then - if test -f "$dir/libsyck.so" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.a" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.la" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - fi - fi - done - fi -fi - -fi -if test "$hlvm_found_lib" != 1 ; then - -hlvm_found_lib=0 -if test -d "/proj/install" ; then - if test -n "syck" ; then - for dir in "/proj/install" "/proj/install/lib" ; do - if test -d "$dir" ; then - if test -f "$dir/libsyck.so" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.a" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.la" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - fi - fi - done - fi -fi - -fi -if test "$hlvm_found_lib" != 1 ; then - -hlvm_found_lib=0 -if test -d "/sw" ; then - if test -n "syck" ; then - for dir in "/sw" "/sw/lib" ; do - if test -d "$dir" ; then - if test -f "$dir/libsyck.so" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.a" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.la" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - fi - fi - done - fi -fi - -fi -if test "$hlvm_found_lib" != 1 ; then - -hlvm_found_lib=0 -if test -d "/opt" ; then - if test -n "syck" ; then - for dir in "/opt" "/opt/lib" ; do - if test -d "$dir" ; then - if test -f "$dir/libsyck.so" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.a" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - elif test -f "$dir/libsyck.la" ; then - syck_LIB=$dir - - hlvm_found_lib=1 - fi - fi - done - fi -fi - -fi -if test "$hlvm_found_inc" != 1 ; then - -hlvm_found_inc=0 -if test -d "/usr" ; then - if test -n "syck.h" ; then - for dir in "/usr/include" "/usr" "/usr/include/syck" ; do - if test -d "$dir" ; then - if test -f "$dir/syck.h" ; then - syck_INC="$dir" - - hlvm_found_inc=1 - fi - fi - done - fi -fi - -fi -if test "$hlvm_found_inc" != 1 ; then - -hlvm_found_inc=0 -if test -d "/usr/local" ; then - if test -n "syck.h" ; then - for dir in "/usr/local/include" "/usr/local" "/usr/local/include/syck" ; do - if test -d "$dir" ; then - if test -f "$dir/syck.h" ; then - syck_INC="$dir" - - hlvm_found_inc=1 - fi - fi - done - fi -fi - -fi -if test "$hlvm_found_inc" != 1 ; then - -hlvm_found_inc=0 -if test -d "/proj/install" ; then - if test -n "syck.h" ; then - for dir in "/proj/install/include" "/proj/install" "/proj/install/include/syck" ; do - if test -d "$dir" ; then - if test -f "$dir/syck.h" ; then - syck_INC="$dir" - - hlvm_found_inc=1 - fi - fi - done - fi -fi - -fi -if test "$hlvm_found_inc" != 1 ; then - -hlvm_found_inc=0 -if test -d "/sw" ; then - if test -n "syck.h" ; then - for dir in "/sw/include" "/sw" "/sw/include/syck" ; do - if test -d "$dir" ; then - if test -f "$dir/syck.h" ; then - syck_INC="$dir" - - hlvm_found_inc=1 - fi - fi - done - fi -fi - -fi -if test "$hlvm_found_inc" != 1 ; then - -hlvm_found_inc=0 -if test -d "/opt" ; then - if test -n "syck.h" ; then - for dir in "/opt/include" "/opt" "/opt/include/syck" ; do - if test -d "$dir" ; then - if test -f "$dir/syck.h" ; then - syck_INC="$dir" - - hlvm_found_inc=1 - fi - fi - done - fi -fi - -fi -if test "$hlvm_found_inc" == 1 ; then - if test "$hlvm_found_lib" == 1 ; then - echo "$as_me:$LINENO: result: found" >&5 -echo "${ECHO_T}found" >&6 - incdir=${syck_INC} - libdir=${syck_LIB} - - echo "$LDFLAGS" | grep -- "-L"${libdir}"" >/dev/null 2>/dev/null - if test $? -ne 0 ; then - LDFLAGS="$LDFLAGS -L"${libdir}"" - fi - - echo "$as_me:$LINENO: checking for library containing syck_parse" >&5 -echo $ECHO_N "checking for library containing syck_parse... $ECHO_C" >&6 -if test "${ac_cv_search_syck_parse+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_syck_parse=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char syck_parse (); -int -main () -{ -syck_parse (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_syck_parse="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_syck_parse" = no; then - for ac_lib in syck; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char syck_parse (); -int -main () -{ -syck_parse (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_syck_parse="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_syck_parse" >&5 -echo "${ECHO_T}$ac_cv_search_syck_parse" >&6 -if test "$ac_cv_search_syck_parse" != no; then - test "$ac_cv_search_syck_parse" = "none required" || LIBS="$ac_cv_search_syck_parse $LIBS" - found_sym=1 -else - found_sym=0 -fi - - if test "$found_sym" == "1" ; then - { echo "$as_me:$LINENO: Found syck in ${incdir} and ${libdir}" >&5 -echo "$as_me: Found syck in ${incdir} and ${libdir}" >&6;} - - echo "$CPPFLAGS" | grep -- "-I"${incdir}"" >/dev/null 2>/dev/null - if test $? -ne 0 ; then - CPPFLAGS="$CPPFLAGS -I"${incdir}"" - fi - - else - { echo "$as_me:$LINENO: Symbol 'syck_parse' not found in library syck in ${libdir}" >&5 -echo "$as_me: Symbol 'syck_parse' not found in library syck in ${libdir}" >&6;} - fi - else - echo "$as_me:$LINENO: result: failed to find library file" >&5 -echo "${ECHO_T}failed to find library file" >&6 - { { echo "$as_me:$LINENO: error: The --with-SYCK-lib option must be used" >&5 -echo "$as_me: error: The --with-SYCK-lib option must be used" >&2;} - { (exit 1); exit 1; }; } - fi -else - echo "$as_me:$LINENO: result: failed to find header file" >&5 -echo "${ECHO_T}failed to find header file" >&6 - { { echo "$as_me:$LINENO: error: The --with-SYCK-inc option must be used" >&5 -echo "$as_me: error: The --with-SYCK-inc option must be used" >&2;} - { (exit 1); exit 1; }; } -fi - - if test "$HLVM_EFENCE" = true ; then echo "$as_me:$LINENO: checking for malloc in -lefence" >&5 @@ -6122,9 +5602,7 @@ - - -for ac_header in expat_external.h llvm/Module.h syck_st.h +for ac_header in llvm/Module.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -7016,8 +6494,6 @@ s, at apru_LIB@,$apru_LIB,;t t s, at xml2_INC@,$xml2_INC,;t t s, at xml2_LIB@,$xml2_LIB,;t t -s, at syck_INC@,$syck_INC,;t t -s, at syck_LIB@,$syck_LIB,;t t s, at EGREP@,$EGREP,;t t s, at HLVM_CFGNAME@,$HLVM_CFGNAME,;t t s, at HLVM_CONFIGTIME@,$HLVM_CONFIGTIME,;t t _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Mon May 22 23:29:35 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 00:29:35 -0400 Subject: [hlvm-commits] r106 - hlvm Message-ID: <200605230429.k4N4TZRl013607@sneezy.swagora.com> Author: reid Date: 2006-05-23 00:29:34 -0400 (Tue, 23 May 2006) New Revision: 106 Log: Remove Pass, it isn't ready (nor committed) yet. Modified: hlvm/Makefile Modified: hlvm/Makefile =================================================================== --- hlvm/Makefile 2006-05-22 19:05:24 UTC (rev 105) +++ hlvm/Makefile 2006-05-23 04:29:34 UTC (rev 106) @@ -7,6 +7,6 @@ # # List all of the subdirectories that we will compile. # -DIRS=Base AST Pass Reader Writer +DIRS=Base AST Reader Writer include $(LEVEL)/Makefile.hlvm _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Mon May 22 23:49:44 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 00:49:44 -0400 Subject: [hlvm-commits] r107 - hlvm/Reader/XML Message-ID: <200605230449.k4N4niHm013625@sneezy.swagora.com> Author: reid Date: 2006-05-23 00:49:44 -0400 (Tue, 23 May 2006) New Revision: 107 Log: Put some { and } around case statements so less endowed compilers can grok it. Modified: hlvm/Reader/XML/XMLReader.cpp Modified: hlvm/Reader/XML/XMLReader.cpp =================================================================== --- hlvm/Reader/XML/XMLReader.cpp 2006-05-23 04:29:34 UTC (rev 106) +++ hlvm/Reader/XML/XMLReader.cpp 2006-05-23 04:49:44 UTC (rev 107) @@ -508,26 +508,29 @@ int tkn = getToken(child->name); Node* n = 0; switch (tkn) { - case TKN_doc : + case TKN_doc : { Documentation* theDoc = parseDocumentation(child); if (theDoc) bundle->setDoc(theDoc); break; - case TKN_import : n = parseImport(child); break; - case TKN_bundle : n = parseBundle(child); break; - case TKN_function : n = parseFunction(child); break; - case TKN_alias : n = parseAlias(child); break; - case TKN_atom : n = parseAtom(child); break; - case TKN_enumeration: n = parseEnumeration(child); break; - case TKN_pointer : n = parsePointer(child); break; - case TKN_array : n = parseArray(child); break; - case TKN_vector : n = parseVector(child); break; - case TKN_structure: n = parseStructure(child); break; - case TKN_signature: n = parseSignature(child); break; - case TKN_var : n = parseVariable(child); break; + } + case TKN_import : { n = parseImport(child); break; } + case TKN_bundle : { n = parseBundle(child); break; } + case TKN_function : { n = parseFunction(child); break; } + case TKN_alias : { n = parseAlias(child); break; } + case TKN_atom : { n = parseAtom(child); break; } + case TKN_enumeration: { n = parseEnumeration(child); break; } + case TKN_pointer : { n = parsePointer(child); break; } + case TKN_array : { n = parseArray(child); break; } + case TKN_vector : { n = parseVector(child); break; } + case TKN_structure: { n = parseStructure(child); break; } + case TKN_signature: { n = parseSignature(child); break; } + case TKN_var : { n = parseVariable(child); break; } default: + { hlvmDeadCode("Invalid content for bundle"); break; + } } if (n) n->setParent(bundle); _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 01:49:32 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 02:49:32 -0400 Subject: [hlvm-commits] r108 - / hlvm hlvm/AST hlvm/Base hlvm/Reader hlvm/Reader/XML hlvm/Writer hlvm/Writer/XML scons tools tools/hlvm-xml2xml Message-ID: <200605230649.k4N6nWDI019001@sneezy.swagora.com> Author: reid Date: 2006-05-23 02:49:31 -0400 (Tue, 23 May 2006) New Revision: 108 Log: Get much of scons support working. The major change was getting the configuration stuff integrated and converting the mkTokenizer utility to Python. Added: scons/filterbuilders.py tools/hlvm-xml2xml/SConscript Modified: SConstruct hlvm/AST/SConscript hlvm/Base/SConscript hlvm/Reader/SConscript hlvm/Reader/XML/SConscript hlvm/Reader/XML/XMLReader.cpp hlvm/SConscript hlvm/Writer/SConscript hlvm/Writer/XML/SConscript scons/configure.py scons/environment.py scons/main.py tools/SConscript Modified: SConstruct =================================================================== --- SConstruct 2006-05-23 04:49:44 UTC (rev 107) +++ SConstruct 2006-05-23 06:49:31 UTC (rev 108) @@ -2,10 +2,10 @@ # # Set up scons -import os -from scons.main import GetBuildEnvironment -env = GetBuildEnvironment(COMMAND_LINE_TARGETS) +from os import path +from scons import main +env = main.GetBuildEnvironment(COMMAND_LINE_TARGETS,ARGUMENTS) Export('env') -SConscript('hlvm/SConscript',build_dir=os.path.join(env['BuildDir'],"hlvm")) -SConscript('tools/SConscript',build_dir=os.path.join(env['BuildDir'],"tools")) +SConscript(path.join(env['BuildDir'],'hlvm','SConscript')) +SConscript(path.join(env['BuildDir'],'tools','SConscript')) Modified: hlvm/AST/SConscript =================================================================== --- hlvm/AST/SConscript 2006-05-23 04:49:44 UTC (rev 107) +++ hlvm/AST/SConscript 2006-05-23 06:49:31 UTC (rev 108) @@ -1,5 +1,3 @@ -# -import glob -files = glob.glob('*.cpp') +from scons import main Import('env') -env.Library('HLVMast',files) +env.Library('HLVMast',main.GetAllCXXFiles(env)) Modified: hlvm/Base/SConscript =================================================================== --- hlvm/Base/SConscript 2006-05-23 04:49:44 UTC (rev 107) +++ hlvm/Base/SConscript 2006-05-23 06:49:31 UTC (rev 108) @@ -1,3 +1,3 @@ -import glob -files = glob.glob('*.cpp') -Library('HLVMbase',files) +Import('env') +from scons import main +env.Library('HLVMbase',main.GetAllCXXFiles(env)) Modified: hlvm/Reader/SConscript =================================================================== --- hlvm/Reader/SConscript 2006-05-23 04:49:44 UTC (rev 107) +++ hlvm/Reader/SConscript 2006-05-23 06:49:31 UTC (rev 108) @@ -1,4 +1,2 @@ -# -SConscript([ - 'XML/SConscript', -]) +Import('env') +SConscript('XML/SConscript') Modified: hlvm/Reader/XML/SConscript =================================================================== --- hlvm/Reader/XML/SConscript 2006-05-23 04:49:44 UTC (rev 107) +++ hlvm/Reader/XML/SConscript 2006-05-23 06:49:31 UTC (rev 108) @@ -1,3 +1,7 @@ -import glob -files = glob.glob('*.cpp') -Library('HLVMXMLReader',files) +Import('env') +from scons import main +main.GetRNGQuoteSource(env) +main.GetRNGTokenizer(env) +env.RNGQuoteSource('HLVM.rng.inc','HLVM.rng') +env.RNGTokenizer('HLVMTokenizer.cpp','HLVM.rng') +env.Library('HLVMXMLReader',main.GetAllCXXFiles(env)) Modified: hlvm/Reader/XML/XMLReader.cpp =================================================================== --- hlvm/Reader/XML/XMLReader.cpp 2006-05-23 04:49:44 UTC (rev 107) +++ hlvm/Reader/XML/XMLReader.cpp 2006-05-23 06:49:31 UTC (rev 108) @@ -51,7 +51,7 @@ namespace { const char HLVMGrammar[] = -#include "HLVM.rng.inc" +#include ; class XMLReaderImpl : public XMLReader { @@ -219,7 +219,8 @@ xmlBufferPtr buffer = xmlBufferCreate(); xmlNodeDump(buffer,doc,cur,0,0); int length = xmlBufferLength(buffer); - std::string str(reinterpret_cast(xmlBufferContent(buffer))); + std::string + str(reinterpret_cast(xmlBufferContent(buffer)),length); str.erase(0,5); // Zap the at the start str.erase(str.length()-6); // Zap the at the end Documentation* progDoc = ast->new_Documentation(loc); Modified: hlvm/SConscript =================================================================== --- hlvm/SConscript 2006-05-23 04:49:44 UTC (rev 107) +++ hlvm/SConscript 2006-05-23 06:49:31 UTC (rev 108) @@ -1,7 +1,6 @@ # -SConscript([ - 'Base/SConscript', - 'AST/SConscript', - 'Reader/SConscript', - 'Writer/SConscript' -]) +Import('env') +env.SConscript('Base/SConscript') +env.SConscript('AST/SConscript') +env.SConscript('Reader/SConscript') +env.SConscript('Writer/SConscript') Modified: hlvm/Writer/SConscript =================================================================== --- hlvm/Writer/SConscript 2006-05-23 04:49:44 UTC (rev 107) +++ hlvm/Writer/SConscript 2006-05-23 06:49:31 UTC (rev 108) @@ -1,4 +1,2 @@ -# -SConscript([ - 'XML/SConscript', -]) +Import('env') +SConscript('XML/SConscript') Modified: hlvm/Writer/XML/SConscript =================================================================== --- hlvm/Writer/XML/SConscript 2006-05-23 04:49:44 UTC (rev 107) +++ hlvm/Writer/XML/SConscript 2006-05-23 06:49:31 UTC (rev 108) @@ -1,3 +1,3 @@ -import glob -files = glob.glob('*.cpp') -Library('HLVMXMLWriter',files) +Import('env') +from scons import main +env.Library('HLVMXMLWriter',main.GetAllCXXFiles(env)) Modified: scons/configure.py =================================================================== --- scons/configure.py 2006-05-23 04:49:44 UTC (rev 107) +++ scons/configure.py 2006-05-23 06:49:31 UTC (rev 108) @@ -1,16 +1,144 @@ from SCons.Environment import Environment as Environment from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment +from os.path import join as pjoin +from os.path import isdir as isdir +from os.path import isfile as isfile +from os.path import exists as exists +from os import environ as environ -def ConfigureHLVM(env): - conf = env.Configure() - CheckStdCXXHeaders(conf,env) - CheckForLibXML2(conf,env) - CheckForAPR(conf,env) - CheckForAPRU(conf,env) - CheckForLLVM(conf,env) - env = conf.Finish() +def CheckProgram(context,progname,varname,moredirs=[]): + ret = 0 + context.Message("Checking for " + progname + "...") + PATH = environ['PATH'] + dirs = PATH.split(':') + moredirs + for dir in dirs: + fname = pjoin(dir,progname) + if exists(fname) and isfile(fname): + context.env[varname] = fname + ret = 1 + break; + context.Result(ret) + return ret -def CheckStdCXXHeaders(env): + +def AskForDirs(context,pkgname,hdr,lib): + hdrdir = _getline(context.env, + 'Enter directory containing %(name)s headers: ' % {'name':pkgname } + ) + hdrpath = pjoin(hdrdir,hdr) + if isfile(hdrpath): + libdir = _getline(context.env, + 'Enter directory containing %(name)s libraries: ' % { 'name':pkgname } + ) + libpath = pjoin(libdir,context.env['LIBPREFIX']) + libpath += lib + libpath += context.env['LIBSUFFIX'] + if isfile(libpath): + context.env[pkgname + '_lib'] = libdir + context.env[pkgname + '_inc'] = hdrdir + context.env.AppendUnique(LIBPATH=[libdir],CPPPATH=[hdrdir]) + return 1 + else: + print "Didn't find ",pkgname," libraries in ",libpath,". Try again." + return AskForDirs(context,pkgname,hdr,lib) + else: + print "Didn't find ",pkgname," headers in ",hdrpath,". Try again." + return AskForDirs(context,pkgname,hdr,lib) + +def FindPackage(context,pkgname,hdr,libs,code='main(argc,argv);',paths=[], + objs=[], hdrpfx=''): + msg = 'Checking for ' + pkgname + '...' + context.Message(msg) + lastLIBS = context.env['LIBS'] + lastLIBPATH = context.env['LIBPATH'] + lastCPPPATH= context.env['CPPPATH'] + lastLINKFLAGS = context.env['LINKFLAGS'] + prog_template = """ +#include <%(include)s> +int main(int argc, char **argv) { + %(code)s + return 0; +} +""" + context.env.AppendUnique(LIBS = libs) + paths += ['/proj','/proj/install','/opt/','/sw','/usr/local','/usr','/'] + for p in paths: + for ldir in ['lib','bin','libexec','libs','LIBS']: + libdir = pjoin(p,ldir) + if not isdir(libdir): + continue + for alib in libs: + library = pjoin(libdir,context.env['LIBPREFIX']) + library += alib + context.env['LIBSUFFIX'] + if not exists(library): + continue + objects = " " + count = 0 + for o in objs: + obj = pjoin(libdir,context.env['OBJPREFIX']) + obj += o + context.env['OBJSUFFIX'] + if not exists(obj): + continue; + else: + count += 1 + objects += obj + " " + if count != len(objs): + continue + for incdir in ['include', 'inc', 'incl']: + hdrdir = pjoin(p,incdir) + if not isdir(hdrdir): + continue + if hdrpfx != '': + hdrdir = pjoin(hdrdir,hdrpfx) + if not exists(hdrdir): + continue + header = pjoin(hdrdir,hdr) + if not exists(hdrdir): + continue + context.env.AppendUnique(LIBPATH = [libdir]) + context.env.AppendUnique(CPPPATH = [hdrdir]) + context.env.AppendUnique(LINKFLAGS = objects) + ret = context.TryRun( + prog_template % {'include':hdr,'code':code},'.cpp' + ) + if not ret: + context.env.Replace(LIBS=lastLIBS, LIBPATH=lastLIBPATH, + CPPPATH=lastCPPPATH, LINKFLAGS=lastLINKFLAGS) + continue + context.env[pkgname + '_lib'] = libdir + context.env[pkgname + '_inc'] = hdrdir + context.Result('Found: (' + hdrdir + ',' + libdir + ')') + return [libdir,hdrdir] + context.Result( 'Not Found' ) + return AskForDirs(context,pkgname,hdr,libs) + +def _getline(env,msg): + response = raw_input(msg) + if response == 'quit' or response == "exit": + print "Configuration terminated by user" + env.Exit(1) + return response + +def FindLLVM(conf,env): + code = 'llvm::Module* M = new llvm::Module("Name");' + return conf.FindPackage('LLVM','llvm/Module.h',['LLVMSupport','LLVMSystem'], + code,['/proj/install/llvm'],['LLVMCore','LLVMbzip2']) + +def FindAPR(conf,env): + code = 'apr_initialize();' + return conf.FindPackage('APR',pjoin('apr-1','apr_general.h'),['apr-1'],code) + +def FindAPRU(conf,env): + code = 'apu_version_string();' + return conf.FindPackage('APRU',pjoin('apr-1','apu_version.h'),['aprutil-1'], + code) + +def FindLibXML2(conf,env): + code = 'xmlNewParserCtxt();' + return conf.FindPackage('LIBXML2',pjoin('libxml','parser.h'),['xml2'],code, + [],[],'libxml2') + +def CheckStdCXXHeaders(conf,env): if not conf.CheckCXXHeader('vector'): env.Exit(1) if not conf.CheckCXXHeader('map'): @@ -19,19 +147,33 @@ env.Exit(1) if not conf.CheckCXXHeader('iostream'): env.Exit(1) + return 1 -def CheckForLibXML2(conf,env): +def CheckForPrograms(conf,env): + if not conf.CheckProgram('gperf','GPERF'): + env.Exit(1) + return 1 -def CheckForAPR(conf,env): +#dnl AC_PATH_PROG(path_EGREP, egrep, egrep) +#dnl AC_PATH_PROG(path_GPP, g++, g++) +#dnl AC_PATH_PROG(path_GPROF, gprof, gprof) +#dnl AC_PATH_PROG(path_PERL, perl, perl) +#dnl AC_PATH_PROG(path_PKGDATA, pkgdata, pkgdata) +#dnl AC_PATH_PROG(path_SORT, sort, sort) +#dnl AC_PATH_PROG(path_UNIQ, uniq, uniq) -def CheckForAPRU(conf,env): - -def CheckForLLVM(conf,env): - if not conf.CheckLibWithHeader( - libs='LLVMCore', - header='llvm/Module.h', - language='c++', - call='llvm::Module* m = new llvm::Module("name")', - autoadd=1): - env.Exit(1) - return env +def ConfigureHLVM(env): + conf = env.Configure(custom_tests = { + 'FindPackage':FindPackage, 'AskForDirs':AskForDirs, + 'CheckProgram':CheckProgram }, + conf_dir=pjoin(env['BuildDir'],'conftest'), + log_file=pjoin(env['BuildDir'],'config.log') + ) + env['LIBS'] = "" + CheckForPrograms(conf,env) + CheckStdCXXHeaders(conf,env) + FindLibXML2(conf,env) + FindAPR(conf,env) + FindAPRU(conf,env) + FindLLVM(conf,env) + return conf.Finish() Modified: scons/environment.py =================================================================== --- scons/environment.py 2006-05-23 04:49:44 UTC (rev 107) +++ scons/environment.py 2006-05-23 06:49:31 UTC (rev 108) @@ -2,18 +2,20 @@ # # Import stuff we need from SCons package -from string import join +from os.path import join as pjoin from SCons.Options import Options as Options from SCons.Options import BoolOption as BoolOption +from SCons.Options import PathOption as PathOption from SCons.Environment import Environment as Environment from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment -def ProvisionEnvironment(env): +def ProvisionEnvironment(env,targets,arguments): env.EnsurePythonVersion(2,3) env.EnsureSConsVersion(0,96) env.SetOption('implicit_cache',1) env.TargetSignatures('build') - opts = Options('custom.py') + VariantName='' + opts = Options('custom.py',arguments) opts.AddOptions( BoolOption('assrt','Include assertions in the code',1), BoolOption('debug','Build with debug options turned on',1), @@ -21,28 +23,27 @@ BoolOption('optimize','Build object files with optimization',0), BoolOption('profile','Generate profiling aware code',0), BoolOption('small','Generate smaller code rather than faster',0), - BoolOption('config','Generation the configuration data',0) + BoolOption('config','Generation the configuration data',0), + PathOption('prefix','Specify where to install HLVM','/usr/local') ) opts.Update(env) - env['CC'] = 'gcc' - env['CCFLAGS'] = '-pipe -Wall -Wcast-align -Wpointer-arith' - env['CXXFLAGS'] = join([ - "-pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated -Wold-style-cast", - "-Woverloaded-virtual -ffor-scope -fno-operator-names"]) + env['CC'] = 'g++' + env['CCFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith' + env['CXXFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated' + env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -ffor-scope' + env['CXXFLAGS']+= ' -fno-operator-names' env['CPPDEFINES'] = { '__STDC_LIMIT_MACROS':None } - env.Prepend(CPPPATH='#') - VariantName='' if env['small'] == 1: VariantName='S' - env.Append(CCFLAGS='-Os') - env.Append(CXXFLAGS='-Os') + env.Append(CCFLAGS=' -Os') + env.Append(CXXFLAGS=' -Os') else : VariantName='s' if env['profile'] == 1: VariantName+='P' - env.Append(CCFLAGS='-pg') - env.Append(CXXFLAGS='-pg') + env.Append(CCFLAGS=' -pg') + env.Append(CXXFLAGS=' -pg') else : VariantName+='p' @@ -54,8 +55,8 @@ if env['debug'] == 1 : VariantName += 'D' - env.Append(CCFLAGS='-g') - env.Append(CXXFLAGS='-g') + env.Append(CCFLAGS=' -g') + env.Append(CXXFLAGS=' -g') env.Append(CPPDEFINES={'HLVM_DEBUG':None}) else : VariantName+='d' @@ -64,20 +65,30 @@ VariantName+='I' else : VariantName+='i' - env.Append(CXXFLAGS='-fno-inline') + env.Append(CXXFLAGS=' -fno-inline') if env['optimize'] == 1 : VariantName+='O' - env.APpend(CCFLAGS='-O3') - env.Append(CXXFLAGS='-O3') + env.Append(CCFLAGS=' -O3') + env.Append(CXXFLAGS=' -O3') else : VariantName+='o' - env.Append(CCFLAGS='-O1') - env.Append(CXXFLAGS='-O1') + env.Append(CCFLAGS=' -O1') + env.Append(CXXFLAGS=' -O1') + BuildDir = 'build.' + VariantName env['Variant'] = VariantName - env['BuildDir'] = 'build.' - env['BuildDir'] += VariantName + env['BuildDir'] = BuildDir + env['LIBPATH'] = [ + pjoin(BuildDir,'hlvm/Base'), + pjoin(BuildDir,'hlvm/AST'), + pjoin(BuildDir,'hlvm/Reader/XML'), + pjoin(BuildDir,'hlvm/Writer/XML') + ]; + env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0) + env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0) + env.Prepend(CPPPATH=[pjoin('#',BuildDir)]) + env.Prepend(CPPPATH=['#']) opts.Save('options.cache', env) env.Help(opts.GenerateHelpText(env,sort=cmp)) Added: scons/filterbuilders.py =================================================================== --- scons/filterbuilders.py 2006-05-23 04:49:44 UTC (rev 107) +++ scons/filterbuilders.py 2006-05-23 06:49:31 UTC (rev 108) @@ -0,0 +1,113 @@ +from SCons.Environment import Environment as Environment +from environment import ProvisionEnvironment as ProvisionEnvironment +import re,fileinput,os +from string import join as sjoin +from os.path import join as pjoin + +def _sedit(input,output,substs): + res = [] + f=open(output[0].path,'w') + for subst in substs: + res.append(re.compile(subst[0])) + for line in fileinput.input(input[0].path): + count = 0 + for r in res: + line = res[count].sub(substs[count][1],line,0) + count += 1 + f.write(line) + f.close() + +def QuoteSourceAction(target,source,env): + substs = [['[\\\\]','\\\\\\\\'],['"','\\"'],['^(.*)$','"\\1"']] + _sedit(source,target,substs) + +def QuoteSourceMessage(target,source,env): + return "Converting %s to %s as quoted source" % (source[0],target[0]) + +def RNGQuoteSource(env): + a = env.Action(QuoteSourceAction,QuoteSourceMessage) + b = env.Builder(action=a,suffix='inc',src_suffix='rng',single_source=1) + env.Append(BUILDERS = {'RNGQuoteSource':b}) + return b + +def getSchemaTokens(fname): + elemPat = re.compile(']*name="([^"]*)"') + attrPat = re.compile(']*name="([^"]*)"') + valuPat = re.compile('\s*([^<\s]*)') + tokens = [] + for line in fileinput.input(fname): + tokens += elemPat.findall(line) + tokens += attrPat.findall(line) + tokens += valuPat.findall(line) + dict = {} + for tok in tokens: + dict[tok] = 1 + result = list(dict.keys()) + result.sort() + return result + +def processFile(preamble,tmplt,output,substs): + res = [] + for subst in substs: + res.append(re.compile(subst[0])) + outf = open(output,"w") + for infile in [preamble,tmplt]: + for line in fileinput.input(infile): + count = 0 + for r in res: + line = res[count].sub(substs[count][1],line,0) + count += 1 + outf.write(line) + outf.close() + +def RNGTokenizerAction(target,source,env): + tgtDir = target[0].dir.path + ModulePath = re.sub(pjoin(env['BuildDir'],'hlvm','')+'(.*)','\\1',tgtDir) + Module = re.sub('[/\\\\]','_',ModulePath) + Schema = re.sub('.*/(.*).rng','\\1',source[0].path) + PreambleFile = "utils/tmplt/Preamble_Code"; + HeaderTemplate = "utils/tmplt/Tokenizer_Template.h"; + SourceTemplate = "utils/tmplt/Tokenizer_Template.cpp"; + HeaderFile = pjoin(tgtDir,Schema) + "Tokenizer.h"; + SourceFile = pjoin(tgtDir,Schema) + "Tokenizer.cpp"; + TokenHashClass = Schema + "TokenHash"; + TokenHashFile = pjoin(tgtDir,TokenHashClass) + ".i"; + tokens = [] + tokens = getSchemaTokens(source[0].path) + tknFilename = pjoin(tgtDir,Schema) + "Tokens.tmp" + tknFile = open(tknFilename,"w") + tknFile.write('struct TokenMap {\n') + tknFile.write('const char *name; hlvm::'+Schema+'Tokens token;\n') + tknFile.write('};\n%%\n') + for tkn in tokens: + tknFile.write('"' + tkn + '", hlvm::TKN_' + tkn + ',\n') + tknFile.write('%%\n') + tknFile.close() + gperfAction = env.Action( + "$GPERF -tcDCIoGl --fast 0 -L C++ -Z " + TokenHashClass + + " -s 2 -S 1 -k '*' " + tknFilename + " >" + TokenHashFile) + env.Execute(gperfAction) + tokenList = "TKN_" + for tkn in tokens: + tokenList += "TKN_" + tkn + ",\n " + from datetime import date + substs = [ + ['%SCHEMA_NAME%',Schema], + ['%AUTHOR%','Generated By HLVM build system'], + ['%DATE%',date.today().strftime('%c')], + ['%MODULE%',Module], + ['%MODULE_PATH%',ModulePath], + ['%TOKEN_LIST%',tokenList] + ] + processFile(PreambleFile,HeaderTemplate,HeaderFile,substs) + processFile(PreambleFile,SourceTemplate,SourceFile,substs) + return 0 + +def RNGTokenizerMessage(target,source,env): + return "Generating Perfect Hash Tokenizer For " + source[0].path + +def RNGTokenizer(env): + a = env.Action(RNGTokenizerAction,RNGTokenizerMessage) + b = env.Builder(action=a,suffix='h',src_suffix='rng',single_source=1) + env.Append(BUILDERS = {'RNGTokenizer':b}) + Modified: scons/main.py =================================================================== --- scons/main.py 2006-05-23 04:49:44 UTC (rev 107) +++ scons/main.py 2006-05-23 06:49:31 UTC (rev 108) @@ -1,9 +1,38 @@ from SCons.Environment import Environment as Environment from environment import ProvisionEnvironment as ProvisionEnvironment -def GetBuildEnvironment(targets): +from configure import ConfigureHLVM as ConfigureHLVM +from os import path as path +from string import join as sjoin +from string import replace as strrepl +import glob +def GetBuildEnvironment(targets,arguments): env = Environment(); - env = ProvisionEnvironment(env) - if env['config'] == 1: - from configure import ConfigureHLVM as ConfigureHLVM - env = ConfigureHLVM(env) - return env + env['HLVM_Copyright'] = 'Copyright (c) 2006 Reid Spencer' + env['HLVM_Maintainer'] = 'Reid Spencer ' + env['HLVM_Version'] = '0.1svn' + env['HLVM_SO_CURRENT'] = '0' + env['HLVM_SO_REVISION'] = '1' + env['HLVM_SO_AGE'] = '0' + env['HLVM_SO_VERSION'] = env['HLVM_SO_CURRENT']+':'+env['HLVM_SO_REVISION'] + env['HLVM_SO_VERSION'] += ':' + env['HLVM_SO_AGE'] + ProvisionEnvironment(env,targets,arguments) + return ConfigureHLVM(env) + +def GetAllCXXFiles(env): + dir = env.Dir('.').abspath + dir = strrepl(dir,path.join(env['BuildDir'],''),'',1) + p1 = glob.glob(path.join(dir,'*.cpp')) + p2 = glob.glob(path.join(dir,'*.cxx')) + p3 = glob.glob(path.join(dir,'*.C')) + return env.Flatten([p1,p2,p3]) + +def GetRNGQuoteSource(env): + from scons import filterbuilders + return filterbuilders.RNGQuoteSource(env) + +def GetRNGTokenizer(env): + from scons import filterbuilders + return filterbuilders.RNGTokenizer(env) + +def join(one,two): + return path.join([one,two]) Modified: tools/SConscript =================================================================== --- tools/SConscript 2006-05-23 04:49:44 UTC (rev 107) +++ tools/SConscript 2006-05-23 06:49:31 UTC (rev 108) @@ -1,3 +1,4 @@ -SConscript([ +Import('env') +env.SConscript([ 'hlvm-xml2xml/SConscript' ]) Added: tools/hlvm-xml2xml/SConscript =================================================================== --- tools/hlvm-xml2xml/SConscript 2006-05-23 04:49:44 UTC (rev 107) +++ tools/hlvm-xml2xml/SConscript 2006-05-23 06:49:31 UTC (rev 108) @@ -0,0 +1,4 @@ +from scons import main +Import('env') +env.Program('hlvm-xml2xml', main.GetAllCXXFiles(env), + LIBS=['HLVMAST','HLVMXMLReader','HLVMXMLWriter','HLVMBase','xml2','LLVMSupport']) _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 01:55:23 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 02:55:23 -0400 Subject: [hlvm-commits] r109 - scons Message-ID: <200605230655.k4N6tN0m019020@sneezy.swagora.com> Author: reid Date: 2006-05-23 02:55:23 -0400 (Tue, 23 May 2006) New Revision: 109 Log: Ignore *.pyc files. Modified: scons/ Property changes on: scons ___________________________________________________________________ Name: svn:ignore + *.pyc _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 01:57:58 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 02:57:58 -0400 Subject: [hlvm-commits] r110 - in autoconf: . m4 Message-ID: <200605230657.k4N6vwq1019037@sneezy.swagora.com> Author: reid Date: 2006-05-23 02:57:57 -0400 (Tue, 23 May 2006) New Revision: 110 Log: Ignore generated files. Modified: autoconf/ autoconf/m4/ Property changes on: autoconf ___________________________________________________________________ Name: svn:ignore + autom4te.cache aclocal.m4 Property changes on: autoconf/m4 ___________________________________________________________________ Name: svn:ignore + aclocal.m4 _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 02:32:25 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 03:32:25 -0400 Subject: [hlvm-commits] r111 - / hlvm/AST hlvm/Base hlvm/Reader/XML scons tools/hlvm-xml2xml Message-ID: <200605230732.k4N7WP26020348@sneezy.swagora.com> Author: reid Date: 2006-05-23 03:32:24 -0400 (Tue, 23 May 2006) New Revision: 111 Log: Get the last few scons nigglies out of the way. Everything builds now. Modified: / hlvm/AST/SConscript hlvm/Base/SConscript hlvm/Reader/XML/SConscript scons/configure.py scons/environment.py scons/filterbuilders.py tools/hlvm-xml2xml/SConscript Property changes on: ___________________________________________________________________ Name: svn:ignore + build.* .sconsign.dblite options.cache Modified: hlvm/AST/SConscript =================================================================== --- hlvm/AST/SConscript 2006-05-23 06:57:57 UTC (rev 110) +++ hlvm/AST/SConscript 2006-05-23 07:32:24 UTC (rev 111) @@ -1,3 +1,3 @@ from scons import main Import('env') -env.Library('HLVMast',main.GetAllCXXFiles(env)) +env.Library('HLVMAST',main.GetAllCXXFiles(env)) Modified: hlvm/Base/SConscript =================================================================== --- hlvm/Base/SConscript 2006-05-23 06:57:57 UTC (rev 110) +++ hlvm/Base/SConscript 2006-05-23 07:32:24 UTC (rev 111) @@ -1,3 +1,3 @@ Import('env') from scons import main -env.Library('HLVMbase',main.GetAllCXXFiles(env)) +env.Library('HLVMBase',main.GetAllCXXFiles(env)) Modified: hlvm/Reader/XML/SConscript =================================================================== --- hlvm/Reader/XML/SConscript 2006-05-23 06:57:57 UTC (rev 110) +++ hlvm/Reader/XML/SConscript 2006-05-23 07:32:24 UTC (rev 111) @@ -4,4 +4,4 @@ main.GetRNGTokenizer(env) env.RNGQuoteSource('HLVM.rng.inc','HLVM.rng') env.RNGTokenizer('HLVMTokenizer.cpp','HLVM.rng') -env.Library('HLVMXMLReader',main.GetAllCXXFiles(env)) +env.Library('HLVMXMLReader',main.GetAllCXXFiles(env)+['HLVMTokenizer.cpp']) Modified: scons/configure.py =================================================================== --- scons/configure.py 2006-05-23 06:57:57 UTC (rev 110) +++ scons/configure.py 2006-05-23 07:32:24 UTC (rev 111) @@ -72,7 +72,7 @@ library += alib + context.env['LIBSUFFIX'] if not exists(library): continue - objects = " " + objects = [] count = 0 for o in objs: obj = pjoin(libdir,context.env['OBJPREFIX']) @@ -81,7 +81,8 @@ continue; else: count += 1 - objects += obj + " " + objects.append(obj) + print "objects(",len(objects),"=",objects if count != len(objs): continue for incdir in ['include', 'inc', 'incl']: @@ -105,6 +106,8 @@ context.env.Replace(LIBS=lastLIBS, LIBPATH=lastLIBPATH, CPPPATH=lastCPPPATH, LINKFLAGS=lastLINKFLAGS) continue + else: + context.env.Replace(LIBS=lastLIBS, LINKFLAGS=lastLINKFLAGS) context.env[pkgname + '_lib'] = libdir context.env[pkgname + '_inc'] = hdrdir context.Result('Found: (' + hdrdir + ',' + libdir + ')') Modified: scons/environment.py =================================================================== --- scons/environment.py 2006-05-23 06:57:57 UTC (rev 110) +++ scons/environment.py 2006-05-23 07:32:24 UTC (rev 111) @@ -80,15 +80,17 @@ env['Variant'] = VariantName env['BuildDir'] = BuildDir env['LIBPATH'] = [ - pjoin(BuildDir,'hlvm/Base'), - pjoin(BuildDir,'hlvm/AST'), - pjoin(BuildDir,'hlvm/Reader/XML'), - pjoin(BuildDir,'hlvm/Writer/XML') + pjoin('#',BuildDir,'hlvm/Base'), + pjoin('#',BuildDir,'hlvm/AST'), + pjoin('#',BuildDir,'hlvm/Reader/XML'), + pjoin('#',BuildDir,'hlvm/Writer/XML') ]; + print 'LIBPATH=',env['LIBPATH'] env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0) env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0) env.Prepend(CPPPATH=[pjoin('#',BuildDir)]) env.Prepend(CPPPATH=['#']) + env.SConsignFile(pjoin(BuildDir,'sconsign')) opts.Save('options.cache', env) env.Help(opts.GenerateHelpText(env,sort=cmp)) Modified: scons/filterbuilders.py =================================================================== --- scons/filterbuilders.py 2006-05-23 06:57:57 UTC (rev 110) +++ scons/filterbuilders.py 2006-05-23 07:32:24 UTC (rev 111) @@ -77,17 +77,17 @@ tknFilename = pjoin(tgtDir,Schema) + "Tokens.tmp" tknFile = open(tknFilename,"w") tknFile.write('struct TokenMap {\n') - tknFile.write('const char *name; hlvm::'+Schema+'Tokens token;\n') + tknFile.write('const char *name; HLVM_'+Module+'::'+Schema+'Tokens token;\n') tknFile.write('};\n%%\n') for tkn in tokens: - tknFile.write('"' + tkn + '", hlvm::TKN_' + tkn + ',\n') + tknFile.write('"' + tkn + '", HLVM_'+Module+'::TKN_' + tkn + ',\n') tknFile.write('%%\n') tknFile.close() gperfAction = env.Action( "$GPERF -tcDCIoGl --fast 0 -L C++ -Z " + TokenHashClass + " -s 2 -S 1 -k '*' " + tknFilename + " >" + TokenHashFile) env.Execute(gperfAction) - tokenList = "TKN_" + tokenList = "" for tkn in tokens: tokenList += "TKN_" + tkn + ",\n " from datetime import date Modified: tools/hlvm-xml2xml/SConscript =================================================================== --- tools/hlvm-xml2xml/SConscript 2006-05-23 06:57:57 UTC (rev 110) +++ tools/hlvm-xml2xml/SConscript 2006-05-23 07:32:24 UTC (rev 111) @@ -1,4 +1,15 @@ from scons import main Import('env') env.Program('hlvm-xml2xml', main.GetAllCXXFiles(env), - LIBS=['HLVMAST','HLVMXMLReader','HLVMXMLWriter','HLVMBase','xml2','LLVMSupport']) + LIBS=[ + 'HLVMXMLReader', + 'HLVMXMLWriter', + 'HLVMAST', + 'HLVMBase', + 'xml2', + 'LLVMSupport', + 'LLVMSystem', + 'apr-1', + 'stdc++' + ] +) _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 02:40:35 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 03:40:35 -0400 Subject: [hlvm-commits] r112 - scons Message-ID: <200605230740.k4N7eZjO020364@sneezy.swagora.com> Author: reid Date: 2006-05-23 03:40:34 -0400 (Tue, 23 May 2006) New Revision: 112 Log: Remove a debug print statement and use a better utility for finding programs. Modified: scons/configure.py Modified: scons/configure.py =================================================================== --- scons/configure.py 2006-05-23 07:32:24 UTC (rev 111) +++ scons/configure.py 2006-05-23 07:40:34 UTC (rev 112) @@ -7,16 +7,11 @@ from os import environ as environ def CheckProgram(context,progname,varname,moredirs=[]): - ret = 0 context.Message("Checking for " + progname + "...") - PATH = environ['PATH'] - dirs = PATH.split(':') + moredirs - for dir in dirs: - fname = pjoin(dir,progname) - if exists(fname) and isfile(fname): - context.env[varname] = fname - ret = 1 - break; + fname = context.env.WhereIs(progname,environ['PATH']) + ret = fname != None + if ret: + context.env[varname] = fname context.Result(ret) return ret @@ -82,7 +77,6 @@ else: count += 1 objects.append(obj) - print "objects(",len(objects),"=",objects if count != len(objs): continue for incdir in ['include', 'inc', 'incl']: _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 04:44:35 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 05:44:35 -0400 Subject: [hlvm-commits] r113 - / scons test test/lib Message-ID: <200605230944.k4N9iZCY025840@sneezy.swagora.com> Author: reid Date: 2006-05-23 05:44:34 -0400 (Tue, 23 May 2006) New Revision: 113 Log: Get DejaGnu working with scons Added: scons/check.py test/SConscript Modified: SConstruct scons/configure.py scons/environment.py scons/filterbuilders.py scons/main.py test/lib/identity.exp Modified: SConstruct =================================================================== --- SConstruct 2006-05-23 07:40:34 UTC (rev 112) +++ SConstruct 2006-05-23 09:44:34 UTC (rev 113) @@ -6,6 +6,6 @@ from scons import main env = main.GetBuildEnvironment(COMMAND_LINE_TARGETS,ARGUMENTS) Export('env') - -SConscript(path.join(env['BuildDir'],'hlvm','SConscript')) -SConscript(path.join(env['BuildDir'],'tools','SConscript')) +main.Dirs(env,['hlvm','tools','test']) +if 'check' in COMMAND_LINE_TARGETS: + main.GetCheck(env) Added: scons/check.py =================================================================== --- scons/check.py 2006-05-23 07:40:34 UTC (rev 112) +++ scons/check.py 2006-05-23 09:44:34 UTC (rev 113) @@ -0,0 +1,61 @@ +from SCons.Environment import Environment as Environment +from environment import ProvisionEnvironment as ProvisionEnvironment +import re,fileinput,os,glob +from string import join as sjoin +from os.path import join as pjoin + +def getTestCases(dir,env): + context = pjoin(env['AbsSrcRoot'],'test',dir) + result = [] + for d in glob.glob(pjoin(context,'*.*')): + if not os.path.isdir(d): + if not d == pjoin(context,'dg.exp'): + result.append(d) + return result + +def SiteExpAction(target,source,env): + tgtpath = pjoin(env['AbsObjRoot'],'test') + outf = open(pjoin(tgtpath,'site.exp'),"w") + outf.write('## these variables are automatically generated by make ##\n') + outf.write('# Do not edit here. If you wish to override these values\n') + outf.write('# edit the last section\n') + outf.write('set target_triplet "fubar-pc-noos"\n') + outf.write('set srcdir "' + env['AbsSrcRoot'] + '/test"\n') + outf.write('set objdir "' + env['AbsObjRoot'] + '/test"\n') + outf.write('set tmpdir "$objdir/tmp"\n') + outf.write('set srcrootdir "' + env['AbsSrcRoot'] + '"\n') + outf.write('set objrootdir "' + env['AbsObjRoot'] + '"\n') + outf.write('## All vars above are generated by scons. Do Not Edit!\n') + outf.close() + return 0 + +def SiteExpMessage(target,source,env): + return "Building DejaGnu site.exp file" + +def CheckAction(target,source,env): + if env['RUNTEST'] == None: + print "Testing was disabled because DejaGnu 'runtest' was not found" + return 0 + + context = os.path.basename(env.File(target[0]).path) + context = re.sub('(.*?)\..*','\\1',context) + print "context=",context + os.system('DEJAGNU="'+pjoin(env['AbsObjRoot'],'test','site.exp')+'" '+ + env['RUNTEST'] + ' --tool ' + context) + return 0 + +def CheckMessage(target,source,env): + return "Running DejaGNU Test Suite" + +def Check(env): + checkAction = env.Action(CheckAction,CheckMessage) + checkBuilder = env.Builder(action=checkAction,suffix='results') + sitexpAction = env.Action(SiteExpAction,SiteExpMessage) + sitexpBuilder = env.Builder(action=sitexpAction,suffix='exp') + env.Append(BUILDERS = {'Check':checkBuilder,'SiteExp':sitexpBuilder}) + env.SiteExp('#test/site.exp',[]) + env.Check(['#test/xml2xml.sum','#test/xml2xml.log'], + getTestCases('xml2xml',env)+['#test/site.exp']) + env.Alias('check','#test/xml2xml.log') + return 1 + Modified: scons/configure.py =================================================================== --- scons/configure.py 2006-05-23 07:40:34 UTC (rev 112) +++ scons/configure.py 2006-05-23 09:44:34 UTC (rev 113) @@ -149,6 +149,9 @@ def CheckForPrograms(conf,env): if not conf.CheckProgram('gperf','GPERF'): env.Exit(1) + if not conf.CheckProgram('runtest','RUNTEST'): + env['RUNTEST'] = None + print "*** TESTING DISABLED ***" return 1 #dnl AC_PATH_PROG(path_EGREP, egrep, egrep) Modified: scons/environment.py =================================================================== --- scons/environment.py 2006-05-23 07:40:34 UTC (rev 112) +++ scons/environment.py 2006-05-23 09:44:34 UTC (rev 113) @@ -27,7 +27,6 @@ PathOption('prefix','Specify where to install HLVM','/usr/local') ) opts.Update(env) - env['CC'] = 'g++' env['CCFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith' env['CXXFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated' env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -ffor-scope' @@ -79,13 +78,14 @@ BuildDir = 'build.' + VariantName env['Variant'] = VariantName env['BuildDir'] = BuildDir + env['AbsObjRoot'] = env.Dir(BuildDir).abspath + env['AbsSrcRoot'] = env.Dir('#').abspath env['LIBPATH'] = [ pjoin('#',BuildDir,'hlvm/Base'), pjoin('#',BuildDir,'hlvm/AST'), pjoin('#',BuildDir,'hlvm/Reader/XML'), pjoin('#',BuildDir,'hlvm/Writer/XML') ]; - print 'LIBPATH=',env['LIBPATH'] env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0) env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0) env.Prepend(CPPPATH=[pjoin('#',BuildDir)]) Modified: scons/filterbuilders.py =================================================================== --- scons/filterbuilders.py 2006-05-23 07:40:34 UTC (rev 112) +++ scons/filterbuilders.py 2006-05-23 09:44:34 UTC (rev 113) @@ -20,6 +20,7 @@ def QuoteSourceAction(target,source,env): substs = [['[\\\\]','\\\\\\\\'],['"','\\"'],['^(.*)$','"\\1"']] _sedit(source,target,substs) + return 0 def QuoteSourceMessage(target,source,env): return "Converting %s to %s as quoted source" % (source[0],target[0]) @@ -110,4 +111,5 @@ a = env.Action(RNGTokenizerAction,RNGTokenizerMessage) b = env.Builder(action=a,suffix='h',src_suffix='rng',single_source=1) env.Append(BUILDERS = {'RNGTokenizer':b}) + return 1 Modified: scons/main.py =================================================================== --- scons/main.py 2006-05-23 07:40:34 UTC (rev 112) +++ scons/main.py 2006-05-23 09:44:34 UTC (rev 113) @@ -34,5 +34,13 @@ from scons import filterbuilders return filterbuilders.RNGTokenizer(env) +def GetCheck(env): + from scons import check + return check.Check(env) + +def Dirs(env,dirlist=[]): + for d in dirlist: + env.SConscript(path.join(env['BuildDir'],d,'SConscript')) + def join(one,two): return path.join([one,two]) Added: test/SConscript =================================================================== --- test/SConscript 2006-05-23 07:40:34 UTC (rev 112) +++ test/SConscript 2006-05-23 09:44:34 UTC (rev 113) @@ -0,0 +1,3 @@ +# +Import('env') +from scons import main Modified: test/lib/identity.exp =================================================================== --- test/lib/identity.exp 2006-05-23 07:40:34 UTC (rev 112) +++ test/lib/identity.exp 2006-05-23 09:44:34 UTC (rev 113) @@ -23,7 +23,7 @@ proc hlvm-identity-tests { prog pat } { global srcdir subdir objdir tmpdir objrootdir set outdir [file join $objdir $subdir] - set tool [file join $objrootdir Debug bin $prog ] + set tool [file join $objrootdir tools $prog $prog ] set source [file join $srcdir $subdir ] set files [lsort [ glob -nocomplain -tails -types {f r} -directory $source $pat]] _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 05:05:42 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 06:05:42 -0400 Subject: [hlvm-commits] r114 - hlvm/Reader/XML Message-ID: <200605231005.k4NA5gMX026265@sneezy.swagora.com> Author: reid Date: 2006-05-23 06:05:41 -0400 (Tue, 23 May 2006) New Revision: 114 Log: Fix some warnings that only show up on non-assert builds. Modified: hlvm/Reader/XML/XMLReader.cpp Modified: hlvm/Reader/XML/XMLReader.cpp =================================================================== --- hlvm/Reader/XML/XMLReader.cpp 2006-05-23 09:44:34 UTC (rev 113) +++ hlvm/Reader/XML/XMLReader.cpp 2006-05-23 10:05:41 UTC (rev 114) @@ -183,6 +183,7 @@ default: break; } hlvmDeadCode("Invalid boolean value"); + return 0; } inline const char* @@ -376,6 +377,7 @@ } } hlvmAssert(!"Atom definition element expected"); + return 0; } Type* @@ -548,8 +550,7 @@ error("No root node"); return; } - int tkn = getToken(cur->name); - hlvmAssert(tkn == TKN_hlvm && "Expecting hlvm element"); + hlvmAssert(getToken(cur->name) == TKN_hlvm && "Expecting hlvm element"); cur = cur->children; if (skipBlanks(cur)) { Bundle* bundle = parseBundle(cur); _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 14:45:18 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 15:45:18 -0400 Subject: [hlvm-commits] r115 - / hlvm hlvm/AST hlvm/Base hlvm/Reader hlvm/Reader/XML hlvm/Writer hlvm/Writer/XML scons test tools tools/hlvm tools/hlvm-xml2xml Message-ID: <200605231945.k4NJjIUQ023800@sneezy.swagora.com> Author: reid Date: 2006-05-23 15:45:16 -0400 (Tue, 23 May 2006) New Revision: 115 Log: scons changes: 1. implify the usage of the hlvm.Dirs 2. rename "main" as "hlvm" 3. Put headers in all the SConscript files 4. Add a shell for the HLVM virtual machine program as a way to test scons Added: scons/hlvm.py tools/hlvm/ tools/hlvm/SConscript tools/hlvm/hlvm.cpp Removed: scons/main.py Modified: / SConstruct hlvm/AST/SConscript hlvm/Base/SConscript hlvm/Reader/SConscript hlvm/Reader/XML/SConscript hlvm/SConscript hlvm/Writer/SConscript hlvm/Writer/XML/SConscript scons/check.py scons/environment.py scons/filterbuilders.py test/SConscript tools/SConscript tools/hlvm-xml2xml/SConscript Property changes on: ___________________________________________________________________ Name: svn:ignore - build.* .sconsign.dblite options.cache + build.* .options_cache Modified: SConstruct =================================================================== --- SConstruct 2006-05-23 10:05:41 UTC (rev 114) +++ SConstruct 2006-05-23 19:45:16 UTC (rev 115) @@ -1,11 +1,26 @@ -# HLVM scons Software Construction Specification -# - -# Set up scons -from os import path -from scons import main -env = main.GetBuildEnvironment(COMMAND_LINE_TARGETS,ARGUMENTS) +#===-- Build Script For HLVM ----------------------------------*- Python -*-===# +# +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +from scons import hlvm +env = hlvm.GetBuildEnvironment(COMMAND_LINE_TARGETS,ARGUMENTS) Export('env') -main.Dirs(env,['hlvm','tools','test']) -if 'check' in COMMAND_LINE_TARGETS: - main.GetCheck(env) +hlvm.Dirs(env,['hlvm','tools','test']) Modified: hlvm/AST/SConscript =================================================================== --- hlvm/AST/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ hlvm/AST/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -1,3 +1,27 @@ -from scons import main +#===-- Build Script For hlvm/AST ------------------------------*- Python -*-===# +# +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +# +from scons import hlvm Import('env') -env.Library('HLVMAST',main.GetAllCXXFiles(env)) +lib = env.Library('HLVMAST',hlvm.GetAllCXXFiles(env)) +hlvm.InstallLibrary(env,lib) Modified: hlvm/Base/SConscript =================================================================== --- hlvm/Base/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ hlvm/Base/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -1,3 +1,27 @@ +#===-- Build Script For hlvm/Base -----------------------------*- Python -*-===# +# +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +# Import('env') -from scons import main -env.Library('HLVMBase',main.GetAllCXXFiles(env)) +from scons import hlvm +lib = env.Library('HLVMBase',hlvm.GetAllCXXFiles(env)) +hlvm.InstallLibrary(env,lib) Modified: hlvm/Reader/SConscript =================================================================== --- hlvm/Reader/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ hlvm/Reader/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -1,2 +1,25 @@ +#===-- Build Script For hlvm/Reader ---------------------------*- Python -*-===# +# +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +from scons import hlvm Import('env') -SConscript('XML/SConscript') +hlvm.Dirs(env,['XML']) Modified: hlvm/Reader/XML/SConscript =================================================================== --- hlvm/Reader/XML/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ hlvm/Reader/XML/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -1,7 +1,32 @@ +#===-- Build Script For hlvm/Reader/XML -----------------------*- Python -*-===# +# +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +# Import('env') -from scons import main -main.GetRNGQuoteSource(env) -main.GetRNGTokenizer(env) +from scons import hlvm +hlvm.GetRNGQuoteSource(env) +hlvm.GetRNGTokenizer(env) env.RNGQuoteSource('HLVM.rng.inc','HLVM.rng') env.RNGTokenizer('HLVMTokenizer.cpp','HLVM.rng') -env.Library('HLVMXMLReader',main.GetAllCXXFiles(env)+['HLVMTokenizer.cpp']) +lib = env.Library('HLVMXMLReader', + hlvm.GetAllCXXFiles(env)+['HLVMTokenizer.cpp']) +hlvm.InstallLibrary(env,lib) Modified: hlvm/SConscript =================================================================== --- hlvm/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ hlvm/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -1,6 +1,26 @@ +#===-- Build Script For hlvm ----------------------------------*- Python -*-===# # +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +# +from scons import hlvm Import('env') -env.SConscript('Base/SConscript') -env.SConscript('AST/SConscript') -env.SConscript('Reader/SConscript') -env.SConscript('Writer/SConscript') +hlvm.Dirs(env,['Base','AST','Reader','Writer']) Modified: hlvm/Writer/SConscript =================================================================== --- hlvm/Writer/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ hlvm/Writer/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -1,2 +1,25 @@ +#===-- Build Script For hlvm/Writer ---------------------------*- Python -*-===# +# +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +from scons import hlvm Import('env') -SConscript('XML/SConscript') +hlvm.Dirs(env,['XML']) Modified: hlvm/Writer/XML/SConscript =================================================================== --- hlvm/Writer/XML/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ hlvm/Writer/XML/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -1,3 +1,26 @@ +#===-- Build Script For hlvm/Writer/XML -----------------------*- Python -*-===# +# +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +from scons import hlvm Import('env') -from scons import main -env.Library('HLVMXMLWriter',main.GetAllCXXFiles(env)) +lib = env.Library('HLVMXMLWriter',hlvm.GetAllCXXFiles(env)) +hlvm.InstallLibrary(env,lib) Modified: scons/check.py =================================================================== --- scons/check.py 2006-05-23 10:05:41 UTC (rev 114) +++ scons/check.py 2006-05-23 19:45:16 UTC (rev 115) @@ -1,5 +1,4 @@ from SCons.Environment import Environment as Environment -from environment import ProvisionEnvironment as ProvisionEnvironment import re,fileinput,os,glob from string import join as sjoin from os.path import join as pjoin @@ -40,7 +39,8 @@ context = os.path.basename(env.File(target[0]).path) context = re.sub('(.*?)\..*','\\1',context) print "context=",context - os.system('DEJAGNU="'+pjoin(env['AbsObjRoot'],'test','site.exp')+'" '+ + os.system('cd ' + pjoin(env['BuildDir'],'test') + + '; DEJAGNU="'+pjoin(env['AbsObjRoot'],'test','site.exp')+'" '+ env['RUNTEST'] + ' --tool ' + context) return 0 Modified: scons/environment.py =================================================================== --- scons/environment.py 2006-05-23 10:05:41 UTC (rev 114) +++ scons/environment.py 2006-05-23 19:45:16 UTC (rev 115) @@ -2,96 +2,3 @@ # # Import stuff we need from SCons package -from os.path import join as pjoin -from SCons.Options import Options as Options -from SCons.Options import BoolOption as BoolOption -from SCons.Options import PathOption as PathOption -from SCons.Environment import Environment as Environment -from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment - -def ProvisionEnvironment(env,targets,arguments): - env.EnsurePythonVersion(2,3) - env.EnsureSConsVersion(0,96) - env.SetOption('implicit_cache',1) - env.TargetSignatures('build') - VariantName='' - opts = Options('custom.py',arguments) - opts.AddOptions( - BoolOption('assrt','Include assertions in the code',1), - BoolOption('debug','Build with debug options turned on',1), - BoolOption('inline','Cause inline code to be inline',0), - BoolOption('optimize','Build object files with optimization',0), - BoolOption('profile','Generate profiling aware code',0), - BoolOption('small','Generate smaller code rather than faster',0), - BoolOption('config','Generation the configuration data',0), - PathOption('prefix','Specify where to install HLVM','/usr/local') - ) - opts.Update(env) - env['CCFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith' - env['CXXFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated' - env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -ffor-scope' - env['CXXFLAGS']+= ' -fno-operator-names' - env['CPPDEFINES'] = { '__STDC_LIMIT_MACROS':None } - if env['small'] == 1: - VariantName='S' - env.Append(CCFLAGS=' -Os') - env.Append(CXXFLAGS=' -Os') - else : - VariantName='s' - - if env['profile'] == 1: - VariantName+='P' - env.Append(CCFLAGS=' -pg') - env.Append(CXXFLAGS=' -pg') - else : - VariantName+='p' - - if env['assrt'] == 1: - VariantName+='A' - env.Append(CPPDEFINES={'HLVM_ASSERT':None}) - else : - VariantName+='a' - - if env['debug'] == 1 : - VariantName += 'D' - env.Append(CCFLAGS=' -g') - env.Append(CXXFLAGS=' -g') - env.Append(CPPDEFINES={'HLVM_DEBUG':None}) - else : - VariantName+='d' - - if env['inline'] == 1: - VariantName+='I' - else : - VariantName+='i' - env.Append(CXXFLAGS=' -fno-inline') - - if env['optimize'] == 1 : - VariantName+='O' - env.Append(CCFLAGS=' -O3') - env.Append(CXXFLAGS=' -O3') - else : - VariantName+='o' - env.Append(CCFLAGS=' -O1') - env.Append(CXXFLAGS=' -O1') - - BuildDir = 'build.' + VariantName - env['Variant'] = VariantName - env['BuildDir'] = BuildDir - env['AbsObjRoot'] = env.Dir(BuildDir).abspath - env['AbsSrcRoot'] = env.Dir('#').abspath - env['LIBPATH'] = [ - pjoin('#',BuildDir,'hlvm/Base'), - pjoin('#',BuildDir,'hlvm/AST'), - pjoin('#',BuildDir,'hlvm/Reader/XML'), - pjoin('#',BuildDir,'hlvm/Writer/XML') - ]; - env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0) - env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0) - env.Prepend(CPPPATH=[pjoin('#',BuildDir)]) - env.Prepend(CPPPATH=['#']) - env.SConsignFile(pjoin(BuildDir,'sconsign')) - - opts.Save('options.cache', env) - env.Help(opts.GenerateHelpText(env,sort=cmp)) - return env; Modified: scons/filterbuilders.py =================================================================== --- scons/filterbuilders.py 2006-05-23 10:05:41 UTC (rev 114) +++ scons/filterbuilders.py 2006-05-23 19:45:16 UTC (rev 115) @@ -1,5 +1,4 @@ from SCons.Environment import Environment as Environment -from environment import ProvisionEnvironment as ProvisionEnvironment import re,fileinput,os from string import join as sjoin from os.path import join as pjoin @@ -85,7 +84,7 @@ tknFile.write('%%\n') tknFile.close() gperfAction = env.Action( - "$GPERF -tcDCIoGl --fast 0 -L C++ -Z " + TokenHashClass + + env['GPERF'] + " -tcDCIoGl --fast 0 -L C++ -Z " + TokenHashClass + " -s 2 -S 1 -k '*' " + tknFilename + " >" + TokenHashFile) env.Execute(gperfAction) tokenList = "" Copied: scons/hlvm.py (from rev 113, scons/main.py) =================================================================== --- scons/main.py 2006-05-23 09:44:34 UTC (rev 113) +++ scons/hlvm.py 2006-05-23 19:45:16 UTC (rev 115) @@ -0,0 +1,178 @@ +from SCons.Options import Options as Options +from SCons.Options import BoolOption as BoolOption +from SCons.Options import PathOption as PathOption +from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment +from SCons.Environment import Environment as Environment +from configure import ConfigureHLVM as ConfigureHLVM +from os.path import join as pjoin +from string import join as sjoin +from string import replace as strrepl +import glob + +def GetAllCXXFiles(env): + dir = env.Dir('.').abspath + dir = strrepl(dir,pjoin(env['BuildDir'],''),'',1) + p1 = glob.glob(pjoin(dir,'*.cpp')) + p2 = glob.glob(pjoin(dir,'*.cxx')) + p3 = glob.glob(pjoin(dir,'*.C')) + return env.Flatten([p1,p2,p3]) + +def GetRNGQuoteSource(env): + from scons import filterbuilders + return filterbuilders.RNGQuoteSource(env) + +def GetRNGTokenizer(env): + from scons import filterbuilders + return filterbuilders.RNGTokenizer(env) + +def Dirs(env,dirlist=[]): + dir = env.Dir('.').path + top = env.Dir('#').path + if top == dir: + path = pjoin('#',env['BuildDir']) + else: + path = '' + print "Entering Directory",dir + result = [] + for d in dirlist: + result.append(pjoin(path,d,'SConscript')) + env.SConscript(result) + +def InstallProgram(env,prog): + dir = pjoin(env['prefix'],'bin') + env.Install(dir,prog) + env.Alias('install',dir) + return 1 + +def InstallLibrary(env,lib): + dir = pjoin(env['prefix'],'lib') + env.Install(dir,lib) + env.Alias('install',dir) + return 1 + +def InstallHeader(env,hdrname): + dir = pjoin(env['prefix'],'include') + env.Install(dir,hdrname) + env.Alias('install',dir) + return 1 + +def join(one,two): + return pjoin([one,two]) + +def GetBuildEnvironment(targets,arguments): + env = Environment(); + env.EnsurePythonVersion(2,3) + env.EnsureSConsVersion(0,96) + env.SetOption('implicit_cache',1) + env.TargetSignatures('build') + opts = Options('.options_cache',arguments) + opts.AddOptions( + BoolOption('assertions','Include assertions in the code',1), + BoolOption('debug','Build with debug options turned on',1), + BoolOption('inline','Cause inline code to be inline',0), + BoolOption('optimize','Build object files with optimization',0), + BoolOption('profile','Generate profiling aware code',0), + BoolOption('small','Generate smaller code rather than faster',0), + PathOption('prefix','Specify where to install HLVM','/usr/local') + ) + opts.Update(env) + opts.Save('.options_cache',env) + env['HLVM_Copyright'] = 'Copyright (c) 2006 Reid Spencer' + env['HLVM_Maintainer'] = 'Reid Spencer ' + env['HLVM_Version'] = '0.1svn' + env['HLVM_SO_CURRENT'] = '0' + env['HLVM_SO_REVISION'] = '1' + env['HLVM_SO_AGE'] = '0' + env['HLVM_SO_VERSION'] = env['HLVM_SO_CURRENT']+':'+env['HLVM_SO_REVISION'] + env['HLVM_SO_VERSION'] += ':' + env['HLVM_SO_AGE'] + env['CCFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith' + env['CXXFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated' + env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -ffor-scope' + env['CXXFLAGS']+= ' -fno-operator-names' + env['CPPDEFINES'] = { '__STDC_LIMIT_MACROS':None } + VariantName='' + if env['small'] == 1: + VariantName='S' + env.Append(CCFLAGS=' -Os') + env.Append(CXXFLAGS=' -Os') + else : + VariantName='s' + + if env['profile'] == 1: + VariantName+='P' + env.Append(CCFLAGS=' -pg') + env.Append(CXXFLAGS=' -pg') + else : + VariantName+='p' + + if env['assertions'] == 1: + VariantName+='A' + env.Append(CPPDEFINES={'HLVM_ASSERT':None}) + else : + VariantName+='a' + + if env['debug'] == 1 : + VariantName += 'D' + env.Append(CCFLAGS=' -g') + env.Append(CXXFLAGS=' -g') + env.Append(CPPDEFINES={'HLVM_DEBUG':None}) + else : + VariantName+='d' + + if env['inline'] == 1: + VariantName+='I' + else : + VariantName+='i' + env.Append(CXXFLAGS=' -fno-inline') + + if env['optimize'] == 1 : + VariantName+='O' + env.Append(CCFLAGS=' -O3') + env.Append(CXXFLAGS=' -O3') + else : + VariantName+='o' + env.Append(CCFLAGS=' -O1') + env.Append(CXXFLAGS=' -O1') + + BuildDir = 'build.' + VariantName + env['Variant'] = VariantName + env['BuildDir'] = BuildDir + env['AbsObjRoot'] = env.Dir(BuildDir).abspath + env['AbsSrcRoot'] = env.Dir('#').abspath + env['LIBPATH'] = [ + pjoin('#',BuildDir,'hlvm/Base'), + pjoin('#',BuildDir,'hlvm/AST'), + pjoin('#',BuildDir,'hlvm/Reader/XML'), + pjoin('#',BuildDir,'hlvm/Writer/XML') + ]; + env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0) + env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0) + env.BuildDir(pjoin(BuildDir,'test'),'test',duplicate=0) + env.Prepend(CPPPATH=[pjoin('#',BuildDir)]) + env.Prepend(CPPPATH=['#']) + env.SConsignFile(pjoin(BuildDir,'sconsign')) + env.Help(""" +HLVM Build Environment + +Usage Examples:: + scons - to do a normal build + scons --clean - to remove all derived (built) objects + scons check - to run the DejaGnu test suite + scons install - to install HLVM to a target directory + +Options: (Default) + debug=on/off - include debug symbols and code? (on) + assrt=on/off - include code assertions? (on) + optimize=on/off - optimize generated code? (off) + inline=on/off - make inline calls inline? (off) + small=on/off - make smaller rather than faster code? (off) + profile=on/off - generate code for gprof profiling? (off) + prefix= - specify where HLVM should be installed (/usr/local) +""") + print "HLVM BUILD MODE:", VariantName + env = ConfigureHLVM(env) + if 'check' in targets: + from scons import check + check.Check(env) + return env + Deleted: scons/main.py =================================================================== --- scons/main.py 2006-05-23 10:05:41 UTC (rev 114) +++ scons/main.py 2006-05-23 19:45:16 UTC (rev 115) @@ -1,46 +0,0 @@ -from SCons.Environment import Environment as Environment -from environment import ProvisionEnvironment as ProvisionEnvironment -from configure import ConfigureHLVM as ConfigureHLVM -from os import path as path -from string import join as sjoin -from string import replace as strrepl -import glob -def GetBuildEnvironment(targets,arguments): - env = Environment(); - env['HLVM_Copyright'] = 'Copyright (c) 2006 Reid Spencer' - env['HLVM_Maintainer'] = 'Reid Spencer ' - env['HLVM_Version'] = '0.1svn' - env['HLVM_SO_CURRENT'] = '0' - env['HLVM_SO_REVISION'] = '1' - env['HLVM_SO_AGE'] = '0' - env['HLVM_SO_VERSION'] = env['HLVM_SO_CURRENT']+':'+env['HLVM_SO_REVISION'] - env['HLVM_SO_VERSION'] += ':' + env['HLVM_SO_AGE'] - ProvisionEnvironment(env,targets,arguments) - return ConfigureHLVM(env) - -def GetAllCXXFiles(env): - dir = env.Dir('.').abspath - dir = strrepl(dir,path.join(env['BuildDir'],''),'',1) - p1 = glob.glob(path.join(dir,'*.cpp')) - p2 = glob.glob(path.join(dir,'*.cxx')) - p3 = glob.glob(path.join(dir,'*.C')) - return env.Flatten([p1,p2,p3]) - -def GetRNGQuoteSource(env): - from scons import filterbuilders - return filterbuilders.RNGQuoteSource(env) - -def GetRNGTokenizer(env): - from scons import filterbuilders - return filterbuilders.RNGTokenizer(env) - -def GetCheck(env): - from scons import check - return check.Check(env) - -def Dirs(env,dirlist=[]): - for d in dirlist: - env.SConscript(path.join(env['BuildDir'],d,'SConscript')) - -def join(one,two): - return path.join([one,two]) Modified: test/SConscript =================================================================== --- test/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ test/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -1,3 +1,24 @@ +#===-- Build Script For test ----------------------------------*- Python -*-===# # +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +from scons import hlvm Import('env') -from scons import main Modified: tools/SConscript =================================================================== --- tools/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ tools/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -1,4 +1,26 @@ +#===-- Build Script For tools ---------------------------------*- Python -*-===# +# +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +# +from scons import hlvm Import('env') -env.SConscript([ - 'hlvm-xml2xml/SConscript' -]) +hlvm.Dirs(env,['hlvm-xml2xml','hlvm']) Added: tools/hlvm/SConscript =================================================================== --- tools/hlvm/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ tools/hlvm/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -0,0 +1,38 @@ +#===-- Build Script For test ----------------------------------*- Python -*-===# +# +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +# +from scons import hlvm +Import('env') +env.Program('hlvm', hlvm.GetAllCXXFiles(env), + LIBS=[ + 'HLVMXMLReader', + 'HLVMXMLWriter', + 'HLVMAST', + 'HLVMBase', + 'xml2', + 'LLVMSupport', + 'LLVMSystem', + 'apr-1', + 'stdc++' + ], +) Added: tools/hlvm/hlvm.cpp =================================================================== --- tools/hlvm/hlvm.cpp 2006-05-23 10:05:41 UTC (rev 114) +++ tools/hlvm/hlvm.cpp 2006-05-23 19:45:16 UTC (rev 115) @@ -0,0 +1,112 @@ +//===-- HLVM Main Program ---------------------------------------*- C++ -*-===// +// +// High Level Virtual Machine (HLVM) +// +// Copyright (C) 2006 Reid Spencer. All Rights Reserved. +// +// This software is free software; you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or (at +// your option) any later version. +// +// This software is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +// more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this library in the file named LICENSE.txt; if not, write to the +// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA +// +//===----------------------------------------------------------------------===// +/// @file tools/hlvm/hlvm.cpp +/// @author Reid Spencer (original author) +/// @date 2006/05/23 +/// @since 0.1.0 +/// @brief Implements the main program for the HLVM Virtual Machine +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include +#include +#include +#include + +using namespace llvm; +using namespace hlvm; +static cl::opt +InputFilename(cl::Positional, cl::desc(""), cl::init("-")); + +static cl::opt +OutputFilename("o", cl::desc("Override output filename"), + cl::value_desc("filename")); + +int main(int argc, char**argv) +{ + try { + Base::initialize(argc,argv); + cl::ParseCommandLineOptions(argc, argv, + "hlvm-xml2xml XML->AST->XML translator\n"); + + std::ostream *Out = &std::cout; // Default to printing to stdout. + + if (OutputFilename != "") { // Specified an output filename? + if (OutputFilename != "-") { // Not stdout? + Out = new std::ofstream(OutputFilename.c_str()); + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); + } + } else { + if (InputFilename == "-") { + OutputFilename = "-"; + } else { + std::string IFN = InputFilename; + OutputFilename = InputFilename + ".out"; + + Out = new std::ofstream(OutputFilename.c_str()); + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); + } + } + + if (!Out->good()) { + std::cerr << argv[0] << ": error opening " << OutputFilename + << ": sending to stdout instead!\n"; + Out = &std::cout; + } + + if (InputFilename == "-" ) { + std::cerr << "Not supported yet: input from stdin\n"; + exit(2); + } else { + llvm::sys::Path path(InputFilename); + if (!path.canRead()) { + std::cerr << argv[0] << ": can't read input file: " << InputFilename + << "\n"; + exit(2); + } + } + + XMLReader* rdr = XMLReader::create(InputFilename); + XMLWriter* wrtr = XMLWriter::create(OutputFilename.c_str()); + rdr->read(); + AST* node = rdr->get(); + if (node) { + wrtr->write(node); + } + delete rdr; + delete wrtr; + + if (Out != &std::cout) { + static_cast(Out)->close(); + delete Out; + } + return 0; + } catch (const std::string& msg) { + std::cerr << argv[0] << ": " << msg << "\n"; + } catch (...) { + std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + } + return 1; +} Modified: tools/hlvm-xml2xml/SConscript =================================================================== --- tools/hlvm-xml2xml/SConscript 2006-05-23 10:05:41 UTC (rev 114) +++ tools/hlvm-xml2xml/SConscript 2006-05-23 19:45:16 UTC (rev 115) @@ -1,6 +1,29 @@ -from scons import main +#===-- Build Script For tools/hlvm-xml2xml --------------------*- Python -*-===# +# +# High Level Virtual Machine (HLVM) +# +# Copyright (C) 2006 Reid Spencer. All Rights Reserved. +# +# This software is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This software is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library in the file named LICENSE.txt; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +#===----------------------------------------------------------------------===# +# +from scons import hlvm Import('env') -env.Program('hlvm-xml2xml', main.GetAllCXXFiles(env), +prog = env.Program('hlvm-xml2xml', hlvm.GetAllCXXFiles(env), LIBS=[ 'HLVMXMLReader', 'HLVMXMLWriter', @@ -13,3 +36,5 @@ 'stdc++' ] ) +hlvm.InstallProgram(env,prog) + _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 14:54:43 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 15:54:43 -0400 Subject: [hlvm-commits] r116 - / build hlvm hlvm/AST hlvm/Base hlvm/Reader hlvm/Reader/XML hlvm/Writer hlvm/Writer/XML test tools tools/hlvm tools/hlvm-xml2xml Message-ID: <200605231954.k4NJsh8i023845@sneezy.swagora.com> Author: reid Date: 2006-05-23 15:54:41 -0400 (Tue, 23 May 2006) New Revision: 116 Log: Rename the "scons" directory as "build" so that things don't get confusing with Python import statements Added: build/ build/check.py build/environment.py build/filterbuilders.py build/hlvm.py Removed: build/check.py build/environment.py build/filterbuilders.py scons/ Modified: SConstruct hlvm/AST/SConscript hlvm/Base/SConscript hlvm/Reader/SConscript hlvm/Reader/XML/SConscript hlvm/SConscript hlvm/Writer/SConscript hlvm/Writer/XML/SConscript test/SConscript tools/SConscript tools/hlvm-xml2xml/SConscript tools/hlvm/SConscript Modified: SConstruct =================================================================== --- SConstruct 2006-05-23 19:45:16 UTC (rev 115) +++ SConstruct 2006-05-23 19:54:41 UTC (rev 116) @@ -20,7 +20,7 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -from scons import hlvm +from build import hlvm env = hlvm.GetBuildEnvironment(COMMAND_LINE_TARGETS,ARGUMENTS) Export('env') hlvm.Dirs(env,['hlvm','tools','test']) Copied: build (from rev 114, scons) Deleted: build/check.py =================================================================== --- scons/check.py 2006-05-23 10:05:41 UTC (rev 114) +++ build/check.py 2006-05-23 19:54:41 UTC (rev 116) @@ -1,61 +0,0 @@ -from SCons.Environment import Environment as Environment -from environment import ProvisionEnvironment as ProvisionEnvironment -import re,fileinput,os,glob -from string import join as sjoin -from os.path import join as pjoin - -def getTestCases(dir,env): - context = pjoin(env['AbsSrcRoot'],'test',dir) - result = [] - for d in glob.glob(pjoin(context,'*.*')): - if not os.path.isdir(d): - if not d == pjoin(context,'dg.exp'): - result.append(d) - return result - -def SiteExpAction(target,source,env): - tgtpath = pjoin(env['AbsObjRoot'],'test') - outf = open(pjoin(tgtpath,'site.exp'),"w") - outf.write('## these variables are automatically generated by make ##\n') - outf.write('# Do not edit here. If you wish to override these values\n') - outf.write('# edit the last section\n') - outf.write('set target_triplet "fubar-pc-noos"\n') - outf.write('set srcdir "' + env['AbsSrcRoot'] + '/test"\n') - outf.write('set objdir "' + env['AbsObjRoot'] + '/test"\n') - outf.write('set tmpdir "$objdir/tmp"\n') - outf.write('set srcrootdir "' + env['AbsSrcRoot'] + '"\n') - outf.write('set objrootdir "' + env['AbsObjRoot'] + '"\n') - outf.write('## All vars above are generated by scons. Do Not Edit!\n') - outf.close() - return 0 - -def SiteExpMessage(target,source,env): - return "Building DejaGnu site.exp file" - -def CheckAction(target,source,env): - if env['RUNTEST'] == None: - print "Testing was disabled because DejaGnu 'runtest' was not found" - return 0 - - context = os.path.basename(env.File(target[0]).path) - context = re.sub('(.*?)\..*','\\1',context) - print "context=",context - os.system('DEJAGNU="'+pjoin(env['AbsObjRoot'],'test','site.exp')+'" '+ - env['RUNTEST'] + ' --tool ' + context) - return 0 - -def CheckMessage(target,source,env): - return "Running DejaGNU Test Suite" - -def Check(env): - checkAction = env.Action(CheckAction,CheckMessage) - checkBuilder = env.Builder(action=checkAction,suffix='results') - sitexpAction = env.Action(SiteExpAction,SiteExpMessage) - sitexpBuilder = env.Builder(action=sitexpAction,suffix='exp') - env.Append(BUILDERS = {'Check':checkBuilder,'SiteExp':sitexpBuilder}) - env.SiteExp('#test/site.exp',[]) - env.Check(['#test/xml2xml.sum','#test/xml2xml.log'], - getTestCases('xml2xml',env)+['#test/site.exp']) - env.Alias('check','#test/xml2xml.log') - return 1 - Copied: build/check.py (from rev 115, scons/check.py) Deleted: build/environment.py =================================================================== --- scons/environment.py 2006-05-23 10:05:41 UTC (rev 114) +++ build/environment.py 2006-05-23 19:54:41 UTC (rev 116) @@ -1,97 +0,0 @@ -# HLVM scons Software Construction Specification -# - -# Import stuff we need from SCons package -from os.path import join as pjoin -from SCons.Options import Options as Options -from SCons.Options import BoolOption as BoolOption -from SCons.Options import PathOption as PathOption -from SCons.Environment import Environment as Environment -from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment - -def ProvisionEnvironment(env,targets,arguments): - env.EnsurePythonVersion(2,3) - env.EnsureSConsVersion(0,96) - env.SetOption('implicit_cache',1) - env.TargetSignatures('build') - VariantName='' - opts = Options('custom.py',arguments) - opts.AddOptions( - BoolOption('assrt','Include assertions in the code',1), - BoolOption('debug','Build with debug options turned on',1), - BoolOption('inline','Cause inline code to be inline',0), - BoolOption('optimize','Build object files with optimization',0), - BoolOption('profile','Generate profiling aware code',0), - BoolOption('small','Generate smaller code rather than faster',0), - BoolOption('config','Generation the configuration data',0), - PathOption('prefix','Specify where to install HLVM','/usr/local') - ) - opts.Update(env) - env['CCFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith' - env['CXXFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated' - env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -ffor-scope' - env['CXXFLAGS']+= ' -fno-operator-names' - env['CPPDEFINES'] = { '__STDC_LIMIT_MACROS':None } - if env['small'] == 1: - VariantName='S' - env.Append(CCFLAGS=' -Os') - env.Append(CXXFLAGS=' -Os') - else : - VariantName='s' - - if env['profile'] == 1: - VariantName+='P' - env.Append(CCFLAGS=' -pg') - env.Append(CXXFLAGS=' -pg') - else : - VariantName+='p' - - if env['assrt'] == 1: - VariantName+='A' - env.Append(CPPDEFINES={'HLVM_ASSERT':None}) - else : - VariantName+='a' - - if env['debug'] == 1 : - VariantName += 'D' - env.Append(CCFLAGS=' -g') - env.Append(CXXFLAGS=' -g') - env.Append(CPPDEFINES={'HLVM_DEBUG':None}) - else : - VariantName+='d' - - if env['inline'] == 1: - VariantName+='I' - else : - VariantName+='i' - env.Append(CXXFLAGS=' -fno-inline') - - if env['optimize'] == 1 : - VariantName+='O' - env.Append(CCFLAGS=' -O3') - env.Append(CXXFLAGS=' -O3') - else : - VariantName+='o' - env.Append(CCFLAGS=' -O1') - env.Append(CXXFLAGS=' -O1') - - BuildDir = 'build.' + VariantName - env['Variant'] = VariantName - env['BuildDir'] = BuildDir - env['AbsObjRoot'] = env.Dir(BuildDir).abspath - env['AbsSrcRoot'] = env.Dir('#').abspath - env['LIBPATH'] = [ - pjoin('#',BuildDir,'hlvm/Base'), - pjoin('#',BuildDir,'hlvm/AST'), - pjoin('#',BuildDir,'hlvm/Reader/XML'), - pjoin('#',BuildDir,'hlvm/Writer/XML') - ]; - env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0) - env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0) - env.Prepend(CPPPATH=[pjoin('#',BuildDir)]) - env.Prepend(CPPPATH=['#']) - env.SConsignFile(pjoin(BuildDir,'sconsign')) - - opts.Save('options.cache', env) - env.Help(opts.GenerateHelpText(env,sort=cmp)) - return env; Copied: build/environment.py (from rev 115, scons/environment.py) Deleted: build/filterbuilders.py =================================================================== --- scons/filterbuilders.py 2006-05-23 10:05:41 UTC (rev 114) +++ build/filterbuilders.py 2006-05-23 19:54:41 UTC (rev 116) @@ -1,115 +0,0 @@ -from SCons.Environment import Environment as Environment -from environment import ProvisionEnvironment as ProvisionEnvironment -import re,fileinput,os -from string import join as sjoin -from os.path import join as pjoin - -def _sedit(input,output,substs): - res = [] - f=open(output[0].path,'w') - for subst in substs: - res.append(re.compile(subst[0])) - for line in fileinput.input(input[0].path): - count = 0 - for r in res: - line = res[count].sub(substs[count][1],line,0) - count += 1 - f.write(line) - f.close() - -def QuoteSourceAction(target,source,env): - substs = [['[\\\\]','\\\\\\\\'],['"','\\"'],['^(.*)$','"\\1"']] - _sedit(source,target,substs) - return 0 - -def QuoteSourceMessage(target,source,env): - return "Converting %s to %s as quoted source" % (source[0],target[0]) - -def RNGQuoteSource(env): - a = env.Action(QuoteSourceAction,QuoteSourceMessage) - b = env.Builder(action=a,suffix='inc',src_suffix='rng',single_source=1) - env.Append(BUILDERS = {'RNGQuoteSource':b}) - return b - -def getSchemaTokens(fname): - elemPat = re.compile(']*name="([^"]*)"') - attrPat = re.compile(']*name="([^"]*)"') - valuPat = re.compile('\s*([^<\s]*)') - tokens = [] - for line in fileinput.input(fname): - tokens += elemPat.findall(line) - tokens += attrPat.findall(line) - tokens += valuPat.findall(line) - dict = {} - for tok in tokens: - dict[tok] = 1 - result = list(dict.keys()) - result.sort() - return result - -def processFile(preamble,tmplt,output,substs): - res = [] - for subst in substs: - res.append(re.compile(subst[0])) - outf = open(output,"w") - for infile in [preamble,tmplt]: - for line in fileinput.input(infile): - count = 0 - for r in res: - line = res[count].sub(substs[count][1],line,0) - count += 1 - outf.write(line) - outf.close() - -def RNGTokenizerAction(target,source,env): - tgtDir = target[0].dir.path - ModulePath = re.sub(pjoin(env['BuildDir'],'hlvm','')+'(.*)','\\1',tgtDir) - Module = re.sub('[/\\\\]','_',ModulePath) - Schema = re.sub('.*/(.*).rng','\\1',source[0].path) - PreambleFile = "utils/tmplt/Preamble_Code"; - HeaderTemplate = "utils/tmplt/Tokenizer_Template.h"; - SourceTemplate = "utils/tmplt/Tokenizer_Template.cpp"; - HeaderFile = pjoin(tgtDir,Schema) + "Tokenizer.h"; - SourceFile = pjoin(tgtDir,Schema) + "Tokenizer.cpp"; - TokenHashClass = Schema + "TokenHash"; - TokenHashFile = pjoin(tgtDir,TokenHashClass) + ".i"; - tokens = [] - tokens = getSchemaTokens(source[0].path) - tknFilename = pjoin(tgtDir,Schema) + "Tokens.tmp" - tknFile = open(tknFilename,"w") - tknFile.write('struct TokenMap {\n') - tknFile.write('const char *name; HLVM_'+Module+'::'+Schema+'Tokens token;\n') - tknFile.write('};\n%%\n') - for tkn in tokens: - tknFile.write('"' + tkn + '", HLVM_'+Module+'::TKN_' + tkn + ',\n') - tknFile.write('%%\n') - tknFile.close() - gperfAction = env.Action( - "$GPERF -tcDCIoGl --fast 0 -L C++ -Z " + TokenHashClass + - " -s 2 -S 1 -k '*' " + tknFilename + " >" + TokenHashFile) - env.Execute(gperfAction) - tokenList = "" - for tkn in tokens: - tokenList += "TKN_" + tkn + ",\n " - from datetime import date - substs = [ - ['%SCHEMA_NAME%',Schema], - ['%AUTHOR%','Generated By HLVM build system'], - ['%DATE%',date.today().strftime('%c')], - ['%MODULE%',Module], - ['%MODULE_PATH%',ModulePath], - ['%TOKEN_LIST%',tokenList] - ] - processFile(PreambleFile,HeaderTemplate,HeaderFile,substs) - processFile(PreambleFile,SourceTemplate,SourceFile,substs) - return 0 - -def RNGTokenizerMessage(target,source,env): - return "Generating Perfect Hash Tokenizer For " + source[0].path - -def RNGTokenizer(env): - a = env.Action(RNGTokenizerAction,RNGTokenizerMessage) - b = env.Builder(action=a,suffix='h',src_suffix='rng',single_source=1) - env.Append(BUILDERS = {'RNGTokenizer':b}) - return 1 - Copied: build/filterbuilders.py (from rev 115, scons/filterbuilders.py) Copied: build/hlvm.py (from rev 115, scons/hlvm.py) =================================================================== --- scons/hlvm.py 2006-05-23 19:45:16 UTC (rev 115) +++ build/hlvm.py 2006-05-23 19:54:41 UTC (rev 116) @@ -0,0 +1,178 @@ +from SCons.Options import Options as Options +from SCons.Options import BoolOption as BoolOption +from SCons.Options import PathOption as PathOption +from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment +from SCons.Environment import Environment as Environment +from configure import ConfigureHLVM as ConfigureHLVM +from os.path import join as pjoin +from string import join as sjoin +from string import replace as strrepl +import glob + +def GetAllCXXFiles(env): + dir = env.Dir('.').abspath + dir = strrepl(dir,pjoin(env['BuildDir'],''),'',1) + p1 = glob.glob(pjoin(dir,'*.cpp')) + p2 = glob.glob(pjoin(dir,'*.cxx')) + p3 = glob.glob(pjoin(dir,'*.C')) + return env.Flatten([p1,p2,p3]) + +def GetRNGQuoteSource(env): + from build import filterbuilders + return filterbuilders.RNGQuoteSource(env) + +def GetRNGTokenizer(env): + from build import filterbuilders + return filterbuilders.RNGTokenizer(env) + +def Dirs(env,dirlist=[]): + dir = env.Dir('.').path + top = env.Dir('#').path + if top == dir: + path = pjoin('#',env['BuildDir']) + else: + path = '' + print "Entering Directory",dir + result = [] + for d in dirlist: + result.append(pjoin(path,d,'SConscript')) + env.SConscript(result) + +def InstallProgram(env,prog): + dir = pjoin(env['prefix'],'bin') + env.Install(dir,prog) + env.Alias('install',dir) + return 1 + +def InstallLibrary(env,lib): + dir = pjoin(env['prefix'],'lib') + env.Install(dir,lib) + env.Alias('install',dir) + return 1 + +def InstallHeader(env,hdrname): + dir = pjoin(env['prefix'],'include') + env.Install(dir,hdrname) + env.Alias('install',dir) + return 1 + +def join(one,two): + return pjoin([one,two]) + +def GetBuildEnvironment(targets,arguments): + env = Environment(); + env.EnsurePythonVersion(2,3) + env.EnsureSConsVersion(0,96) + env.SetOption('implicit_cache',1) + env.TargetSignatures('build') + opts = Options('.options_cache',arguments) + opts.AddOptions( + BoolOption('assertions','Include assertions in the code',1), + BoolOption('debug','Build with debug options turned on',1), + BoolOption('inline','Cause inline code to be inline',0), + BoolOption('optimize','Build object files with optimization',0), + BoolOption('profile','Generate profiling aware code',0), + BoolOption('small','Generate smaller code rather than faster',0), + PathOption('prefix','Specify where to install HLVM','/usr/local') + ) + opts.Update(env) + opts.Save('.options_cache',env) + env['HLVM_Copyright'] = 'Copyright (c) 2006 Reid Spencer' + env['HLVM_Maintainer'] = 'Reid Spencer ' + env['HLVM_Version'] = '0.1svn' + env['HLVM_SO_CURRENT'] = '0' + env['HLVM_SO_REVISION'] = '1' + env['HLVM_SO_AGE'] = '0' + env['HLVM_SO_VERSION'] = env['HLVM_SO_CURRENT']+':'+env['HLVM_SO_REVISION'] + env['HLVM_SO_VERSION'] += ':' + env['HLVM_SO_AGE'] + env['CCFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith' + env['CXXFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated' + env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -ffor-scope' + env['CXXFLAGS']+= ' -fno-operator-names' + env['CPPDEFINES'] = { '__STDC_LIMIT_MACROS':None } + VariantName='' + if env['small'] == 1: + VariantName='S' + env.Append(CCFLAGS=' -Os') + env.Append(CXXFLAGS=' -Os') + else : + VariantName='s' + + if env['profile'] == 1: + VariantName+='P' + env.Append(CCFLAGS=' -pg') + env.Append(CXXFLAGS=' -pg') + else : + VariantName+='p' + + if env['assertions'] == 1: + VariantName+='A' + env.Append(CPPDEFINES={'HLVM_ASSERT':None}) + else : + VariantName+='a' + + if env['debug'] == 1 : + VariantName += 'D' + env.Append(CCFLAGS=' -g') + env.Append(CXXFLAGS=' -g') + env.Append(CPPDEFINES={'HLVM_DEBUG':None}) + else : + VariantName+='d' + + if env['inline'] == 1: + VariantName+='I' + else : + VariantName+='i' + env.Append(CXXFLAGS=' -fno-inline') + + if env['optimize'] == 1 : + VariantName+='O' + env.Append(CCFLAGS=' -O3') + env.Append(CXXFLAGS=' -O3') + else : + VariantName+='o' + env.Append(CCFLAGS=' -O1') + env.Append(CXXFLAGS=' -O1') + + BuildDir = 'build.' + VariantName + env['Variant'] = VariantName + env['BuildDir'] = BuildDir + env['AbsObjRoot'] = env.Dir(BuildDir).abspath + env['AbsSrcRoot'] = env.Dir('#').abspath + env['LIBPATH'] = [ + pjoin('#',BuildDir,'hlvm/Base'), + pjoin('#',BuildDir,'hlvm/AST'), + pjoin('#',BuildDir,'hlvm/Reader/XML'), + pjoin('#',BuildDir,'hlvm/Writer/XML') + ]; + env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0) + env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0) + env.BuildDir(pjoin(BuildDir,'test'),'test',duplicate=0) + env.Prepend(CPPPATH=[pjoin('#',BuildDir)]) + env.Prepend(CPPPATH=['#']) + env.SConsignFile(pjoin(BuildDir,'sconsign')) + env.Help(""" +HLVM Build Environment + +Usage Examples:: + scons - to do a normal build + scons --clean - to remove all derived (built) objects + scons check - to run the DejaGnu test suite + scons install - to install HLVM to a target directory + +Options: (Default) + debug=on/off - include debug symbols and code? (on) + assrt=on/off - include code assertions? (on) + optimize=on/off - optimize generated code? (off) + inline=on/off - make inline calls inline? (off) + small=on/off - make smaller rather than faster code? (off) + profile=on/off - generate code for gprof profiling? (off) + prefix= - specify where HLVM should be installed (/usr/local) +""") + print "HLVM BUILD MODE:", VariantName + env = ConfigureHLVM(env) + if 'check' in targets: + from build import check + check.Check(env) + return env + Modified: hlvm/AST/SConscript =================================================================== --- hlvm/AST/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ hlvm/AST/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,8 +20,7 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -# -from scons import hlvm +from build import hlvm Import('env') lib = env.Library('HLVMAST',hlvm.GetAllCXXFiles(env)) hlvm.InstallLibrary(env,lib) Modified: hlvm/Base/SConscript =================================================================== --- hlvm/Base/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ hlvm/Base/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,8 +20,7 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -# +from build import hlvm Import('env') -from scons import hlvm lib = env.Library('HLVMBase',hlvm.GetAllCXXFiles(env)) hlvm.InstallLibrary(env,lib) Modified: hlvm/Reader/SConscript =================================================================== --- hlvm/Reader/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ hlvm/Reader/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,6 +20,6 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -from scons import hlvm +from build import hlvm Import('env') hlvm.Dirs(env,['XML']) Modified: hlvm/Reader/XML/SConscript =================================================================== --- hlvm/Reader/XML/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ hlvm/Reader/XML/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,9 +20,8 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -# +from build import hlvm Import('env') -from scons import hlvm hlvm.GetRNGQuoteSource(env) hlvm.GetRNGTokenizer(env) env.RNGQuoteSource('HLVM.rng.inc','HLVM.rng') Modified: hlvm/SConscript =================================================================== --- hlvm/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ hlvm/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,7 +20,6 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -# -from scons import hlvm +from build import hlvm Import('env') hlvm.Dirs(env,['Base','AST','Reader','Writer']) Modified: hlvm/Writer/SConscript =================================================================== --- hlvm/Writer/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ hlvm/Writer/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,6 +20,6 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -from scons import hlvm +from build import hlvm Import('env') hlvm.Dirs(env,['XML']) Modified: hlvm/Writer/XML/SConscript =================================================================== --- hlvm/Writer/XML/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ hlvm/Writer/XML/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,7 +20,7 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -from scons import hlvm +from build import hlvm Import('env') lib = env.Library('HLVMXMLWriter',hlvm.GetAllCXXFiles(env)) hlvm.InstallLibrary(env,lib) Modified: test/SConscript =================================================================== --- test/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ test/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,5 +20,5 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -from scons import hlvm +from build import hlvm Import('env') Modified: tools/SConscript =================================================================== --- tools/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ tools/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,7 +20,6 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -# -from scons import hlvm +from build import hlvm Import('env') hlvm.Dirs(env,['hlvm-xml2xml','hlvm']) Modified: tools/hlvm/SConscript =================================================================== --- tools/hlvm/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ tools/hlvm/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,8 +20,7 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -# -from scons import hlvm +from build import hlvm Import('env') env.Program('hlvm', hlvm.GetAllCXXFiles(env), LIBS=[ Modified: tools/hlvm-xml2xml/SConscript =================================================================== --- tools/hlvm-xml2xml/SConscript 2006-05-23 19:45:16 UTC (rev 115) +++ tools/hlvm-xml2xml/SConscript 2006-05-23 19:54:41 UTC (rev 116) @@ -20,8 +20,7 @@ # MA 02110-1301 USA # #===----------------------------------------------------------------------===# -# -from scons import hlvm +from build import hlvm Import('env') prog = env.Program('hlvm-xml2xml', hlvm.GetAllCXXFiles(env), LIBS=[ _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 21:38:56 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 22:38:56 -0400 Subject: [hlvm-commits] r117 - / build Message-ID: <200605240238.k4O2cuFd015441@sneezy.swagora.com> Author: reid Date: 2006-05-23 22:38:55 -0400 (Tue, 23 May 2006) New Revision: 117 Log: Attempt to get the object files in the build directory. Modified: SConstruct build/configure.py build/hlvm.py Modified: SConstruct =================================================================== --- SConstruct 2006-05-23 19:54:41 UTC (rev 116) +++ SConstruct 2006-05-24 02:38:55 UTC (rev 117) @@ -21,6 +21,7 @@ # #===----------------------------------------------------------------------===# from build import hlvm +from os.path import join as pjoin env = hlvm.GetBuildEnvironment(COMMAND_LINE_TARGETS,ARGUMENTS) Export('env') hlvm.Dirs(env,['hlvm','tools','test']) Modified: build/configure.py =================================================================== --- build/configure.py 2006-05-23 19:54:41 UTC (rev 116) +++ build/configure.py 2006-05-24 02:38:55 UTC (rev 117) @@ -117,7 +117,7 @@ return response def FindLLVM(conf,env): - code = 'llvm::Module* M = new llvm::Module("Name");' + code = 'new llvm::Module("Name");' return conf.FindPackage('LLVM','llvm/Module.h',['LLVMSupport','LLVMSystem'], code,['/proj/install/llvm'],['LLVMCore','LLVMbzip2']) @@ -176,4 +176,4 @@ FindAPR(conf,env) FindAPRU(conf,env) FindLLVM(conf,env) - return conf.Finish() + conf.Finish() Modified: build/hlvm.py =================================================================== --- build/hlvm.py 2006-05-23 19:54:41 UTC (rev 116) +++ build/hlvm.py 2006-05-24 02:38:55 UTC (rev 117) @@ -27,16 +27,16 @@ def Dirs(env,dirlist=[]): dir = env.Dir('.').path - top = env.Dir('#').path - if top == dir: - path = pjoin('#',env['BuildDir']) + print "dir=",dir + if (dir == env.Dir('#').path): + dir = '#' + env['BuildDir'] else: - path = '' - print "Entering Directory",dir - result = [] + dir = '#' + dir + print "dir=",dir for d in dirlist: - result.append(pjoin(path,d,'SConscript')) - env.SConscript(result) + sconsfile = pjoin(dir,d,'SConscript') + print "sconsfile=",sconsfile + env.SConscript(sconsfile) def InstallProgram(env,prog): dir = pjoin(env['prefix'],'bin') @@ -56,9 +56,6 @@ env.Alias('install',dir) return 1 -def join(one,two): - return pjoin([one,two]) - def GetBuildEnvironment(targets,arguments): env = Environment(); env.EnsurePythonVersion(2,3) @@ -145,11 +142,11 @@ pjoin('#',BuildDir,'hlvm/Reader/XML'), pjoin('#',BuildDir,'hlvm/Writer/XML') ]; + env.Prepend(CPPPATH=[pjoin('#',BuildDir)]) + env.Prepend(CPPPATH=['#']) env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0) env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0) env.BuildDir(pjoin(BuildDir,'test'),'test',duplicate=0) - env.Prepend(CPPPATH=[pjoin('#',BuildDir)]) - env.Prepend(CPPPATH=['#']) env.SConsignFile(pjoin(BuildDir,'sconsign')) env.Help(""" HLVM Build Environment @@ -170,7 +167,7 @@ prefix= - specify where HLVM should be installed (/usr/local) """) print "HLVM BUILD MODE:", VariantName - env = ConfigureHLVM(env) + ConfigureHLVM(env) if 'check' in targets: from build import check check.Check(env) _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 21:46:24 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 22:46:24 -0400 Subject: [hlvm-commits] r118 - build Message-ID: <200605240246.k4O2kOFl015459@sneezy.swagora.com> Author: reid Date: 2006-05-23 22:46:23 -0400 (Tue, 23 May 2006) New Revision: 118 Log: Don't commit debug printout! Add some default dirs to apr and apr-util Modified: build/configure.py build/hlvm.py Modified: build/configure.py =================================================================== --- build/configure.py 2006-05-24 02:38:55 UTC (rev 117) +++ build/configure.py 2006-05-24 02:46:23 UTC (rev 118) @@ -123,12 +123,13 @@ def FindAPR(conf,env): code = 'apr_initialize();' - return conf.FindPackage('APR',pjoin('apr-1','apr_general.h'),['apr-1'],code) + return conf.FindPackage('APR',pjoin('apr-1','apr_general.h'),['apr-1'],code, + ['/usr/local/apr']) def FindAPRU(conf,env): code = 'apu_version_string();' return conf.FindPackage('APRU',pjoin('apr-1','apu_version.h'),['aprutil-1'], - code) + code,['/usr/local/apr']) def FindLibXML2(conf,env): code = 'xmlNewParserCtxt();' Modified: build/hlvm.py =================================================================== --- build/hlvm.py 2006-05-24 02:38:55 UTC (rev 117) +++ build/hlvm.py 2006-05-24 02:46:23 UTC (rev 118) @@ -27,12 +27,10 @@ def Dirs(env,dirlist=[]): dir = env.Dir('.').path - print "dir=",dir if (dir == env.Dir('#').path): dir = '#' + env['BuildDir'] else: dir = '#' + dir - print "dir=",dir for d in dirlist: sconsfile = pjoin(dir,d,'SConscript') print "sconsfile=",sconsfile _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 21:51:46 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 22:51:46 -0400 Subject: [hlvm-commits] r119 - build Message-ID: <200605240251.k4O2pkA5015476@sneezy.swagora.com> Author: reid Date: 2006-05-23 22:51:45 -0400 (Tue, 23 May 2006) New Revision: 119 Log: Remove another debug printout. Modified: build/hlvm.py Modified: build/hlvm.py =================================================================== --- build/hlvm.py 2006-05-24 02:46:23 UTC (rev 118) +++ build/hlvm.py 2006-05-24 02:51:45 UTC (rev 119) @@ -33,7 +33,6 @@ dir = '#' + dir for d in dirlist: sconsfile = pjoin(dir,d,'SConscript') - print "sconsfile=",sconsfile env.SConscript(sconsfile) def InstallProgram(env,prog): _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 22:12:56 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 23:12:56 -0400 Subject: [hlvm-commits] r120 - build Message-ID: <200605240312.k4O3CupO015506@sneezy.swagora.com> Author: reid Date: 2006-05-23 23:12:55 -0400 (Tue, 23 May 2006) New Revision: 120 Log: Add /opt/local to the list of dirs to search. Modified: build/configure.py Modified: build/configure.py =================================================================== --- build/configure.py 2006-05-24 02:51:45 UTC (rev 119) +++ build/configure.py 2006-05-24 03:12:55 UTC (rev 120) @@ -56,7 +56,8 @@ } """ context.env.AppendUnique(LIBS = libs) - paths += ['/proj','/proj/install','/opt/','/sw','/usr/local','/usr','/'] + paths += + ['/proj','/proj/install','/opt/local','/opt/','/sw','/usr/local','/usr','/'] for p in paths: for ldir in ['lib','bin','libexec','libs','LIBS']: libdir = pjoin(p,ldir) _______________________________________________ hlvm-commits mailing list hlvm-commits at hlvm.org http://hlvm.org/mailman/listinfo/hlvm-commits From rspencer at reidspencer.com Tue May 23 22:19:12 2006 From: rspencer at reidspencer.com (rspencer at reidspencer.com) Date: Tue, 23 May 2006 23:19:12 -0400 Subject: [hlvm-commits] r121 - build Message-ID: <200605240319.k4O3JCFn015521@sneezy.swagora.com> Author: reid Date: 2006-05-2