You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(58) |
Sep
(79) |
Oct
(41) |
Nov
(80) |
Dec
(23) |
---|
From: <sg...@us...> - 2003-10-14 03:25:11
|
Update of /cvsroot/libfunutil/libfunutil/client In directory sc8-pr-cvs1:/tmp/cvs-serv6807/client Log Message: Directory /cvsroot/libfunutil/libfunutil/client added to the repository |
From: <sg...@us...> - 2003-10-14 03:19:39
|
Update of /cvsroot/libfunutil/libfunutil In directory sc8-pr-cvs1:/tmp/cvs-serv6165 Modified Files: configure.s11n Log Message: added the missing compilation tests. Index: configure.s11n =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/configure.s11n,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- configure.s11n 14 Oct 2003 03:11:54 -0000 1.1 +++ configure.s11n 14 Oct 2003 03:19:32 -0000 1.2 @@ -1,5 +1,9 @@ echo "==================== s11n-specific checks:" +toc_run_fail gcc_try_compile toc/tests/cpp/check_stl_newstyle.cpp +toc_run_fail gcc_try_compile toc/tests/cpp/gcc_2_95_typename_problem.cpp +toc_run_fail gcc_build_and_run toc/tests/c/check_for_dlopen_and_friends.c -export-dynamic -ldl + toc_run_fail flex toc_run_failok bzlib toc_run_failok lyxport |
From: <sg...@us...> - 2003-10-14 03:18:27
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests/c In directory sc8-pr-cvs1:/tmp/cvs-serv5960/toc/tests/c Added Files: check_for_dlopen_and_friends.c Makefile Log Message: egg --- NEW FILE: check_for_dlopen_and_friends.c --- /** Quick check for dlopen(), dlclose() and dlsym(). toc usage: toc_run_fail path/to/this/file -ldl -export-dynamic */ #include <dlfcn.h> #include <stdlib.h> void foo_function() {} int main() { typedef void (*func)(); void * soh = dlopen( 0, RTLD_NOW | RTLD_GLOBAL ); if( ! soh ) { printf( "%s\n", dlerror() ); return 1; } void * sym = (func) dlsym( soh, "foo_function" ); if( 0 == sym ) { printf( "%s\n", dlerror() ); return 2; } int err = dlclose( soh ); if( err ) { printf( "%s\n", dlerror() ); return err; } return 0; } --- NEW FILE: Makefile --- include toc.make DIST_FILES += $(wildcard *.c) all: |
From: <sg...@us...> - 2003-10-14 03:18:27
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests/cpp In directory sc8-pr-cvs1:/tmp/cvs-serv5960/toc/tests/cpp Added Files: gcc_2_95_typename_problem.cpp check_stl_newstyle.cpp check_setenv_in_cpp.cpp Makefile Log Message: egg --- NEW FILE: gcc_2_95_typename_problem.cpp --- #include <map> using namespace std; #ifndef TYPENAME #define TYPENAME typename // gcc 3.x accepts typename, gcc 2.95.3 does not #endif template <typename T> struct Foo { typedef T TT; typedef Foo<TT> ThisType; typedef map<ThisType::TT,ThisType::TT> map_type; /** gcc 2.95.3 will do something like the following: stl_check.cpp: In method `void Foo<T>::check_for_gcc2_9_failure(const map<T,T,less<_Key>,allocator<_Tp1> > &)': stl_check.cpp:15: no class template named `map' in `struct Foo<T>' stl_check.cpp:16: no class template named `map' in `struct Foo<T>' gcc 3.x (3.3pre, at least) swallows it nicely. The problem here is the 'typename' part: without that gcc 2.95.3 compiles it fine. gcc 3, however, warns that "implicite typenames are deprecated", and this kills my builds (i always use -Werror :/). */ void check_for_gcc2_9_failure() { ThisType::map_type map; TYPENAME ThisType::map_type::const_iterator it = map.begin(); TYPENAME ThisType::map_type::const_iterator et = map.end(); for( ; it != et; ++it ) {} } }; int main() { typedef Foo<int> Fii; Fii fii; fii.check_for_gcc2_9_failure(); return 0; } --- NEW FILE: check_stl_newstyle.cpp --- #include <sstream> int main() { std::ostringstream os; os << "foo"; return 0; } --- NEW FILE: check_setenv_in_cpp.cpp --- #include <stdlib.h> /** On the solaris boxes i have i can't compile this as c++, but can as c, using gcc 2.95.3: /opt/gnu/bin/gcc toc/tests/cpp/check_setenv_in_cpp.cpp -c -o .toc.try_compile.o toc/tests/cpp/check_setenv_in_cpp.cpp: In function `int main()': toc/tests/cpp/check_setenv_in_cpp.cpp:9: implicit declaration of function `int setenv(...)' */ int main() { setenv( "foo", "foo", 1 ); return 0; } --- NEW FILE: Makefile --- include toc.make DIST_FILES += $(wildcard *.cpp *.c) all: |
From: <sg...@us...> - 2003-10-14 03:17:58
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests/cpp In directory sc8-pr-cvs1:/tmp/cvs-serv5850/toc/tests/cpp Log Message: Directory /cvsroot/libfunutil/libfunutil/toc/tests/cpp added to the repository |
From: <sg...@us...> - 2003-10-14 03:17:45
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests/c In directory sc8-pr-cvs1:/tmp/cvs-serv5819/toc/tests/c Log Message: Directory /cvsroot/libfunutil/libfunutil/toc/tests/c added to the repository |
Update of /cvsroot/libfunutil/libfunutil/toc/make In directory sc8-pr-cvs1:/tmp/cvs-serv5483/toc/make Added Files: STATIC_LIBS.make SHARED_LIBS.make INSTALL_XXX.make C_DEPS.make C_BINS_FROM_SOURCES.make BIN_PROGRAMS.make Log Message: egg --- NEW FILE: STATIC_LIBS.make --- # cpp_static_libs.make: snippet for linking static libraries from # object files. # # This snippet defines the targets 'libs-static' and 'X.a' for each X in # $(STATIC_LIBS). libs-static simply depends on X.a. # # sample usage: # # STATIC_LIBS = foo bar # STATIC_LIBS_OBJECTS = # optional list of .o files to link to all $(STATIC_LIBS) # foo_a_OBJECTS = list of .o files # bar_a_OBJECTS = list of .o files # # all: libs #(or) all: foo.a bar.a # # that creates foo.a and bar.a and adds those files to $(INSTALL_LIBS) STATIC_LIBS_MAKEFILE = $(toc_makesdir)/STATIC_LIBS.make STATIC_LIBS_A = $(patsubst %,%.a,$(STATIC_LIBS)) CLEAN_FILES += $(STATIC_LIBS_A) # toc_link_static_lib call()able: # $1 = base name (e.g., foo) # links $(1).a from $($(1)_a_OBJECTS) and $(STATIC_LIBS_OBJECTS) toc_link_static_lib = $(AR) crs $(1).a $($(1)_a_OBJECTS) $(STATIC_LIBS_OBJECTS) ifneq (,$(STATIC_LIBS_A)) STATIC_LIBS_DEPSFILE = .toc.STATIC_LIBS.make STATIC_LIBS_RULES_GENERATOR = $(dir $(STATIC_LIBS_MAKEFILE))makerules.STATIC_LIBS STATIC_LIBS: $(STATIC_LIBS_DEPSFILE): Makefile $(STATIC_LIBS_MAKEFILE) $(STATIC_LIBS_RULES_GENERATOR) ifneq (,$(strip $(filter distclean clean,$(MAKECMDGOALS)))) @echo "$(MAKECMDGOALS): skipping STATIC_LIBS rules generation." else @echo "Generating STATIC_LIBS rules."; \ $(call toc_generate_rules,STATIC_LIBS,$(STATIC_LIBS)) > $@ endif -include $(STATIC_LIBS_DEPSFILE) deps: $(STATIC_LIBS_DEPSFILE) libs: STATIC_LIBS libs-static: STATIC_LIBS endif --- NEW FILE: SHARED_LIBS.make --- # Links objects into a dynamically-linked library using g++ # usage: # # SHARED_LIBS = foo # SHARED_LIBS_OBJECTS = # optional list of .o files to link to all $(SHARED_LIBS) # foo_so_OBJECTS = list of object files to link to foo.so # foo_so_LDADD = # optional libraries passed to linker (e.g., -lstdc++) # foo_so_LDFLAGS = # optional args to linker # foo_so_VERSION = # optional Major.Minor.Patch # e.g. "1.0.1" it MUST match this format! # include $(toc_makesdir)/cpp_dynamic_libs.make # # If foo_so_VERSION is not set then no numbered symlinks will be created. # # Run: # all: lib-shared # # Effect: # Creates foo.so and foo.so<version> by linking $(foo_so_OBJECTS). It # also sets up install/uninstall rules for handling the symlinks. SHARED_LIBS_MAKEFILE = $(toc_makesdir)/SHARED_LIBS.make # toc_link_shared_lib # $1 = basename # $2 = extra args to the linker toc_link_shared_lib = { soname=$(1).so; wholename=$${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR).$($(1)_so_PATCH); \ so_major=$${soname}.$($(1)_so_MAJOR); \ stamp=$${so_major}; \ test x = x$($(1)_so_MAJOR) && { wholename=$${soname}; stamp=$(1).so;}; \ cmd="$(CXX) $(CXXFLAGS) $($(1)_LDFLAGS) -o $${wholename} -export-dynamic -shared \ -Wl,-soname,$${stamp} $($(1)_so_OBJECTS) $(SHARED_LIBS_OBJECTS) $(SHARED_LIBS_LDADD) $($(1)_so_LDADD) $(2)"; \ test x1 = x$(configure_build_quietly) || echo $$cmd; \ $$cmd || exit; \ test x = x$($(1)_so_MAJOR) || { \ ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR); \ ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR); \ ln -fs $${wholename} $${soname}; \ }; \ } # symlinking methods: # method 1: # ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR); \ # ln -fs $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR) $${soname}.$($(1)_so_MAJOR); \ # ln -fs $${soname}.$($(1)_so_MAJOR) $${soname}; \ # method 1.5: # link1=$${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR); ln -fs $${wholename} $$link1; \ # link2=$${soname}.$($(1)_so_MAJOR); ln -fs $$link1 $$link2; \ # link3=$${soname}; ln -fs $$link2 $$link3; \ # method 2: # ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR); \ # ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR); \ # ln -fs $${wholename} $${soname}; \ # for l in $${soname} \ # $${soname}.$($(1)_so_MAJOR) \ # $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR) \ # ; do \ # ln -fs $${wholename} $$l; \ # done; \ ifneq ($(SHARED_LIBS),) SHARED_LIBS_SOFILES = $(patsubst %,%.so,$(SHARED_LIBS)) SHARED_LIBS_RULES_GENERATOR = $(dir $(SHARED_LIBS_MAKEFILE))makerules.SHARED_LIBS # to ensure that .so files are installed in a unix-friendly manner we need to implement # some install rules for them... SHARED_LIBS_DEPSFILE = .toc.SHARED_LIBS.make deps: $(SHARED_LIBS_INSTALL_RULES) $(SHARED_LIBS_DEPSFILE): Makefile $(SHARED_LIBS_MAKEFILE) $(SHARED_LIBS_RULES_GENERATOR) ifneq (,$(strip $(filter distclean clean,$(MAKECMDGOALS)))) @echo "$(MAKECMDGOALS): skipping SHARED_LIBS rules generation." else @echo "Generating SHARED_LIBS rules."; \ $(call toc_generate_rules,SHARED_LIBS,$(SHARED_LIBS)) > $@ endif -include $(SHARED_LIBS_DEPSFILE) CLEAN_FILES += $(SHARED_LIBS_SOFILES) $(wildcard $(patsubst %,%.*,$(SHARED_LIBS_SOFILES))) libs: SHARED_LIBS endif # ^^^ got SHARED_LIBS? --- NEW FILE: INSTALL_XXX.make --- #!/bin/make -f # To be included from the shared toc makefile. # # Sample usage: # INSTALL_BINS = mybin myotherbin # installs to $(prefix)/bin # INSTALL_LIBS = mylib.a myotherlib.a # installs to $(prefix)/lib # # There's a whole lot more to know, if you wanna poke around the code. # # Design note: the traditional xxx-local targets aren't really # necessary. If someone wants to customize install they can simply do # this: # # install: my-install # my-install: # .... # # # For each X in $(TOC_INSTALL_TARGET_BASENAMES) the following targets # are created: # # install-X: # uninstall-X: # install-X-symlink: # # Files will be installed to $(INSTALL_X_DEST) using install # arguments $(INSTALL_X_INSTALL_FLAGS). All of these vars are # set up by default, but may be customized: # # INSTALL_BINS_DEST = $(prefix)/$(PACKAGE_NAME)/bin # INSTALL_BINS_INSTALL_FLAGS = -m 0775 # # # Installation can be further customized by using the toc_make_xxx # call()able functions. TOC_INSTALL_TARGET_BASENAMES = BINS SBINS LIBS PACKAGE_LIBS LIBEXECS HEADERS PACKAGE_HEADERS PACKAGE_DATA DOCS ifeq (,$(wildcard $(INSTALLER_BIN))) $(error INSTALL_XXX.make requires that the variable INSTALLER_BIN point to a version of install which is vaguely compatible with GNU install.) endif #INSTALL_BINS_SUFFIX ?= #ifeq (1,$(configure_with_CYGWIN)) #INSTALL_BINS_SUFFIX = .exe #endif # This whole echo/grep thing is to force it to work on some of my # older machines where more sane approaches don't seem to work. # TOC_MAKE_INSTALL_GREP_KLUDGE = test $(shell echo $(1) "" | grep -q '[a-zA-Z0-9]'; echo $$?) = 0 || exit 0 TOC_MAKE_INSTALL_GREP_KLUDGE = # toc_make_install call()able: # $1=file list # $2=destdir # $3=flags for $(INSTALLER_BIN) toc_make_install = test "x$(1)" = x && exit 0; \ test -d $(2) || mkdir -p $(2) || exit; \ for b in $(1) "x"; do test "x$$b" = "xx" && break; \ b=$$(basename $$b); \ target=$(2)/$$b; \ cmd="$(INSTALLER_BIN) $(3) $$b $$target"; echo $$cmd; $$cmd || exit; \ done # toc_make_install_update: identical to toc_make_install # but does not update the target if it is the same as the source. toc_make_install_update = test "x$(1)" = x && exit 0; \ test -d $(2) || mkdir -p $(2) || exit; \ for b in $(1) ""; do test -z "$$b" && continue; \ b="$$(basename $$b)"; \ target="$(2)/$$b"; \ cmp "$$target" "$$b" > /dev/null 2>&1 && continue; \ cmd="$(INSTALLER_BIN) $(3) $$b $$target"; echo "$$cmd"; $$cmd || exit; \ done # toc_make_uninstall call()able: # removes all files listed in $(1) from target directory $(2) toc_make_uninstall = test "x$(1)" = x && exit 0; \ test -e "$(2)" || exit 0; \ for b in $(1) ""; do test -z "$$b" && continue; \ fp="$(2)/$$b"; test -e "$$fp" || continue; \ cmd="rm $$fp"; echo $$cmd; $$cmd || exit $$?; \ done # toc_make_install_symlink call()able: # Works similarly to toc_make_install, but symlinks back to the install source, # instead of copying. Arg $3 is ignored. # Note that symlinks must be linked to absolute paths here, because we cannot # easily/reliably make a relative path from the target directory back to # the install source: toc_make_install_symlink = test "x$(1)" = x && exit 0; \ test -d $(2) || mkdir -p $(2) || exit; \ for b in $(1) ""; do test -z "$$b" && continue; \ target="$(2)/$$b"; \ pwd="$$(pwd)"; \ src="$$pwd/$$b"; \ test "$$target" -ef "$$src" && continue; \ test -f "$$target" && rm "$$target"; \ echo "Symlinking $$target"; ln -s -f "$$src" "$$target" || exit $$?; \ done # toc_make_install_so: installs foo.so.X.Y.Z and symlinks foo.so, foo.so.X and foo.so.X.Y to it, # in traditional/common Unix style. # $1 = so name (foo.so) # $2-4 = Major, Minor, Patch version numbers # $5 = destination directory toc_make_install_so = test "x$(1)" = x && exit 0; \ test -d $(5) || mkdir -p $(5) || exit; \ wholename=$(1).$(2).$(3).$(4); \ target=$(5)/$$wholename; \ test $$wholename -ef $$target || { \ echo "Installing/symlinking $$target"; \ cmd="$(INSTALLER_BIN) -m 0755 $$wholename $$target"; \ $$cmd || exit; \ }; \ cd $(5); \ for i in $(1) $(1).$(2) $(1).$(2).$(3); do \ test -e $$i && rm $$i; \ cmd="ln -fs $$wholename $$i"; echo $$cmd; \ $$cmd || exit; \ done # symlinking method number 2: # { set -x; \ # ln -fs $(1).$(2).$(3).$(4) $(1).$(2).$(3); \ # ln -fs $(1).$(2).$(3) $(1).$(2); \ # ln -fs $(1).$(2) $(1); \ # } INSTALLER_BIN_FLAGS_BINS = -m 0755 INSTALLER_BIN_FLAGS_NONBINS = -m 0644 INSTALLER_BIN_FLAGS_LIBS = -m 0644 INSTALLER_BIN_FLAGS_LIBEXECS = -m 0755 # default install flags for the installable file categories: INSTALL_BINS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_BINS) INSTALL_SBINS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_BINS) INSTALL_LIBS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_LIBS) INSTALL_PACKAGE_LIBS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_LIBS) INSTALL_LIBEXECS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_LIBEXECS) INSTALL_HEADERS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_PACKAGE_HEADERS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_PACKAGE_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_DOCS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_MAKEFILE = $(toc_makesdir)/INSTALL_XXX.make INSTALL_DEPS_FILE = $(toc_makesdir)/.toc.INSTALL_XXX.make INSTALL_XXX_GENERATOR = $(dir $(INSTALL_MAKEFILE))makerules.INSTALL_XXX # Set install paths for the installable file categories # and create installation rules. With make 3.80 we can do this with $(eval), # Make 3.79 is very common, but doesn't support $(eval). # todo? move this into the configure process? $(INSTALL_DEPS_FILE): $(INSTALL_MAKEFILE) $(INSTALL_XXX_GENERATOR) ifneq (,$(strip $(filter clean distclean,$(MAKECMDGOALS)))) # @echo "$(MAKECMDGOALS): skipping INSTALL_XXX rules generation." else @echo "Generating rules for INSTALL_XXX."; \ $(call toc_generate_rules,INSTALL_XXX,\ BINS=bin \ SBINS=sbin \ LIBS=lib \ PACKAGE_LIBS='lib/$$(PACKAGE_NAME)' \ LIBEXECS=lib \ HEADERS=include \ PACKAGE_HEADERS='include/$$(PACKAGE_NAME)' \ PACKAGE_DATA='share/$$(PACKAGE_NAME)' \ DOCS='share/doc/$$(PACKAGE_NAME)' \ ) > $@ endif -include $(INSTALL_DEPS_FILE) deps: $(INSTALL_DEPS_FILE) .PHONY: install-. uninstall-. subdirs-install: # implemented elsewhere install: install-. install-subdirs install-update: install-.-update install-subdirs-update install-symlink: install-.-symlink install-subdirs-symlink install-subdirs: subdirs-install install-subdirs-symlink: subdirs-install-symlink install-subdirs-update: subdirs-install-update uninstall-subdirs: subdirs-uninstall uninstall: uninstall-. uninstall-subdirs # implement these to hook in to the start of the install. Untested. :/ install-.: install-.-update: install-.-symlink: uninstall-.: --- NEW FILE: C_DEPS.make --- # makefile snippet # Usage: # include path/to/this/file # # That will set up a 'deps' target which deps all C/C++ files and updates # the deps when any of those files, or the Makefile, changes. # That's normally all there is to it. DEPS_C_SOURCES_GLOB ?= *.cpp *.c *.c++ *.C *.cc *.moc SOURCE_FILES_TO_DEP ?= $(sort $(wildcard $(DEPS_C_SOURCES_GLOB))) TOC_C_DEPS_MAKEFILE = $(toc_makesdir)/C_DEPS.make DEPSGEN_BIN = $(toc_tocdir)/bin/mkdep $(DEPSGEN_BIN): $(TOC_C_DEPS_MAKEFILE) @echo "Building $@"; cd $(toc_tocdir)/bin; \ $(CC) -o mkdep mkdep.c ifneq (,$(SOURCE_FILES_TO_DEP)) TOC_C_DEPSFILE = .toc.C_DEPS.make $(TOC_C_DEPSFILE): $(DEPSGEN_BIN) $(SOURCE_FILES_TO_DEP) Makefile $(TOC_C_DEPS_MAKEFILE) ifneq (,$(strip $(filter clean distclean,$(MAKECMDGOALS)))) @echo "$(MAKECMDGOALS): skipping C_DEPS rules generation." else @test -n "$(SOURCE_FILES_TO_DEP)" || exit 0; \ echo "Generating C_DEPS rules for $(DEPS_C_SOURCES_GLOB)"; \ $(call toc_make_c_deps,$(SOURCE_FILES_TO_DEP),) > $@ -include $(TOC_C_DEPSFILE) endif deps-c: $(TOC_C_DEPSFILE) deps: deps-c CLEAN_FILES += $(TOC_C_DEPSFILE) all: deps-c endif --- NEW FILE: C_BINS_FROM_SOURCES.make --- #!make # usage: # set: # C_BINS_FROM_SOURCES = foo bar # foo_bin_SOURCES = foo.c foo2.c # bar_bin_SOURCES = bar.c bar2.c foobar.c # optional: foo_bin_OBJECTS = somethingdifferent.o # optional: foo_bin_CFLAGS = -DCOMPILING_FOO=1 -I/somewhere/different # optional: foo_bin_LFLAGS = -lfl -lfoo # # all: bins # # This compiles, all in one go, 'bar' from $(bar_bin_SOURCES) C_BINS_FROM_SOURCES_MAKEFILE = $(toc_makesdir)/C_BINS_FROM_SOURCES.make ifneq (,$(C_BINS_FROM_SOURCES)) C_BINS_FROM_SOURCES_RULES_GENERATOR = $(toc_makesdir)/makerules.C_BINS_FROM_SOURCES C_BINS_FROM_SOURCES_COMMON_DEPS += Makefile $(C_BINS_FROM_SOURCES_MAKEFILE) C_BINS_FROM_SOURCES_DEPSFILE = .toc.C_BINS_FROM_SOURCES.make CLEAN_FILES += $(C_BINS_FROM_SOURCES_DEPSFILE) $(C_BINS_FROM_SOURCES_DEPSFILE): $(C_BINS_FROM_SOURCES_COMMON_DEPS) $(C_BINS_FROM_SOURCES_RULES_GENERATOR) ifneq (,$(strip $(filter distclean clean,$(MAKECMDGOALS)))) @echo "$(MAKECMDGOALS): skipping C_BINS_FROM_SOURCES rules generation." else @echo "Generating C_BINS_FROM_SOURCES rules."; \ $(call toc_generate_rules,C_BINS_FROM_SOURCES,$(C_BINS_FROM_SOURCES)) > $@ endif # ^^^ making clean? -include $(C_BINS_FROM_SOURCES_DEPSFILE) deps: $(C_BINS_FROM_SOURCES_DEPSFILE) endif # ^^^ got $(C_BINS_FROM_SOURCES)? --- NEW FILE: BIN_PROGRAMS.make --- # toc makefile snippet to link binaries. # # Usage: # define these vars: # BIN_PROGRAMS = somename anothername # BIN_PROGRAMS_LDADD (optional - list of libs to link to all BIN_PROGRAMS) # # For each FOO in BIN_PROGRAMS, define: # FOO_bin_OBJECTS = list of .o files for FOO # FOO_bin_LDADD = optional arguments to pass to linker, e.g. -lstdc++ # # Then include this file: # # include $(toc_makesdir)/cpp_bins.make # # and add 'bins' somewhere in your dependencies, e.g.: # # all: bins BIN_PROGRAMS_MAKEFILE = $(toc_makesdir)/BIN_PROGRAMS.make ifeq (1,$(configure_with_CYGWIN)) BIN_PROGRAMS_LDADD += -lcygwin endif # toc_link_binary call()able function: # $1 = binary file name # $2 = optional arguments to linker. # list of objects to link is derived from $($(1)_bin_OBJECTS) and $(BIN_PROGRAMS_OBJECTS) toc_link_binary = $(CXX) -o $(1) $($(1)_bin_OBJECTS) $(BIN_PROGRAMS_OBJECTS) $(LDFLAGS) $($(1)_bin_LDADD) $(BIN_PROGRAMS_LDADD) $(2) ifneq (,$(BIN_PROGRAMS)) ifeq (1,$(configure_with_CYGWIN)) CLEAN_FILES += $(addsuffix .exe,$(BIN_PROGRAMS)) CLEAN_FILES += $(wildcard *.exe.stackdump) else CLEAN_FILES += $(wildcard $(BIN_PROGRAMS)) endif BIN_PROGRAMS_DEPSFILE = .toc.BIN_PROGRAMS.make BIN_PROGRAMS_RULES_GENERATOR = $(dir $(BIN_PROGRAMS_MAKEFILE))makerules.BIN_PROGRAMS BIN_PROGRAMS_COMMON_DEPS += Makefile $(BIN_PROGRAMS_MAKEFILE) $(BIN_PROGRAMS_OBJECTS) $(BIN_PROGRAMS_DEPSFILE): Makefile $(BIN_PROGRAMS_RULES_GENERATOR) $(BIN_PROGRAMS_MAKEFILE) ifneq (,$(strip $(filter distclean clean,$(MAKECMDGOALS)))) @echo "$(MAKECMDGOALS): skipping BIN_PROGRAMS rules generation." else @echo "Generating BIN_PROGRAMS rules."; \ $(call toc_generate_rules,BIN_PROGRAMS,$(BIN_PROGRAMS)) > $@ -include $(BIN_PROGRAMS_DEPSFILE) endif deps: $(BIN_PROGRAMS_DEPSFILE) strip-bins: strip $(BIN_PROGRAMS) clean-bins: @test -n "$(BIN_PROGRAMS)" || exit 0; \ echo "Deleting: $(BIN_PROGRAMS)"; \ rm $(BIN_PROGRAMS) > /dev/null || true; run-bins: @LD_LIBRARY_PATH="$${LD_LIBRARY_PATH}:$${PWD}:$(top_src)/libdir"; \ for i in $(BIN_PROGRAMS); do \ echo "Running $$i"; ./$$i || exit $$?; done endif # ^^^ got $(BIN_PROGRAMS) ??? |
From: <sg...@us...> - 2003-10-14 03:14:56
|
Update of /cvsroot/libfunutil/libfunutil/toc/make In directory sc8-pr-cvs1:/tmp/cvs-serv5354/toc/make Modified Files: toc_mainincludes.make subdirs_traverser.make makerules.STATIC_LIBS makerules.SHARED_LIBS makerules.BIN_PROGRAMS install.make flex.make deps.make cpp_static_libs.make cpp_dynamic_libs.make cpp_bins.make c_bins.make Log Message: refactorings/fixes from the main toc tree. Index: toc_mainincludes.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/toc_mainincludes.make,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- toc_mainincludes.make 1 Sep 2003 05:09:30 -0000 1.1 +++ toc_mainincludes.make 14 Oct 2003 03:14:51 -0000 1.2 @@ -2,6 +2,6 @@ include $(toc_makesdir)/toc_functions.make include $(toc_makesdir)/cleaner.make include $(toc_makesdir)/subdirs_traverser.make -include $(toc_makesdir)/deps.make -include $(toc_makesdir)/install.make +include $(toc_makesdir)/C_DEPS.make +include $(toc_makesdir)/INSTALL_XXX.make include $(toc_makesdir)/dist.make Index: subdirs_traverser.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/subdirs_traverser.make,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- subdirs_traverser.make 27 Sep 2003 22:34:03 -0000 1.13 +++ subdirs_traverser.make 14 Oct 2003 03:14:51 -0000 1.14 @@ -36,7 +36,7 @@ .PHONY: subdirs distclean-subdirs clean-subdirs $(SUBDIRS) # note that this only works for subdirs defined BEFORE including this file: -$(SUBDIRS): +$(SUBDIRS): FORCE ${MAKE} -C $@ # @$(call toc_make_subdirs,$@) Index: makerules.STATIC_LIBS =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/makerules.STATIC_LIBS,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- makerules.STATIC_LIBS 27 Sep 2003 22:34:03 -0000 1.2 +++ makerules.STATIC_LIBS 14 Oct 2003 03:14:51 -0000 1.3 @@ -18,8 +18,7 @@ \$(call toc_link_static_lib,${t}) endif -lib-${t}: ${afile} -libs-static: lib-${t} +STATIC_LIBS: ${afile} INSTALL_LIBS += ${afile} EOF done Index: makerules.SHARED_LIBS =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/makerules.SHARED_LIBS,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- makerules.SHARED_LIBS 27 Sep 2003 22:34:03 -0000 1.3 +++ makerules.SHARED_LIBS 14 Oct 2003 03:14:51 -0000 1.4 @@ -33,11 +33,11 @@ uninstall-so-${sofile}: endif + install-LIBEXECS: install-so-${sofile} uninstall-LIBEXECS: uninstall-so-${sofile} -lib-${t}: ${sofile} -libs-shared: lib-${t} +SHARED_LIBS: ${sofile} EOF done Index: makerules.BIN_PROGRAMS =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/makerules.BIN_PROGRAMS,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- makerules.BIN_PROGRAMS 27 Sep 2003 22:34:03 -0000 1.4 +++ makerules.BIN_PROGRAMS 14 Oct 2003 03:14:52 -0000 1.5 @@ -17,7 +17,6 @@ endif CLEAN_FILES += $t -bin-$t: $t -bins: bin-$t +BIN_PROGRAMS: $t EOF done Index: install.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/install.make,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- install.make 5 Sep 2003 09:29:55 -0000 1.25 +++ install.make 14 Oct 2003 03:14:52 -0000 1.26 @@ -1,193 +1,2 @@ -#!/bin/make -f -# To be included from the shared toc makefile. REQUIRES GNU install. -# -# Sample usage: -# INSTALL_BINS = mybin myotherbin # installs to $(prefix)/bin -# INSTALL_LIBS = mylib.a myotherlib.a # installs to $(prefix)/lib -# -# There's a whole lot more to know, if you wanna poke around the code. -# -# Design note: the traditional xxx-local targets aren't really -# necessary. If someone wants to customize install they can simply do -# this: -# -# install: my-install -# my-install: -# .... -# -# -# For each X in $(TOC_INSTALL_TARGET_BASENAMES) the following targets -# are created: -# -# install-X: -# uninstall-X: -# install-X-symlink: -# -# Files will be installed to $(INSTALL_X_DEST) using install -# arguments $(INSTALL_X_INSTALL_FLAGS). All of these vars are -# set up by default, but may be customized: -# -# INSTALL_BINS_DEST = $(prefix)/$(PACKAGE_NAME)/bin -# INSTALL_BINS_INSTALL_FLAGS = -m 0775 -# -# -# Installation can be further customized by using the toc_make_xxx -# call()able functions. - -TOC_INSTALL_TARGET_BASENAMES = BINS SBINS LIBS PACKAGE_LIBS LIBEXECS HEADERS PACKAGE_HEADERS PACKAGE_DATA DOCS - - -ifeq (,$(wildcard $(INSTALLER_BIN))) -$(error install.make requires that the variable INSTALLER_BIN point to a version of install which is vaguely compatible with GNU install.) -endif - -#INSTALL_BINS_SUFFIX ?= -#ifeq (1,$(configure_with_CYGWIN)) -#INSTALL_BINS_SUFFIX = .exe -#endif - -# This whole echo/grep thing is to force it to work on some of my -# older machines where more sane approaches don't seem to work. -# TOC_MAKE_INSTALL_GREP_KLUDGE = test $(shell echo $(1) "" | grep -q '[a-zA-Z0-9]'; echo $$?) = 0 || exit 0 -TOC_MAKE_INSTALL_GREP_KLUDGE = - -# toc_make_install call()able: -# $1=file list -# $2=destdir -# $3=flags for $(INSTALLER_BIN) -toc_make_install = test "x$(1)" = x && exit 0; \ - test -d $(2) || mkdir -p $(2) || exit; \ - for b in $(1) "x"; do test "x$$b" = "xx" && break; \ - b=$$(basename $$b); \ - target=$(2)/$$b; \ - cmd="$(INSTALLER_BIN) $(3) $$b $$target"; echo $$cmd; $$cmd || exit; \ - done - -# toc_make_install_update: identical to toc_make_install -# but does not update the target if it is the same as the source. -toc_make_install_update = test "x$(1)" = x && exit 0; \ - test -d $(2) || mkdir -p $(2) || exit; \ - for b in $(1) ""; do test -z "$$b" && continue; \ - b="$$(basename $$b)"; \ - target="$(2)/$$b"; \ - cmp "$$target" "$$b" > /dev/null 2>&1 && continue; \ - cmd="$(INSTALLER_BIN) $(3) $$b $$target"; echo "$$cmd"; $$cmd || exit; \ - done - -# toc_make_uninstall call()able: -# removes all files listed in $(1) from target directory $(2) -toc_make_uninstall = test "x$(1)" = x && exit 0; \ - test -e "$(2)" || exit 0; \ - for b in $(1) ""; do test -z "$$b" && continue; \ - fp="$(2)/$$b"; test -e "$$fp" || continue; \ - cmd="rm $$fp"; echo $$cmd; $$cmd || exit $$?; \ - done - -# toc_make_install_symlink call()able: -# Works similarly to toc_make_install, but symlinks back to the install source, -# instead of copying. Arg $3 is ignored. -# Note that symlinks must be linked to absolute paths here, because we cannot -# easily/reliably make a relative path from the target directory back to -# the install source: -toc_make_install_symlink = test "x$(1)" = x && exit 0; \ - test -d $(2) || mkdir -p $(2) || exit; \ - for b in $(1) ""; do test -z "$$b" && continue; \ - target="$(2)/$$b"; \ - pwd="$$(pwd)"; \ - src="$$pwd/$$b"; \ - test "$$target" -ef "$$src" && continue; \ - test -f "$$target" && rm "$$target"; \ - echo "Symlinking $$target"; ln -s -f "$$src" "$$target" || exit $$?; \ - done - -# toc_make_install_so: installs foo.so.X.Y.Z and symlinks foo.so, foo.so.X and foo.so.X.Y to it, -# in traditional/common Unix style. -# $1 = so name (foo.so) -# $2-4 = Major, Minor, Patch version numbers -# $5 = destination directory -toc_make_install_so = test "x$(1)" = x && exit 0; \ - test -d $(5) || mkdir -p $(5) || exit; \ - wholename=$(1).$(2).$(3).$(4); \ - target=$(5)/$$wholename; \ - test $$wholename -ef $$target || { \ - echo "Installing/symlinking $$target"; \ - cmd="$(INSTALLER_BIN) -m 0755 $$wholename $$target"; \ - $$cmd || exit; \ - }; \ - cd $(5); \ - for i in $(1) $(1).$(2) $(1).$(2).$(3); do \ - test -e $$i && rm $$i; \ - cmd="ln -fs $$wholename $$i"; echo $$cmd; \ - $$cmd || exit; \ - done -# symlinking method number 2: -# { set -x; \ -# ln -fs $(1).$(2).$(3).$(4) $(1).$(2).$(3); \ -# ln -fs $(1).$(2).$(3) $(1).$(2); \ -# ln -fs $(1).$(2) $(1); \ -# } - - -INSTALLER_BIN_FLAGS_BINS = -m 0755 -INSTALLER_BIN_FLAGS_NONBINS = -m 0644 -INSTALLER_BIN_FLAGS_LIBS = -m 0644 -INSTALLER_BIN_FLAGS_LIBEXECS = -m 0755 - - -# default install flags for the installable file categories: -INSTALL_BINS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_BINS) -INSTALL_SBINS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_BINS) -INSTALL_LIBS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_LIBS) -INSTALL_PACKAGE_LIBS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_LIBS) -INSTALL_LIBEXECS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_LIBEXECS) -INSTALL_HEADERS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) -INSTALL_PACKAGE_HEADERS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) -INSTALL_PACKAGE_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) -INSTALL_DOCS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) - - -INSTALL_MAKEFILE = $(toc_makesdir)/install.make -INSTALL_DEPS_FILE = $(toc_makesdir)/.toc.INSTALL_XXX.make -INSTALL_XXX_GENERATOR = $(dir $(INSTALL_MAKEFILE))makerules.INSTALL_XXX - -# Set install paths for the installable file categories -# and create installation rules. With make 3.80 we can do this with $(eval), -# Make 3.79 is very common, but doesn't support $(eval). -# todo? move this into the configure process? -$(INSTALL_DEPS_FILE): $(INSTALL_MAKEFILE) $(INSTALL_XXX_GENERATOR) -ifneq (,$(strip $(filter clean distclean,$(MAKECMDGOALS)))) -# @echo "$(MAKECMDGOALS): skipping INSTALL_XXX rules generation." -else - @echo "Generating rules for INSTALL_XXX."; \ - $(call toc_generate_rules,INSTALL_XXX,\ - BINS=bin \ - SBINS=sbin \ - LIBS=lib \ - PACKAGE_LIBS='lib/$$(PACKAGE_NAME)' \ - LIBEXECS=lib \ - HEADERS=include \ - PACKAGE_HEADERS='include/$$(PACKAGE_NAME)' \ - PACKAGE_DATA='share/$$(PACKAGE_NAME)' \ - DOCS='share/doc/$$(PACKAGE_NAME)' \ - ) > $@ -endif --include $(INSTALL_DEPS_FILE) -deps: $(INSTALL_DEPS_FILE) - -.PHONY: install-. uninstall-. -subdirs-install: # implemented elsewhere -install: install-. install-subdirs -install-update: install-.-update install-subdirs-update -install-symlink: install-.-symlink install-subdirs-symlink -install-subdirs: subdirs-install -install-subdirs-symlink: subdirs-install-symlink -install-subdirs-update: subdirs-install-update -uninstall-subdirs: subdirs-uninstall - -uninstall: uninstall-. uninstall-subdirs - -# implement these to hook in to the start of the install. Untested. :/ -install-.: -install-.-update: -install-.-symlink: -uninstall-.: +# deprecated file. It's replacement is: +include $(toc_makesdir)/INSTALL_XXX.make Index: flex.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/flex.make,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- flex.make 27 Sep 2003 22:34:03 -0000 1.2 +++ flex.make 14 Oct 2003 03:14:52 -0000 1.3 @@ -36,12 +36,12 @@ %$(FLEX_FILE_SUFFIX)$(FLEX_CPPFILE_SUFFIX): %$(FLEX_FILE_SUFFIX) $(FLEX_MAKEFILE) Makefile @cmd='$(FLEX_BIN) $(FLEXES_ARGS) $($(basename $(patsubst %$(FLEX_FILESUFFIX)$(FLEX_CPPFILE_SUFFIX),%,$@))_FLEXES_ARGS) -t $< '; \ echo $$cmd '> $@'; \ - $$cmd | \ - perl -p \ + $$cmd > $@ || { err=$$?; rm $@; exit $$err; }; \ + perl -i -p \ -e 's/iostream\.h/iostream/;' \ -e 'next if m/iostream/;' \ -e 'next if m/::[io]stream/;' \ - -e 's/(ostream|istream)([^\.])/std::$$1$$2/g;' > $@ + -e 's/(ostream|istream)([^\.])/std::$$1$$2/g;' $@ # @echo "Flexing $< to $@, plus doing iostream hacks :/."; Index: deps.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/deps.make,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- deps.make 1 Sep 2003 04:58:03 -0000 1.11 +++ deps.make 14 Oct 2003 03:14:52 -0000 1.12 @@ -1,39 +1,3 @@ -# makefile snippet -# Usage: -# include path/to/this/file -# -# That will set up a 'deps' target which deps all C/C++ files and updates -# the deps when any of those files, or the Makefile, changes. -# That's normally all there is to it. - -DEPS_C_SOURCES_GLOB ?= *.cpp *.c *.c++ *.C *.cc *.moc -SOURCE_FILES_TO_DEP ?= $(sort $(wildcard $(DEPS_C_SOURCES_GLOB))) - -TOC_C_DEPS_MAKEFILE = $(toc_makesdir)/deps.make - -DEPSGEN_BIN = $(toc_tocdir)/bin/mkdep -$(DEPSGEN_BIN): $(TOC_C_DEPS_MAKEFILE) - @echo "Building $@"; cd $(toc_tocdir)/bin; \ - $(CC) -o mkdep mkdep.c - -ifneq (,$(SOURCE_FILES_TO_DEP)) - -TOC_C_DEPSFILE = .toc.C_DEPS.make -$(TOC_C_DEPSFILE): $(DEPSGEN_BIN) $(SOURCE_FILES_TO_DEP) Makefile $(TOC_C_DEPS_MAKEFILE) -ifneq (,$(strip $(filter clean distclean,$(MAKECMDGOALS)))) - @echo "$(MAKECMDGOALS): skipping C_DEPS rules generation." -else - @test -n "$(SOURCE_FILES_TO_DEP)" || exit 0; \ - echo "Generating C_DEPS rules for $(DEPS_C_SOURCES_GLOB)"; \ - $(call toc_make_c_deps,$(SOURCE_FILES_TO_DEP),) > $@ --include $(TOC_C_DEPSFILE) -endif -deps-c: $(TOC_C_DEPSFILE) -deps: deps-c -CLEAN_FILES += $(TOC_C_DEPSFILE) - -all: deps-c - - -endif +# deprecated file. It's replacement is: +include $(toc_makesdir)/C_DEPS.make Index: cpp_static_libs.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/cpp_static_libs.make,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- cpp_static_libs.make 27 Sep 2003 22:34:03 -0000 1.8 +++ cpp_static_libs.make 14 Oct 2003 03:14:52 -0000 1.9 @@ -1,45 +1,2 @@ -# cpp_static_libs.make: snippet for linking static libraries from -# object files. -# -# This snippet defines the targets 'libs-static' and 'X.a' for each X in -# $(STATIC_LIBS). libs-static simply depends on X.a. -# -# sample usage: -# -# STATIC_LIBS = foo bar -# STATIC_LIBS_OBJECTS = # optional list of .o files to link to all $(STATIC_LIBS) -# foo_a_OBJECTS = list of .o files -# bar_a_OBJECTS = list of .o files -# -# all: libs -#(or) all: foo.a bar.a -# -# that creates foo.a and bar.a and adds those files to $(INSTALL_LIBS) - -STATIC_LIBS_MAKEFILE = $(toc_makesdir)/cpp_static_libs.make -STATIC_LIBS_A = $(patsubst %,%.a,$(STATIC_LIBS)) -CLEAN_FILES += $(STATIC_LIBS_A) - -# toc_link_static_lib call()able: -# $1 = base name (e.g., foo) -# links $(1).a from $($(1)_a_OBJECTS) and $(STATIC_LIBS_OBJECTS) -toc_link_static_lib = $(AR) crs $(1).a $($(1)_a_OBJECTS) $(STATIC_LIBS_OBJECTS) - -ifneq (,$(STATIC_LIBS_A)) - -STATIC_LIBS_DEPSFILE = .toc.STATIC_LIBS.make -STATIC_LIBS_RULES_GENERATOR = $(dir $(STATIC_LIBS_MAKEFILE))makerules.STATIC_LIBS - -$(STATIC_LIBS_DEPSFILE): Makefile $(STATIC_LIBS_MAKEFILE) $(STATIC_LIBS_RULES_GENERATOR) -ifneq (,$(strip $(filter distclean clean,$(MAKECMDGOALS)))) - @echo "$(MAKECMDGOALS): skipping STATIC_LIBS rules generation." -else - @echo "Generating STATIC_LIBS rules."; \ - $(call toc_generate_rules,STATIC_LIBS,$(STATIC_LIBS)) > $@ -endif --include $(STATIC_LIBS_DEPSFILE) -deps: $(STATIC_LIBS_DEPSFILE) - -libs: libs-static - -endif +# deprecated file. It's replacement is: +include $(toc_makesdir)/STATIC_LIBS.make Index: cpp_dynamic_libs.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/cpp_dynamic_libs.make,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- cpp_dynamic_libs.make 27 Sep 2003 22:34:03 -0000 1.11 +++ cpp_dynamic_libs.make 14 Oct 2003 03:14:52 -0000 1.12 @@ -1,86 +1,2 @@ -# Links objects into a dynamically-linked library using g++ -# usage: -# -# SHARED_LIBS = foo -# SHARED_LIBS_OBJECTS = # optional list of .o files to link to all $(SHARED_LIBS) -# foo_so_OBJECTS = list of object files to link to foo.so -# foo_so_LDADD = # optional libraries passed to linker (e.g., -lstdc++) -# foo_so_LDFLAGS = # optional args to linker -# foo_so_VERSION = # optional Major.Minor.Patch # e.g. "1.0.1" it MUST match this format! -# include $(toc_makesdir)/cpp_dynamic_libs.make -# -# If foo_so_VERSION is not set then no numbered symlinks will be created. -# -# Run: -# all: lib-shared -# -# Effect: -# Creates foo.so and foo.so<version> by linking $(foo_so_OBJECTS). It -# also sets up install/uninstall rules for handling the symlinks. - -SHARED_LIBS_MAKEFILE = $(toc_makesdir)/cpp_dynamic_libs.make - -# toc_link_shared_lib -# $1 = basename -# $2 = extra args to the linker -toc_link_shared_lib = { soname=$(1).so; wholename=$${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR).$($(1)_so_PATCH); \ - so_major=$${soname}.$($(1)_so_MAJOR); \ - test x = x$($(1)_so_MAJOR) && wholename=$${soname}; \ - cmd="$(CXX) $(LDFLAGS) $($(1)_LDFLAGS) -o $${wholename} -export-dynamic -shared \ - -Wl,-soname,$${so_major} $($(1)_so_OBJECTS) $(SHARED_LIBS_OBJECTS) $(SHARED_LIBS_LDADD) $($(1)_so_LDADD) $(2)"; \ - test x1 = x$(configure_build_quietly) || echo $$cmd; \ - $$cmd || exit; \ - test x = x$($(1)_so_MAJOR) || { \ - ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR); \ - ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR); \ - ln -fs $${wholename} $${soname}; \ - }; \ - } -# symlinking methods: -# method 1: -# ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR); \ -# ln -fs $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR) $${soname}.$($(1)_so_MAJOR); \ -# ln -fs $${soname}.$($(1)_so_MAJOR) $${soname}; \ -# method 1.5: -# link1=$${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR); ln -fs $${wholename} $$link1; \ -# link2=$${soname}.$($(1)_so_MAJOR); ln -fs $$link1 $$link2; \ -# link3=$${soname}; ln -fs $$link2 $$link3; \ -# method 2: -# ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR); \ -# ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR); \ -# ln -fs $${wholename} $${soname}; \ - - -# for l in $${soname} \ -# $${soname}.$($(1)_so_MAJOR) \ -# $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR) \ -# ; do \ -# ln -fs $${wholename} $$l; \ -# done; \ - -ifneq ($(SHARED_LIBS),) -SHARED_LIBS_SOFILES = $(patsubst %,%.so,$(SHARED_LIBS)) -libs-shared: $(SHARED_LIBS_SOFILES) -$(SHARED_LIBS_SOFILES): Makefile $(SHARED_LIBS_MAKEFILE) - - - -SHARED_LIBS_RULES_GENERATOR = $(dir $(SHARED_LIBS_MAKEFILE))makerules.SHARED_LIBS - -# to ensure that .so files are installed in a unix-friendly manner we need to implement -# some install rules for them... -SHARED_LIBS_DEPSFILE = .toc.SHARED_LIBS.make -deps: $(SHARED_LIBS_INSTALL_RULES) -$(SHARED_LIBS_DEPSFILE): Makefile $(SHARED_LIBS_MAKEFILE) $(SHARED_LIBS_RULES_GENERATOR) -ifneq (,$(strip $(filter distclean clean,$(MAKECMDGOALS)))) - @echo "$(MAKECMDGOALS): skipping SHARED_LIBS rules generation." -else - @echo "Generating SHARED_LIBS rules."; \ - $(call toc_generate_rules,SHARED_LIBS,$(SHARED_LIBS)) > $@ -endif --include $(SHARED_LIBS_DEPSFILE) - -CLEAN_FILES += $(SHARED_LIBS_SOFILES) $(wildcard $(patsubst %,%.*,$(SHARED_LIBS_SOFILES))) - -endif -# ^^^ got SHARED_LIBS? +# deprecated file. It's replacement is: +include $(toc_makesdir)/SHARED_LIBS.make Index: cpp_bins.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/cpp_bins.make,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- cpp_bins.make 27 Sep 2003 22:34:03 -0000 1.8 +++ cpp_bins.make 14 Oct 2003 03:14:52 -0000 1.9 @@ -1,71 +1,2 @@ -# toc makefile snippet to link binaries. -# -# Usage: -# define these vars: -# BIN_PROGRAMS = somename anothername -# BIN_PROGRAMS_LDADD (optional - list of libs to link to all BIN_PROGRAMS) -# -# For each FOO in BIN_PROGRAMS, define: -# FOO_bin_OBJECTS = list of .o files for FOO -# FOO_bin_LDADD = optional arguments to pass to linker, e.g. -lstdc++ -# -# Then include this file: -# -# include $(toc_makesdir)/cpp_bins.make -# -# and add 'bins' somewhere in your dependencies, e.g.: -# -# all: bins - - -BIN_PROGRAMS_MAKEFILE = $(toc_makesdir)/cpp_bins.make - -ifeq (1,$(configure_with_CYGWIN)) -BIN_PROGRAMS_LDADD += -lcygwin -endif - -# toc_link_binary call()able function: -# $1 = binary file name -# $2 = optional arguments to linker. -# list of objects to link is derived from $($(1)_bin_OBJECTS) and $(BIN_PROGRAMS_OBJECTS) -toc_link_binary = $(CXX) -o $(1) $($(1)_bin_OBJECTS) $(BIN_PROGRAMS_OBJECTS) $(LDFLAGS) $($(1)_bin_LDADD) $(BIN_PROGRAMS_LDADD) $(2) - -ifneq (,$(BIN_PROGRAMS)) - -ifeq (1,$(configure_with_CYGWIN)) -CLEAN_FILES += $(addsuffix .exe,$(BIN_PROGRAMS)) -CLEAN_FILES += $(wildcard *.exe.stackdump) -else -CLEAN_FILES += $(wildcard $(BIN_PROGRAMS)) -endif - -BIN_PROGRAMS_DEPSFILE = .toc.BIN_PROGRAMS.make - -BIN_PROGRAMS_RULES_GENERATOR = $(dir $(BIN_PROGRAMS_MAKEFILE))makerules.BIN_PROGRAMS - -BIN_PROGRAMS_COMMON_DEPS += Makefile $(BIN_PROGRAMS_MAKEFILE) $(BIN_PROGRAMS_OBJECTS) -$(BIN_PROGRAMS_DEPSFILE): Makefile $(BIN_PROGRAMS_RULES_GENERATOR) $(BIN_PROGRAMS_MAKEFILE) -ifneq (,$(strip $(filter distclean clean,$(MAKECMDGOALS)))) - @echo "$(MAKECMDGOALS): skipping BIN_PROGRAMS rules generation." -else - @echo "Generating BIN_PROGRAMS rules."; \ - $(call toc_generate_rules,BIN_PROGRAMS,$(BIN_PROGRAMS)) > $@ - --include $(BIN_PROGRAMS_DEPSFILE) -endif - -deps: $(BIN_PROGRAMS_DEPSFILE) - -strip-bins: $(BIN_PROGRAMS_TARGETS) - strip $(BIN_PROGRAMS) - -clean-bins: - @test -n "$(BIN_PROGRAMS)" || exit 0; \ - echo "Deleting: $(BIN_PROGRAMS)"; \ - rm $(BIN_PROGRAMS) > /dev/null || true; - -bins-run: $(BIN_PROGRAMS_TARGETS) - @LD_LIBRARY_PATH=$${LD_LIBRARY_PATH}:$${PWD}; for i in $(BIN_PROGRAMS); do echo "Running $$i"; ./$$i || exit $$?; done - -endif -# ^^^ got $(BIN_PROGRAMS) ??? +# deprecated file. It's replacement is: +include $(toc_makesdir)/BIN_PROGRAMS.make Index: c_bins.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/c_bins.make,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- c_bins.make 5 Sep 2003 09:32:37 -0000 1.2 +++ c_bins.make 14 Oct 2003 03:14:52 -0000 1.3 @@ -1,38 +1,2 @@ -#!make -# usage: -# set: -# C_BINS_FROM_SOURCES = foo bar -# foo_bin_SOURCES = foo.c foo2.c -# bar_bin_SOURCES = bar.c bar2.c foobar.c -# optional: foo_bin_OBJECTS = somethingdifferent.o -# optional: foo_bin_CFLAGS = -DCOMPILING_FOO=1 -I/somewhere/different -# optional: foo_bin_LFLAGS = -lfl -lfoo -# -# all: bins -# -# This compiles, all in one go, 'bar' from $(bar_bin_SOURCES) - - -C_BINS_FROM_SOURCES_MAKEFILE = $(toc_makesdir)/c_bins.make - - -ifneq (,$(C_BINS_FROM_SOURCES)) -C_BINS_FROM_SOURCES_RULES_GENERATOR = $(toc_makesdir)/makerules.C_BINS_FROM_SOURCES -C_BINS_FROM_SOURCES_COMMON_DEPS += Makefile $(C_BINS_FROM_SOURCES_MAKEFILE) -C_BINS_FROM_SOURCES_DEPSFILE = .toc.C_BINS_FROM_SOURCES.make -CLEAN_FILES += $(C_BINS_FROM_SOURCES_DEPSFILE) -$(C_BINS_FROM_SOURCES_DEPSFILE): $(C_BINS_FROM_SOURCES_COMMON_DEPS) $(C_BINS_FROM_SOURCES_RULES_GENERATOR) -ifneq (,$(strip $(filter distclean clean,$(MAKECMDGOALS)))) - @echo "$(MAKECMDGOALS): skipping C_BINS_FROM_SOURCES rules generation." -else - @echo "Generating C_BINS_FROM_SOURCES rules."; \ - $(call toc_generate_rules,C_BINS_FROM_SOURCES,$(C_BINS_FROM_SOURCES)) > $@ -endif -# ^^^ making clean? - --include $(C_BINS_FROM_SOURCES_DEPSFILE) - -deps: $(C_BINS_FROM_SOURCES_DEPSFILE) - -endif -# ^^^ got $(C_BINS_FROM_SOURCES)? +# deprecated file. It's replacement is: +include $(toc_makesdir)/C_BINS_FROM_SOURCES.make |
From: <sg...@us...> - 2003-10-14 03:14:02
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests In directory sc8-pr-cvs1:/tmp/cvs-serv5185/toc/tests Added Files: gcc_build_and_run.sh bzlib.sh Log Message: egg --- NEW FILE: gcc_build_and_run.sh --- # toc_run_description = trying to build $@ # # toc_begin_help = # # Tries to compile $@ using ${CC} and returns the error code which the # compiler returns. $@ may be made up of any flags which you want to # pass to the compilers, such as -I/some/path. Do not pass -c nor # -o, as those are handled by this test. # # This code uses ${INCLUDES}. You can easily set it only for the # duration of this test by doing something like the following: # # INCLUDES="-I/path1 -I/path2" toc_run_fail myfile.c # # This is an alternative to using the more verbose approach of saving # INCLUDES, adjusting it, calling this test and re-setting INCLUDES. # # = toc_end_help toc_get_make CC CC=${TOC_GET_MAKE} test "x$CC" = x && { echo "This test requires that the config variable CC have been set to point to gcc." echo "Try running the gnu_cpp_tools test, or another test which sets C/C++-related variables, or call toc_add_make CC=/path/to/gcc." return 1 } tmpprefix=.toc.build_and_run binfile=./$tmpprefix compiler_out=$tmpprefix.out cmd="$CC ${INCLUDES} $@ -o $binfile" echo $cmd > $compiler_out $cmd >> $compiler_out 2>&1 err=$? test x0 = x$err || { echo "Compiler output is in $compiler_out (but will be erased the next time this test is run!)." return $err err=$? } echo $binfile >> $compiler_out $binfile >> $compiler_out 2>&1 err=$? test x0 != x$err && { echo "output is in $compiler_out (but will be erased the next time this test is run!)." } || { rm $binfile $compiler_out } return $err --- NEW FILE: bzlib.sh --- # toc_run_description = looking for bzip lib and header # toc_begin_help = # Searches for libbz2.a and bzlib.h in commonly-used locations and # sets the config var HAVE_BZLIB to zero or one. # Pass --disable-bzlib to configure to explicitely set # HAVE_BZ2LIB to zero. # = toc_end_help test x0 = x${configure_enable_bzlib} && { echo "bzlib explicitely disabled via --disable-bzlib." toc_add_config HAVE_BZLIB=0 return 0 } toc_find_failok libbz2.a ${prefix}/lib:/usr/lib:/usr/local/lib:${LD_LIBRARY_PATH} zlib_a=${TOC_FIND_RESULT} toc_find_failok bzlib.h ${prefix}/include:/usr/include:/usr/local/include zlib_h=${TOC_FIND_RESULT} test "x" = "x$zlib_a" -o "x" = "x$zlib_h" HAVE_BZLIB=$? toc_add_config HAVE_BZLIB=$HAVE_BZLIB |
From: <sg...@us...> - 2003-10-14 03:13:00
|
Update of /cvsroot/libfunutil/libfunutil/doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv5023/doc/api Modified Files: Makefile Log Message: added a var to Doxygen's file. Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/doc/api/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile 29 Aug 2003 05:39:13 -0000 1.7 +++ Makefile 14 Oct 2003 03:12:57 -0000 1.8 @@ -24,5 +24,7 @@ $(DOXYFILE): Makefile $(DOXYFILE_IN) $(call toc_atparse_file,$(DOXYFILE_IN),$@, \ BT_PKG_NAME=$(PACKAGE_NAME) BT_PKG_VERSION=$(PACKAGE_VERSION) \ - BT_PROG_PERL=$(PERL_BIN)) + BT_PROG_PERL=$(PERL_BIN) \ + top_includesdir="$(top_includesdir)" \ + ) |
From: <sg...@us...> - 2003-10-14 03:12:29
|
Update of /cvsroot/libfunutil/libfunutil/doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv4838/doc/api Modified Files: Doxyfile.in Log Message: predefined two macros, HAVE_CONFIG_H and one for the toolbox stuff. Index: Doxyfile.in =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/doc/api/Doxyfile.in,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Doxyfile.in 28 Aug 2003 12:35:22 -0000 1.5 +++ Doxyfile.in 14 Oct 2003 03:12:24 -0000 1.6 @@ -311,7 +311,7 @@ # Also, really we should feed doxygen the list of source files we actually # build (if we can get it from the makefiles) rather than having to exclude # the crap which isn't worth building, below. -INPUT = ../../include/fun index.txt +INPUT = @top_includesdir@/fun @top_includesdir@/s11n @top_includesdir@/toolbox index.txt # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp @@ -702,13 +702,13 @@ # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. -MACRO_EXPANSION = NO +MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_PREDEFINED tags. -EXPAND_ONLY_PREDEF = NO +EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. @@ -734,7 +734,8 @@ # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. -PREDEFINED = +PREDEFINED = ZSTREAM_NAMESPACE=toolbox HAVE_CONFIG_H=1 + # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. |
From: <sg...@us...> - 2003-10-14 03:12:05
|
Update of /cvsroot/libfunutil/libfunutil In directory sc8-pr-cvs1:/tmp/cvs-serv4759 Added Files: toc.s11n.make.at configure.s11n Log Message: egg --- NEW FILE: toc.s11n.make.at --- #!/do/not/make #^^^ only to help emacs out CLEAN_FILES += $(wildcard *.o *~) FLEX = @FLEX@ configure_enable_zlib = @HAVE_ZLIB@ configure_enable_bzlib = @HAVE_BZLIB@ S11N_LIBDIR = $(top_srcdir)/lib/s11n S11N_LIB_A = $(S11N_LIBDIR)/libs11n.a $(S11N_LIB_A): ${MAKE} -C $(S11N_LIBDIR) S11N_LIB_SO = $(S11N_LIBDIR)/libs11n.so $(S11N_LIB_SO): ${MAKE} -C $(S11N_LIBDIR) L_S11N = -L$(S11N_LIBDIR) -ls11n S11N_CLIENT_LDADD = -export-dynamic $(L_S11N) -ldl ifeq (1,$(configure_enable_zlib)) S11N_CLIENT_LDADD += -lz endif ifeq (1,$(configure_enable_bzlib)) S11N_CLIENT_LDADD += -lbz2 endif configure_with_lyxport = @configure_with_lyxport@ ifeq (1,$(configure_with_lyxport)) # these flags are used by toc/make/lyxport.make LYXPORT_L2HARGS = -nonavigation -show_section_numbers -split 0 -noimages LYXPORT_ARGS = -c -tt LYXPORT_ARGS += --html --opts_l2h '$(LYXPORT_L2HARGS)' LYXPORT_ARGS += --ps --pdf LYXPORT_BIN = @LYXPORT_BIN@ endif --- NEW FILE: configure.s11n --- echo "==================== s11n-specific checks:" toc_run_fail flex toc_run_failok bzlib toc_run_failok lyxport toc_atfilter_as_makefile toc.s11n.make.at toc.s11n.make |
From: <sg...@us...> - 2003-10-14 03:11:21
|
Update of /cvsroot/libfunutil/libfunutil/include In directory sc8-pr-cvs1:/tmp/cvs-serv4678/include Modified Files: config.h.at Log Message: s11n-related changes Index: config.h.at =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/include/config.h.at,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- config.h.at 27 Sep 2003 22:38:25 -0000 1.6 +++ config.h.at 14 Oct 2003 03:11:17 -0000 1.7 @@ -28,4 +28,11 @@ #define HAVE_ZLIB @HAVE_ZLIB@ // ^^^^ from the zlib test + +#define HAVE_BZLIB @HAVE_BZLIB@ +// ^^^^ from the bzlib test + +#define DEFAULT_DLLLOADER_PATH "@DEFAULT_DLLLOADER_PATH@" +#define S11N_LIBRARY_VERSION "@PACKAGE_VERSION@" + #endif // CONFIG_H_INCLUDED |
From: <sg...@us...> - 2003-10-14 03:11:21
|
Update of /cvsroot/libfunutil/libfunutil In directory sc8-pr-cvs1:/tmp/cvs-serv4678 Modified Files: toc_shared.make.at configure.libfunutil Makefile Log Message: s11n-related changes Index: toc_shared.make.at =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc_shared.make.at,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- toc_shared.make.at 27 Sep 2003 22:40:40 -0000 1.23 +++ toc_shared.make.at 14 Oct 2003 03:11:17 -0000 1.24 @@ -118,8 +118,7 @@ DIST_FILES += Makefile - -configure_have_zlib = @HAVE_ZLIB@ +configure_enable_zlib = @HAVE_ZLIB@ configure_enable_s11n = @configure_enable_s11n@ configure_build_quietly = @configure_build_quietly@ @@ -128,6 +127,7 @@ LIBREADLINE_LDADD = @LIBREADLINE_LDADD@ endif +include $(top_srcdir)/toc.s11n.make include $(toc_makesdir)/toc_mainincludes.make include $(toc_makesdir)/tests.make Index: configure.libfunutil =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/configure.libfunutil,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- configure.libfunutil 27 Sep 2003 22:40:40 -0000 1.19 +++ configure.libfunutil 14 Oct 2003 03:11:17 -0000 1.20 @@ -57,12 +57,15 @@ source ${configure_developer_script} || toc_die $? "${configure_developer_script} failed" } +configure_enable_s11n=${configure_enable_s11n-1} test x1 = "x${configure_enable_s11n}" && { - toc_run_fail flex + source configure.s11n } + echo ============================================================== echo "${PACKAGE_NAME} configuration checks completed." echo ============================================================== # toc_run_fail toc_project_makefile + return 0 Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/Makefile,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Makefile 5 Sep 2003 09:27:50 -0000 1.13 +++ Makefile 14 Oct 2003 03:11:17 -0000 1.14 @@ -2,8 +2,11 @@ default: all -SUBDIRS = build lib util tests include doc -SUBDIRS += toc +SUBDIRS = build lib util client tests include doc +ifneq (,$(strip $(filter dist testdist,$(MAKECMDGOALS)))) + SUBDIRS += toc +endif + include toc.make |
From: <sg...@us...> - 2003-10-14 03:11:21
|
Update of /cvsroot/libfunutil/libfunutil/lib In directory sc8-pr-cvs1:/tmp/cvs-serv4678/lib Modified Files: Makefile Log Message: s11n-related changes Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile 27 Sep 2003 22:40:02 -0000 1.4 +++ Makefile 14 Oct 2003 03:11:17 -0000 1.5 @@ -4,7 +4,7 @@ ifeq (1,$(configure_enable_s11n)) -SUBDIRS += s11n +SUBDIRS += toolbox s11n endif all: subdirs |
From: <sg...@us...> - 2003-10-14 03:08:41
|
Update of /cvsroot/libfunutil/libfunutil/lib/toolbox In directory sc8-pr-cvs1:/tmp/cvs-serv4293/lib/toolbox Log Message: Directory /cvsroot/libfunutil/libfunutil/lib/toolbox added to the repository |
From: <sg...@us...> - 2003-10-14 03:08:28
|
Update of /cvsroot/libfunutil/libfunutil/lib/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv4263/lib/s11n Removed Files: S11nNodeBuilder.h S11nNodeBuilder.cpp Log Message: renamed to node_builder. --- S11nNodeBuilder.h DELETED --- --- S11nNodeBuilder.cpp DELETED --- |
Update of /cvsroot/libfunutil/libfunutil/lib/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv4002/lib/s11n Removed Files: ChildrenHolder.h ClassLoader.h DLLLoader.cpp DLLLoader.h Instantiator.h KeyValueParser.cpp KeyValueParser.h PathFinder.cpp PathFinder.h PointerList.h PropertiesProvider.cpp PropertiesProvider.h S11nFileLoader.h S11nIO.cpp S11nIO.h StdStringTokenizer.cpp StdStringTokenizer.h StringList.cpp StringList.h Log Message: being relocated/refactored to ../toolbox. --- ChildrenHolder.h DELETED --- --- ClassLoader.h DELETED --- --- DLLLoader.cpp DELETED --- --- DLLLoader.h DELETED --- --- Instantiator.h DELETED --- --- KeyValueParser.cpp DELETED --- --- KeyValueParser.h DELETED --- --- PathFinder.cpp DELETED --- --- PathFinder.h DELETED --- --- PointerList.h DELETED --- --- PropertiesProvider.cpp DELETED --- --- PropertiesProvider.h DELETED --- --- S11nFileLoader.h DELETED --- --- S11nIO.cpp DELETED --- --- S11nIO.h DELETED --- --- StdStringTokenizer.cpp DELETED --- --- StdStringTokenizer.h DELETED --- --- StringList.cpp DELETED --- --- StringList.h DELETED --- |
From: <sg...@us...> - 2003-10-09 22:21:32
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests In directory sc8-pr-cvs1:/tmp/cvs-serv5372 Modified Files: gnu_cpp_tools.sh Log Message: i'm a fucking idiot sometimes: i had the usage of NDEBUG inverted. :/ Index: gnu_cpp_tools.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/tests/gnu_cpp_tools.sh,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- gnu_cpp_tools.sh 27 Sep 2003 22:34:03 -0000 1.11 +++ gnu_cpp_tools.sh 9 Oct 2003 22:20:54 -0000 1.12 @@ -4,7 +4,6 @@ # --enable-debug causes stuff to be built -g instead of -02. This is a # little weird, but you can control the optimization level # with --enable-debug="-O3 -fno-inline" etc. -# --enable-debug (without arguments) also sets -DNDEBUG=1. # --enable-warn causes stuff to be built -Wall. To turn on -Werror, go # --enable-warn="-Wall -Werror" etc. # --enable-werror same as --enable-warn="-Wall -Werror" @@ -52,11 +51,11 @@ toc_add_make INCLUDES="$INCLUDES" toc_add_make CPPFLAGS="$CPPFLAGS" if test "$configure_enable_debug" = 1; then - OPT="-g $OPT -DNDEBUG=1" + OPT="-g $OPT" elif test "${configure_enable_debug:-0}" = 0; then # What's a sensible default here? -O2? Put it first in the hopes # that any values already in $OPT will take precedence. - OPT="-O2 $OPT" + OPT="-O2 $OPT -DNDEBUG=1" else # They specified some flags. OPT="$configure_enable_debug" |
From: <sg...@us...> - 2003-09-28 16:00:55
|
Update of /cvsroot/libfunutil/libfunutil/toc/make In directory sc8-pr-cvs1:/tmp/cvs-serv4178 Modified Files: Makefile Log Message: un-did a cross-project-confusion foo-foo Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile 28 Aug 2003 09:24:28 -0000 1.5 +++ Makefile 28 Sep 2003 16:00:39 -0000 1.6 @@ -4,4 +4,8 @@ DIST_FILES += $(wildcard *.make) toc.make.at toc.qmake.at -DIST_FILES += makerules.STATIC_LIBS makerules.BIN_PROGRAMS makerules.SHARED_LIBS makerules.INSTALL_XXX +DIST_FILES += makerules.STATIC_LIBS \ + makerules.BIN_PROGRAMS \ + makerules.SHARED_LIBS \ + makerules.INSTALL_XXX \ + makerules.C_BINS_FROM_SOURCES |
From: <sg...@us...> - 2003-09-28 12:40:36
|
Update of /cvsroot/libfunutil/libfunutil/lib/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv29778/lib/s11n Modified Files: DLLLoader.cpp Log Message: Fix to avoid closing soh_main multiple times. Index: DLLLoader.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/s11n/DLLLoader.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- DLLLoader.cpp 28 Sep 2003 03:21:57 -0000 1.3 +++ DLLLoader.cpp 28 Sep 2003 12:40:21 -0000 1.4 @@ -82,14 +82,13 @@ DLLLoader::soh_map_type::iterator et = map.end(); for( ; it != et; ++it ) { - if( NULL != (*it).second ) + if( NULL != (*it).second && ( soh_main != (*it).second ) ) { COUT << "Closing DLL: " << std::hex <<(*it).second<<""<<std::endl; dlclose( (*it).second ); } map.erase( it ); } - dlclose( soh_main ); } }; |
From: <sg...@us...> - 2003-09-28 03:22:12
|
Update of /cvsroot/libfunutil/libfunutil/lib/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv17332/lib/s11n Modified Files: ClassLoader.h DLLLoader.cpp DLLLoader.h Log Message: good night! Index: ClassLoader.h =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/s11n/ClassLoader.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ClassLoader.h 27 Sep 2003 22:36:54 -0000 1.1 +++ ClassLoader.h 28 Sep 2003 03:21:57 -0000 1.2 @@ -33,6 +33,11 @@ */ template < class BaseType, class KeyType = std::string > class ClassLoader { + private: + ClassLoader( const ClassLoader & ); // intentionally unimpl + ClassLoader & operator=( const ClassLoader & ); // intentionally unimpl + typedef s11n::Instantiator < BaseType, KeyType > instantiator_type; + PathFinder m_path; public: typedef BaseType value_type; typedef KeyType key_type; @@ -93,11 +98,6 @@ return this->m_path; } - private: - typedef s11n::Instantiator < BaseType, KeyType > instantiator_type; -// ClassLoader( const ClassLoader & ); // intentionally unimpl -// ClassLoader & operator=( const ClassLoader & ); // intentionally unimpl - PathFinder m_path; }; Index: DLLLoader.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/s11n/DLLLoader.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- DLLLoader.cpp 28 Sep 2003 01:35:30 -0000 1.2 +++ DLLLoader.cpp 28 Sep 2003 03:21:57 -0000 1.3 @@ -29,16 +29,16 @@ object has a registry, else false. It only runs the registry the first time it is passed a given pointer. */ - bool check_for_registry( void * soh ) + bool check_for_registry( void * soh, const char * key ) { if( ! soh ) return false; const char * funcname = "DLLLoader_bootstrap"; - typedef void (*registry)(); - typedef std::map<void *,unsigned long int> done_map; + typedef void (*registry)( const char * ); + typedef std::map<void *,bool> done_map; static done_map done; if( done[soh] ) return true; //COUT << "check_for_registry(" << std::hex << soh << ")"<<std::endl; - done[soh] = 1; + done[soh] = true; registry reg; reg = (registry) dlsym( soh, funcname ); if( ! reg ) @@ -46,7 +46,7 @@ //CERR << "no " << funcname << "() found in " << std::hex << soh << "" << std::endl; return false; } - reg(); + reg( key ? key : "" ); return true; } @@ -65,24 +65,32 @@ if( ! soh_main ) { soh_main = dlopen( NULL, RTLD_NOW | RTLD_GLOBAL ); - check_for_registry( soh_main ); + check_for_registry( soh_main, "DLLLoader bootstrap" ); } } DLLLoader::~DLLLoader() { - if( 0 == --DLLLoader_inst_count ) { - dlclose( soh_main ); + COUT << "DLLoader::~DLLoader " << std::endl; + DLLLoader::symbol_map_type & smap = DLLLoader::symbol_map(); + smap.erase( smap.begin(), smap.end() ); + DLLLoader::soh_map_type & map = DLLLoader::soh_map(); DLLLoader::soh_map_type::iterator it = map.begin(); DLLLoader::soh_map_type::iterator et = map.end(); for( ; it != et; ++it ) { - //COUT << "Closing DLL: " << std::hex <<(*it).second<<std::endl; - dlclose( (*it).second ); + if( NULL != (*it).second ) + { + COUT << "Closing DLL: " << std::hex <<(*it).second<<""<<std::endl; + dlclose( (*it).second ); + } + map.erase( it ); } + + dlclose( soh_main ); } }; @@ -106,21 +114,33 @@ //COUT << "load("<<key<<")"<<std::endl; typedef ThisType::value_type CHT; CHT *ch = NULL; - ch = this->ParentClass::load( key ); + ch = this->ParentClass::load( key ); // if the parent can handle it, great. if ( ch ) return ch; void * soh = 0; std::string xlated = key; // key, translated to remove namespace part (because :: is not filesystem-friendly). std::string path = key; - DLLLoader::soh_map_type & map = DLLLoader::soh_map(); - DLLLoader::soh_map_type::iterator it = map.find(key); - if( map.end() != it ) + + DLLLoader::instantiator_func instantiator = 0; + DLLLoader::symbol_map_type & symmap = DLLLoader::symbol_map(); + DLLLoader::symbol_map_type::iterator sit = symmap.find(key); + if( symmap.end() != sit ) { - soh = (*it).second; - if( NULL == soh ) return NULL; + instantiator = (*sit).second; + if( NULL == instantiator ) return NULL; + return instantiator( key.c_str() ); } - else - { + + DLLLoader::soh_map_type & map = DLLLoader::soh_map(); + +#define MARK_AS_EVIL map[key] = NULL; symmap[key] = NULL; +// ^^^ marks an entry as no-go, so we won't re-use it later. + + DLLLoader::soh_map_type::iterator it = map.find(key); + if( map.end() == it ) + { // it's not in our map. Let's look for a file: + + // strip namespace part from the file (it's not filesystem-friendly in some places) std::string::size_type colon = xlated.rfind( ":" ); if( std::string::npos != colon ) { @@ -129,69 +149,44 @@ path = this->path().find( xlated ); if ( path.empty() ) { + MARK_AS_EVIL; CERR << "Neither in-built class nor DLL found for "<<key<<" ["<<xlated<<"]. path=["<<this->path()<<"]"<<std::endl; return NULL; } - it = map.find(path); - //COUT << "load("<<key<<" ["<<xlated<<"]) dll path="<<path<<std::endl; - } - - if( map.end() != it ) - { - soh = (*it).second; - //COUT << "cached entry ["<<path<<"]: " << std::hex << soh << std::endl; - if( NULL == soh ) return NULL; - } - else - { soh = dlopen( path.c_str(), RTLD_NOW | RTLD_GLOBAL ); - if( ! soh ) + if( ! soh ) { COUT << "error? dlerror() says: " << dlerror() << std::endl; soh = soh_main; } - //COUT << "key="<<key<<" ["<<xlated<<"], path=["<<path<<"], soh = " << std::hex << soh << ", dll path="<<path<<std::endl; - if( ! soh ) - { - map[path] = map[key] = (void *)NULL; - return NULL; - } - map[path] = map[key] = soh; + map[key] = soh; + //COUT << "load("<<key<<" ["<<xlated<<"]) dll path="<<path<<std::endl; } - - if( check_for_registry( soh ) ) + else + { // we have a dlopen handle already: + soh = (*it).second; + //COUT << "cached entry ["<<path<<"]: " << std::hex << soh << std::endl; + if( NULL == soh ) return NULL; + } + + if( check_for_registry( soh, key.c_str() ) ) { // give parent another chance. registration may have assigned a factory. ch = this->ParentClass::load( key ); if( ch ) return ch; } - DLLLoader::instantiator_func instantiator = 0; + //COUT << "key="<<key<<" ["<<xlated<<"], path=["<<path<<"], soh = " << std::hex << soh << ", dll path="<<path<<std::endl; + //COUT << "mapping ["<<key<<"] to "<<std::hex<<soh<<""<<std::endl; - DLLLoader::symbol_map_type & symmap = DLLLoader::symbol_map(); - DLLLoader::symbol_map_type::iterator sit = symmap.find(soh); - if( symmap.end() != sit ) + std::string inst_funcname = "new_" + xlated; + if( (instantiator = (instantiator_func) dlsym( soh, inst_funcname.c_str() )) ) { - instantiator = (*sit).second; + symmap[key] = instantiator; } else { - //const char * inst_funcname = "instantiateSerializable"; - std::string inst_funcname = "new_" + xlated; - if( (instantiator = (instantiator_func) dlsym( soh, inst_funcname.c_str() )) ) - { - symmap[soh] = instantiator; - } - else - { - symmap[soh] = NULL; - } - } - - if( ! instantiator ) - { - //CERR << "error? dlerror() says: " <<dlerror() << std::endl; if( soh && (soh_main != soh) ) dlclose( soh ); - map[path] = map[key] = (void *)NULL; + MARK_AS_EVIL; return NULL; } Index: DLLLoader.h =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/s11n/DLLLoader.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- DLLLoader.h 28 Sep 2003 01:35:30 -0000 1.2 +++ DLLLoader.h 28 Sep 2003 03:21:57 -0000 1.3 @@ -47,16 +47,19 @@ Define an extern "C" function with this sigature: - void DLLLoader_bootstrap(); + void DLLLoader_bootstrap( const char * ); - If that function exists it is called when the class is loaded. - This gives the class a chance to register factories for other - names of itself or for dependent classes. + If that function exists it is called when the class is + loaded. This gives the class a chance to register + factories for other names of itself or for dependent + classes. It is passed the name of the symbol used to + initialize the search for it, which might be an empty + string or NULL. Example: extern "C" { - void DLLLoader_bootstrap() + void DLLLoader_bootstrap( const char * ) { s11n::register_serializable_type<foo::FooClass>("FooClass"); s11n::register_serializable_type<foo::FooClass>("foo::FooClass"); @@ -73,14 +76,27 @@ typedef s11n::ClassLoader < s11n::Serializable, std::string > ParentClass; protected: typedef s11n::Serializable * (*instantiator_func)( const char * ); + /** + Maps strings (raw keys and translated paths) to + dlopen() handles. + */ typedef std::map<std::string,void *> soh_map_type; - typedef std::map<void *,instantiator_func> symbol_map_type; /** - Returns a map of keys to DLL handles (void *). + Maps dlopen() handles to instantiator_funcs. These + functions are normally created via + S11N_INSTANTIATOR(). + + todo: change this to map strings to instantiators, to + save a lot of lookups in load(). + */ + //typedef std::map<void *,instantiator_func> symbol_map_type; + typedef std::map<std::string,instantiator_func> symbol_map_type; + /** + Returns a map of keys to DLL handles. */ static soh_map_type & soh_map(); /** - Returns a map of keys to DLL handles (void *). + Returns a map of DLL handles to functions. */ static symbol_map_type & symbol_map(); |
From: <sg...@us...> - 2003-09-28 03:22:12
|
Update of /cvsroot/libfunutil/libfunutil/tests/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv17332/tests/s11n Modified Files: BarClass.cpp FooClass.cpp in.sertest test.s11n.cpp Log Message: good night! Index: BarClass.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/tests/s11n/BarClass.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- BarClass.cpp 27 Sep 2003 22:36:54 -0000 1.1 +++ BarClass.cpp 28 Sep 2003 03:21:57 -0000 1.2 @@ -4,10 +4,11 @@ #include "BarClass.h" -S11N_INSTANTIATOR(BarClass); +S11N_INSTANTIATOR(,BarClass); using namespace s11n; using namespace std; + BarClass::BarClass( ) : Serializable("BarClass") Index: FooClass.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/tests/s11n/FooClass.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FooClass.cpp 28 Sep 2003 01:35:30 -0000 1.2 +++ FooClass.cpp 28 Sep 2003 03:21:57 -0000 1.3 @@ -15,14 +15,29 @@ using namespace s11n; using namespace std; +namespace foo { + struct Baz : public foo::FooClass + { + Baz() { this->implClass( "foo::Baz" ); } + ~Baz(){} + }; + struct BarClass : public foo::FooClass + { + BarClass() { this->implClass( "foo::BarClass" ); } + ~BarClass(){} + }; + +} // namespace foo extern "C" { - void DLLLoader_bootstrap() + void DLLLoader_bootstrap( const char *key ) { typedef s11n::Factory<s11n::Serializable,foo::FooClass> Fac; - COUT << "DLLLoader_bootstrap()" << endl; - s11n::register_serializable_type<foo::FooClass>("WonderBra"); + COUT << "DLLLoader_bootstrap("<<key<<")" << endl; + s11n::register_serializable_type<foo::FooClass>("foo::WonderBra"); s11n::register_serializable_type<foo::FooClass>("foo:FooClass"); + s11n::register_serializable_type<foo::Baz>("foo::Baz"); + s11n::register_serializable_type<foo::BarClass>("foo::BarClass"); } } Index: in.sertest =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/tests/s11n/in.sertest,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- in.sertest 27 Sep 2003 22:36:54 -0000 1.1 +++ in.sertest 28 Sep 2003 03:21:57 -0000 1.2 @@ -3,19 +3,37 @@ foo = one bar = two - foo_child class=FooClass + foo_child class=foo::FooClass { fee = fii fo = fum + } - foo_child class=FooClass + foo_child class=foo::Baz + { + fee = fii + fo = fum + } + foo_child class=foo::BarClass { fee = fii fo = fum } - foo_child class=FooClass + foo_child class=BarClass + { + fee = fii + fo = fum + } + + foo_child class=foo::FooClass + { + fee = fii + fo = fum + } + + foo_child class=foo::WonderBra { fii = fee fum = fo Index: test.s11n.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/tests/s11n/test.s11n.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- test.s11n.cpp 28 Sep 2003 01:35:30 -0000 1.2 +++ test.s11n.cpp 28 Sep 2003 03:21:57 -0000 1.3 @@ -110,12 +110,14 @@ Called by DLLLoader the first time it tries to load a class from the global space. */ - void DLLLoader_bootstrap() + void DLLLoader_bootstrap( const char *key ) { - COUT << "DLLLoader_bootstrap()" << endl; + COUT << "DLLLoader_bootstrap("<<key<<")" << endl; + s11n::register_serializable_type<fake::FakeRoot>( "fake::FakeRoot" ); -#define CLREG(clN) COUT << "Warning: faking class type for " << # clN << std::endl; \ +#define CLREG(clN) \ +COUT << "Warning: faking type for " << # clN << std::endl; \ s11n::register_serializable_type<s11n::Serializable>( # clN ); CLREG(GEVHex); @@ -134,7 +136,6 @@ args.setArgs( argc, argv ); args.describe( "-f, --file", "filename", "input filename. --file supercedes -f." ); args.describe( "-t or -x or -sx", "bool", "Select output format: FunText, FunXML, SimpleXML." ); - args.describe( "-x", "bool", "output in FunXML format." ); args.describe( "-I, --instantiate", "bool", "Try to instantiate the root node of the input file." ); if ( args.isSet( "--help" ) ) |
From: <sg...@us...> - 2003-09-28 03:22:12
|
Update of /cvsroot/libfunutil/libfunutil/lib/s11n/parsers In directory sc8-pr-cvs1:/tmp/cvs-serv17332/lib/s11n/parsers Modified Files: Makefile Log Message: good night! Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/s11n/parsers/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 27 Sep 2003 22:37:29 -0000 1.1 +++ Makefile 28 Sep 2003 03:21:58 -0000 1.2 @@ -5,6 +5,7 @@ HEADERS = \ flex_lexers.h +INSTALL_PACKAGE_HEADERS_DEST = $(prefix)/include/s11n INSTALL_PACKAGE_HEADERS = $(HEADERS) FLEXES = funtxt funxml select_lexer simplexml @@ -53,9 +54,6 @@ # DIST_FILES += $(sort $(wildcard *.cpp) $(wildcard *.h) $(wildcard *.make)) DIST_FILES += $(SOURCES) $(HEADERS) \ $(addsuffix .flex.at,$(FLEXES)) $(COMMON_FLEX_DEFS) - -strip: $(THISLIB_STATIC) $(THISLIB_SHARED) - $@ $(THISLIB_STATIC) $(THISLIB_SHARED) SYMLINK_HEADERS = $(INSTALL_PACKAGE_HEADERS) |
From: <sg...@us...> - 2003-09-28 01:35:52
|
Update of /cvsroot/libfunutil/libfunutil/lib/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv3118/lib/s11n Modified Files: DLLLoader.cpp DLLLoader.h Makefile S11n.h Log Message: refinements/improvments to the classloader. Added DLLLoader_boostrap "callback" support, to run boostrapping code when opening an DLL. This allows a way around using S11N_INSTANTIATOR, and a way to dynamically add factories to the classloader from DLLs. Index: DLLLoader.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/s11n/DLLLoader.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- DLLLoader.cpp 27 Sep 2003 22:36:54 -0000 1.1 +++ DLLLoader.cpp 28 Sep 2003 01:35:30 -0000 1.2 @@ -8,15 +8,54 @@ #include "DLLLoader.h" #include <s11n/s11n-macros.h> // COUT/CERR + +// note: if you define DLLLOADER_DEFAULT_PATH via the command line, be sure to +// escape the quote marks. e.g.: +// DLLLoader_cpp_CPPFLAGS = -DDLLLOADER_DEFAULT_PATH=\".:$(prefix)/lib\" +#ifndef DLLLOADER_DEFAULT_PATH +# define DLLLOADER_DEFAULT_PATH "." +#endif + +#define DLLLOADER_PATH DLLLOADER_DEFAULT_PATH + namespace s11n { static void * soh_main = NULL; - unsigned long DLLLoader::inst_count = 0; + unsigned long DLLLoader_inst_count = 0; + + /** + Looks for a bootstrap function in newly-opened shared + objects, and runs it if it exists. Returns true if the + object has a registry, else false. It only runs the + registry the first time it is passed a given pointer. + */ + bool check_for_registry( void * soh ) + { + if( ! soh ) return false; + const char * funcname = "DLLLoader_bootstrap"; + typedef void (*registry)(); + typedef std::map<void *,unsigned long int> done_map; + static done_map done; + if( done[soh] ) return true; + //COUT << "check_for_registry(" << std::hex << soh << ")"<<std::endl; + done[soh] = 1; + registry reg; + reg = (registry) dlsym( soh, funcname ); + if( ! reg ) + { + //CERR << "no " << funcname << "() found in " << std::hex << soh << "" << std::endl; + return false; + } + reg(); + return true; + } + + DLLLoader::DLLLoader() { - ++inst_count; + ++DLLLoader_inst_count; this->path().addExtension( ".so" ); - this->path().addPath( "." ); + this->path().setPath( DLLLOADER_PATH ); const char * p = getenv( "S11N_PATH" ); if( ! p ) getenv( "LD_LIBRARY_PATH" ); if( p ) @@ -25,15 +64,15 @@ } if( ! soh_main ) { - soh_main = dlopen( 0, RTLD_NOW | RTLD_GLOBAL ); - //COUT << "Address of main app, from dlopen() perspective: " << std::hex << soh_main<<""<<std::endl; + soh_main = dlopen( NULL, RTLD_NOW | RTLD_GLOBAL ); + check_for_registry( soh_main ); } } DLLLoader::~DLLLoader() { - if( 0 == --inst_count ) + if( 0 == --DLLLoader_inst_count ) { dlclose( soh_main ); DLLLoader::soh_map_type & map = DLLLoader::soh_map(); @@ -41,7 +80,7 @@ DLLLoader::soh_map_type::iterator et = map.end(); for( ; it != et; ++it ) { - COUT << "Closing DLL: " << std::hex <<(*it).second<<std::endl; + //COUT << "Closing DLL: " << std::hex <<(*it).second<<std::endl; dlclose( (*it).second ); } } @@ -60,77 +99,106 @@ static DLLLoader::symbol_map_type bob; return bob; } + + DLLLoader::value_type * DLLLoader::load( const std::string & key ) const { //COUT << "load("<<key<<")"<<std::endl; - //static void * error_entry = NULL; // maintenance note: this might Cause Grief with subclasses. - // mostly untested. - // todo: add an option to force-deserialize a node, even when the types don't match. typedef ThisType::value_type CHT; - CHT *ch = this->ParentClass::load( key ); + CHT *ch = NULL; + ch = this->ParentClass::load( key ); if ( ch ) return ch; - std::string xlated = key; - std::string::size_type colon = xlated.rfind( ":" ); - if( std::string::npos != colon ) + + void * soh = 0; + std::string xlated = key; // key, translated to remove namespace part (because :: is not filesystem-friendly). + std::string path = key; + DLLLoader::soh_map_type & map = DLLLoader::soh_map(); + DLLLoader::soh_map_type::iterator it = map.find(key); + if( map.end() != it ) { - xlated = key.substr( colon + 1 ); + soh = (*it).second; + if( NULL == soh ) return NULL; } - string path = this->path().find( xlated ); - if ( path.empty() ) + else { - CERR << "Neither in-built class nor DLL found for "<<key<<" ["<<xlated<<"]"<<std::endl; - return NULL; + std::string::size_type colon = xlated.rfind( ":" ); + if( std::string::npos != colon ) + { + xlated = key.substr( colon + 1 ); + } + path = this->path().find( xlated ); + if ( path.empty() ) + { + CERR << "Neither in-built class nor DLL found for "<<key<<" ["<<xlated<<"]. path=["<<this->path()<<"]"<<std::endl; + return NULL; + } + it = map.find(path); + //COUT << "load("<<key<<" ["<<xlated<<"]) dll path="<<path<<std::endl; } - //COUT << "load("<<key<<" ["<<xlated<<"]) dll path="<<path<<std::endl; - void * soh = 0; - - DLLLoader::soh_map_type & map = DLLLoader::soh_map(); - DLLLoader::soh_map_type::iterator it = map.find(key); if( map.end() != it ) { soh = (*it).second; - //COUT << "cached entry ["<<key<<"]: " << std::hex << soh << std::endl; + //COUT << "cached entry ["<<path<<"]: " << std::hex << soh << std::endl; if( NULL == soh ) return NULL; } else { soh = dlopen( path.c_str(), RTLD_NOW | RTLD_GLOBAL ); - if( ! soh ) soh = soh_main; + if( ! soh ) + { + COUT << "error? dlerror() says: " << dlerror() << std::endl; + soh = soh_main; + } + //COUT << "key="<<key<<" ["<<xlated<<"], path=["<<path<<"], soh = " << std::hex << soh << ", dll path="<<path<<std::endl; if( ! soh ) { - map[key] = (void *)NULL; + map[path] = map[key] = (void *)NULL; return NULL; } - map[key] = soh; + map[path] = map[key] = soh; + } + + if( check_for_registry( soh ) ) + { // give parent another chance. registration may have assigned a factory. + ch = this->ParentClass::load( key ); + if( ch ) return ch; } - //COUT << "soh = " << std::hex << soh << std::endl; - const char * inst_funcname = "instantiateSerializable"; - DLLLoader::instantiator_func instantiator; + + DLLLoader::instantiator_func instantiator = 0; DLLLoader::symbol_map_type & symmap = DLLLoader::symbol_map(); DLLLoader::symbol_map_type::iterator sit = symmap.find(soh); - if( symmap.end() == sit ) + if( symmap.end() != sit ) { - if( (instantiator = (instantiator_func) dlsym( soh, inst_funcname )) ) - { - symmap[soh] = instantiator; - } - - //COUT << "instantiator = " << std::hex << instantiator << std::endl; + instantiator = (*sit).second; } else { - instantiator = (*sit).second; + //const char * inst_funcname = "instantiateSerializable"; + std::string inst_funcname = "new_" + xlated; + if( (instantiator = (instantiator_func) dlsym( soh, inst_funcname.c_str() )) ) + { + symmap[soh] = instantiator; + } + else + { + symmap[soh] = NULL; + } } + if( ! instantiator ) { - CERR << "error? dlerror() says: " <<dlerror() << std::endl; + //CERR << "error? dlerror() says: " <<dlerror() << std::endl; if( soh && (soh_main != soh) ) dlclose( soh ); - map[key] = (void *)NULL; + map[path] = map[key] = (void *)NULL; return NULL; } - ch = instantiator( key.c_str() ); + + if( NULL != instantiator ) + { + ch = instantiator( key.c_str() ); + } return ch; } Index: DLLLoader.h =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/s11n/DLLLoader.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- DLLLoader.h 27 Sep 2003 22:36:54 -0000 1.1 +++ DLLLoader.h 28 Sep 2003 01:35:30 -0000 1.2 @@ -39,12 +39,38 @@ This class represents my very first usage of dlopen(), and there may be bugs related to my use of dlopen()/dlclose(). + + + + Instead of using the S11N_INSTANTIATOR macro you may do the + following: + + Define an extern "C" function with this sigature: + + void DLLLoader_bootstrap(); + + If that function exists it is called when the class is loaded. + This gives the class a chance to register factories for other + names of itself or for dependent classes. + + Example: + + extern "C" { + void DLLLoader_bootstrap() + { + s11n::register_serializable_type<foo::FooClass>("FooClass"); + s11n::register_serializable_type<foo::FooClass>("foo::FooClass"); + s11n::register_serializable_type<foo::FooClass>("WonderBra"); + } + } + + This approach prohibits more than one definition in the same DLL. + */ - class DLLLoader : public s11n::ClassLoader < s11n::Serializable > + class DLLLoader : public s11n::ClassLoader < s11n::Serializable, std::string > { private: - typedef s11n::ClassLoader < s11n::Serializable > ParentClass; - static unsigned long inst_count; + typedef s11n::ClassLoader < s11n::Serializable, std::string > ParentClass; protected: typedef s11n::Serializable * (*instantiator_func)( const char * ); typedef std::map<std::string,void *> soh_map_type; Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/s11n/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 27 Sep 2003 22:36:54 -0000 1.1 +++ Makefile 28 Sep 2003 01:35:30 -0000 1.2 @@ -38,10 +38,13 @@ endif +top_srcdir_absolute = $(shell cd $(top_srcdir) && pwd) +DLLLoader_cpp_CPPFLAGS = -DDLLLOADER_DEFAULT_PATH=\".:$(top_srcdir_absolute)/lib/s11n:$(prefix)/lib\" OBJECTS = $(patsubst %.cpp,%.o,$(SOURCES)) PARSER_OBJECTS = $(addprefix parsers/,flex_lexers.o funtxt.flex.o funxml.flex.o select_lexer.flex.o simplexml.flex.o) +INSTALL_PACKAGE_HEADERS_DEST = $(prefix)/include/s11n INSTALL_PACKAGE_HEADERS = $(HEADERS) STATIC_LIBS = libs11n @@ -52,10 +55,7 @@ ifeq (1,$(build_s11n_so)) SHARED_LIBS = $(STATIC_LIBS) libs11n_so_OBJECTS = $(libs11n_a_OBJECTS) -libs11n_so_VERSION = 0.1.0 -ifeq (1,$(configure_with_libreadline)) -libs11n_so_LDADD += $(LIBREADLINE_LDADD) -endif +libs11n_so_VERSION = 0.0.1 include $(toc_makesdir)/cpp_dynamic_libs.make endif # ^^^^ build shared libs? Index: S11n.h =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/s11n/S11n.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- S11n.h 27 Sep 2003 22:36:54 -0000 1.1 +++ S11n.h 28 Sep 2003 01:35:30 -0000 1.2 @@ -27,19 +27,31 @@ Alternately, they should have an extern "C" function with this signature: - YourClass * instantiateSerializable( const char * ); + YourClass * new_YourClass( const char * ); - The char * parameter does nothing in the default implementation, but - could be implemented to provide (e.g.) multiple key-to-class mappings, - or access to multiple loadable classes in the same object file. + The char * parameter does nothing in the default implementation, + but could be implemented to provide (e.g.) multiple key-to-class + mappings, or access to multiple loadable classes in the same object + file, or perhaps to use for proxy loading. + + YourClass must currently be a Serializable type. + + Sample usages: + + S11N_INSTANTIATOR(,GlobalNameSpaceClass); + S11N_INSTANTIATOR(my::namespace,SomeClass); + + i appologize about the weird arguments syntax, but it's the best i can + manage with C macros. */ -#define S11N_INSTANTIATOR(ClsName) extern "C" {\ - ClsName * instantiateSerializable( const char * clname ) \ +#define S11N_INSTANTIATOR(NS,ClsName) \ + extern "C" {\ + NS::ClsName * new_ ## ClsName( const char * clname ) \ { \ - /** COUT << # ClsName << " * instantiateSerializable("<<clname<<")"<<std::endl;*/ \ - return new ClsName; }\ - }; + /**COUT << # ClsName << " * instantiateSerializable("<<clname<<")"<<std::endl;*/ \ + return new NS::ClsName; \ + }}; namespace s11n |