You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(622) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(303) |
Feb
(64) |
Mar
(5) |
Apr
(63) |
May
(82) |
Jun
(53) |
Jul
(50) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: stephan b. <sg...@us...> - 2004-12-22 22:13:25
|
Update of /cvsroot/pclasses/pclasses2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23280 Added Files: configure.toc Log Message: egg --- NEW FILE: configure.toc --- #!/bin/bash # ^^^^ toc needs a Genuine Bash, not some cheap work-alike!!! . ./find_toc.sh || exit export PACKAGE_NAME=pclasses2 export PACKAGE_VERSION=2004.12.x # toconfigure will call configure.${PACKAGE_NAME}, so package-specific # processing should be done there. . ${TOC_HOME}/sbin/toconfigure "$@" # post-configure processing can be done in postconfig.${PACKAGE_NAME} |
From: stephan b. <sg...@us...> - 2004-12-22 22:11:25
|
Update of /cvsroot/pclasses/pclasses2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22738 Added Files: configure.pclasses2 toc.pclasses2.make.at Log Message: egg --- NEW FILE: toc.pclasses2.make.at --- #!/do/not/make #^^^ only to help emacs out. CLEAN_FILES += $(wildcard *.o *~) CXXFLAGS += -fPIC INSTALL_PACKAGE_HEADERS_DEST = $(prefix)/include/pclasses2 INCLUDES += $(PACKAGE_INCLUDES) --- NEW FILE: configure.pclasses2 --- #!/do/not/bash #^^^ this helps emacs out, so it'll start in shell-script-mode # This is the configure script for the pclasses source tree. toc_add_config PACKAGE_RELEASE_CODENAME="The Rewrite" toc_test check_dist_md5s toc_export PACKAGE_DESCRIPTION="C++ generic application framework library" toc_source_test user_is_stephan_beal # ^^^ don't ask. Must come before gnu_cpp_tools test. ####### compilers: toc_test_require gnu_cpp_tools toc_test_require gcc_try_compile ${TOC_HOME}/tests/cpp/check_stl_newstyle.cpp test x1 = x${configure_enable_ccdv} && toc_test use_ccdv ####### docs: toc_find lyx ${configure_with_lyx%/*}:$PATH && toc_export LYX_BIN=${TOC_FIND_RESULT} ############################################################ # accumulate -I and -L/-l entries here: includes_path= ldadd= ############################################################ ############################################################ # supplemental libs { for i in mysql_clients; do toc_test $i done } # toc_test libexpat # && ldadd="${ldadd} -lexpat" use_pthread=0 toc_test gcc_try_compile ${TOC_HOME}/tests/c/check_for_pthread.c && { use_pthread=1 cli_ldadd="${cli_ldadd} -lpthread" } toc_export eshell_HAVE_PTHREAD=${use_pthread} unset use_pthread if test x0 = "x${use_pthread}" ; then toc_die 127 "The tree currently needs pthreads. To be fixed." fi ######################################################################## # TODO: # figure out the list of -lLIBS for clients to link against, based # on what modules we will build! removeDupes=${TOC_HOME}/bin/removeDupeArgs CLIENT_LDADD="$(${removeDupes} -L${prefix}/lib -lpclasses2)" CLIENT_INCLUDES="$(${removeDupes} -I${prefix}/include)" #{ # generate PACKAGE_NAME-config: # export ldadd # export includes_path # toc_test_require PACKAGE_NAME-config # PACKAGE_PREFIX="${PACKAGE_NAME}_" # CLIENT_LDADD="${CLIENT_LDADD}" # CLIENT_INCLUDES="${CLIENT_INCLUDES})" # import the PACKAGE_NAME-config info to ease life for us later on... # eval $(./${PACKAGE_NAME}-config --toc-config | sed -e 's/$/; /') # echo -e "ldadd=${ldadd}\nLIBS11N_LDADD=${LIBS11N_LDADD}\nLIBS11N_CLIENT_LDADD=${LIBS11N_CLIENT_LDADD}" # unset includes_path # unset ldadd #} #PACKAGE_CFLAGS="${PCLASSES2_CLIENT_INCLUDES}" # PACKAGE_LDADD="${PCLASSES2_CLIENT_LDADD}" # toc_test_require create_pkg-config_data ###### stuff: toc_add_config BUILD_USER="$USER" toc_add_config BUILD_HOST=`hostname` toc_add_config PACKAGE_EMAIL_ADDRESS=pcl...@li... toc_add_config PACKAGE_URL=http://pclasses.com toc_add_config PACKAGE_LICENSE="GNU LGPL" ##### close the config-filtered files: toc_test_require atfilter_file include/pclasses/pclasses_config.h.at include/pclasses/pclasses_config.h toc_test_require toc_project_makefile return 0 |
From: stephan b. <sg...@us...> - 2004-12-22 19:06:18
|
Update of /cvsroot/pclasses/pclasses2/toc/tests/c In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7192/c Added Files: check_for_dlopen_and_friends.c check_for_ltdlopen_and_friends.c check_for_pthread.c Makefile Log Message: egg --- NEW FILE: check_for_dlopen_and_friends.c --- /** Quick check for dlopen(), dlclose() and dlsym(). toc usage: toc_test_require 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: check_for_ltdlopen_and_friends.c --- /** Quick check for lt_dlopen(), lt_dlclose() and lt_dlsym(). toc usage: toc_test_require path/to/this/file -lltdl -export-dynamic */ #include <ltdl.h> #include <stdlib.h> void foo_function() {} int main() { typedef void (*func)(); void * soh = 0; lt_dlinit(); soh = lt_dlopen( 0 ); // , RTLD_NOW | RTLD_GLOBAL ); if( ! soh ) { printf( "could not open main app: %s\n", lt_dlerror() ); return 1; } void * sym = (func) lt_dlsym( soh, "foo_function" ); if( 0 == sym ) { printf( "could not find test symbol: %s\n", lt_dlerror() ); return 2; } return 0; } --- NEW FILE: check_for_pthread.c --- #include <pthread.h> // link with -lpthread #include <stdio.h> void * thread_callback( void * arg ) { printf( "Doing nothing.\n" ); } int main() { pthread_t thread = 0; int thret = pthread_create( &thread, NULL, thread_callback, NULL ); return 0; } --- NEW FILE: Makefile --- include toc.make DIST_FILES += $(wildcard *.c) all: |
From: stephan b. <sg...@us...> - 2004-12-22 19:06:17
|
Update of /cvsroot/pclasses/pclasses2/toc/tests/cpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7192/cpp Added Files: check_setenv_in_cpp.cpp check_stl_newstyle.cpp gcc_2_95_typename_problem.cpp Makefile Log Message: egg --- 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: check_stl_newstyle.cpp --- #include <sstream> int main() { std::ostringstream os; os << "foo"; return 0; } --- NEW FILE: Makefile --- include toc.make DIST_FILES += $(wildcard *.cpp *.c) all: --- 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; } |
From: stephan b. <sg...@us...> - 2004-12-22 19:04:37
|
Update of /cvsroot/pclasses/pclasses2/toc/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6599/bin Added Files: atsign_parse ccdv.c cleanup_vars create_makefile_stubs.sh getMakefileVar install-sh makedist Makefile mkdep.c relativePathToSharedMakefile removeDupeArgs tocCreateMakefileStubs Log Message: egg --- NEW FILE: Makefile --- include toc.make DIST_FILES += atsign_parse \ ccdv.c \ cleanup_vars \ getMakefileVar \ install-sh \ makedist \ mkdep.c \ relativePathToSharedMakefile \ removeDupeArgs CLEAN_FILES += mkdep --- NEW FILE: cleanup_vars --- #!/usr/bin/perl # reads in a list of KEY=VAL lines and removes all but the last-set # entries. Intended for use with cleaning up toc-exported variables. @IN = reverse <>; %gots = (); @out = (); foreach $l (@IN) { chomp $l; next unless $l =~ m|^\s*(\S+)\s*=\s*(.*)|; $key = $1; $val = $2; next if $gots{$key}; $gots{$key} = 1; push( @out, $l ); # print $l."\n"; } print join("\n", reverse @out),"\n"; --- NEW FILE: tocCreateMakefileStubs --- #!/bin/sh # climbs down $1 and generates makefile stubs for use with toc trees. # It refuses to overwrite existing files, instead doing nothing # for dirs which already contain a Makefile # # Usage: $0 [path: defaults to $PWD] dir=${1-${PWD}} for d in $(find $dir -type d); do mf=$d/Makefile if test -f $mf; then echo "WARNING: $mf exist! Skipping!" 1>&2 continue fi cd $d > /dev/null SUB= for sub in *; do test -d "$sub" || continue sub=${sub#./} echo "SUBDIRS += $sub" >> $mf done >> $mf echo "include toc.make" >> $mf echo "Created $mf" 1>&2 cd - > /dev/null done --- NEW FILE: makedist --- #!/usr/bin/perl # # A mind-numbingly stupid distribution tarball creator. # # todo: add some wildcard support to the file lists. # # st...@s1... # # Note that is implicitely filters out some file names, # to simplify use of the toc client-side install code. $verbose = 0; $dieonerror = 1; $USAGE = "usage: $0 input_list_file release_name"; $DISTFILES_LIST = $ARGV[0] || die $USAGE; $basename = $ARGV[1] || die $USAGE; $TARBALL = $basename; $basename =~ s|\.tar$||; $TARBALL .= ".tar" unless $TARBALL =~ m|\.tar$|; execcmd( "rm -fr $basename" ) if -d $basename; execcmd( "mkdir $basename" ); open DLIST, "<$DISTFILES_LIST" || die "Cannot open dist files list, $DISTFILES_LIST!"; @list = <DLIST>; # print @list; close DLIST; @thelist = (); foreach $l (@list) { next if $l =~ /^#/; next if $l =~ m|^(.*/)?toc.q?make$|; next if $l =~ m|\.o$|; next if $l =~ m|/?CVS/?|; chomp( $l ); next unless $l =~ /\w/; next if $l =~ m|~$|; $l =~ s/^\s+//; if( (! -f $l) && (! -d $l) ) { stderr( "WARNING: [$l] not found!" ); exit 1 if $dieonerror; } push( @thelist, $l ); } $tarfileslist = ".tar.tmp"; open TARLIST, ">$tarfileslist"; print TARLIST join( "\n", @thelist ); #print STDOUT "thelist=",join( "\n", @thelist ),"\n"; print "File count: ".@thelist."\n" if $verbose; $tarargs = "--files-from=$tarfileslist --exclude=CVS"; execcmd( "tar cf - $tarargs | tar xf - -C \"$basename\"" ); # ^^^^ got that? it's simpler than cp'ing the list of files to their proper subdirs. :) $md5 = `which md5sum 2>/dev/null`; if( $md5 ) { $md5file = "$basename/md5.sums.$basename"; print STDERR "Generating md5 sums: $md5file\n"; # execcmd( "cd $basename; for x in \$(find . -type f); do md5sum \$x >> MD5SUMS.$basename; done" ); execcmd( "for x in \$(cat $tarfileslist); do md5sum \$x; done > $md5file" ) } else { print STDERR "Warning: no md5sum binary found, so not including md5 info.\n"; } execcmd( "rm $tarfileslist" ); execcmd( "tar cf \"$TARBALL\" \"$basename\"" ); execcmd( "rm -fr \"$basename\"" ); # print "Tarball: ".`ls -la $TARBALL`."\n"; print "Tarball: $TARBALL\n" if $verbose; exit 0; sub stderr() { $msg = shift; print STDERR $msg."\n"; } sub execcmd() { $cmd = shift; print $cmd."\n" if $verbose; `$cmd`; } --- NEW FILE: atsign_parse --- #!/usr/bin/perl # ( ^^^^ when run with -n it tries to read in files named after the args. e.g. foo=bar) # # Takes command-line args in the format: # # foo=bar [include:bar=infile] [shell:foobar=shellcmd]... # # and parses stdin, replacing @foo@ with bar. # # All output goes to stdout. # # Intended to be used as a simple parser for Makefile.in-type files. # # Special keys type: # # include:KEY=filename # # Will try to read the file VAL and import it in place of @KEY@. # # shell:KEY=shellcmd # # Will replace KEY with the output of shellcmd. # # The shell: and include: substitutions happen ONE time, # before the input stream is ever read, and not every time # the corresponding @token@ is replaced. # # Optional arguments: # # [-f filename] will read in that file. It must be in the form # KEY=VALUE, with one key/value per line. # # [-c] will enable "cleanup mode". Any @TOKENS@ in the input stream # which were not explicitely assigned values will be parsed out # of the output. Without this option, the raw @TOKEN@ would go # into the output. # # License: public domain # author: stephan <sg...@us...> # CVS Revision: $Revision: 1.1 $ BEGIN { $STRIP_LEADING_DASHES = 1; # if set to 1 then --foo=bar is same as foo=bar $op_cleanup = 0; # strip un-parsed @TOKENS@ from the input. if( ! @ARGV ) { print "Usage: $0 foo=bar [bar=foobar] [argN=valN]...\n"; exit 1; } @args = (); ############################################################ collect args... for( $i = 0; $i < @ARGV; $i++ ) { $a = $ARGV[$i]; if( $a eq "-f" ) { $fn = $ARGV[++$i]; open( INFILE, $fn ) || die "Could not open input file [$fn]."; @foo = <INFILE>; foreach $f (@foo) { chomp($f); push( @args, $f ); } close INFILE; next; } if( $a eq "-c" ) { $op_cleanup = 1; next; } push( @args, $a ); } #print join( "\n", @args )."\n"; %args = (); foreach $a ( @args ) { ############################################################ parse out KEY=VAL pairs next unless $a =~ m|([^=]+)\s*=\s*(.*)|; $key = $1; $val = $2; if( $STRIP_LEADING_DASHES ) { $key =~ s/^-+//; } #print STDERR ": [$key]=[$val]\n"; ############################################################ include:FOO=BAR if( $key =~ m|^include:(.+)| ) { $key = $1; open INFILE, "<$val" or die "Cannot open file '$val', as requested by \@include:$key@!"; @foo = <INFILE>; close INFILE; $val = join( "", @foo ); } ############################################################ shell:FOO=BAR if( $key =~ m|^shell:(.+)| ) { $key = $1; $val = `$val`; } $args{$key} = $val; } } # /BEGIN while( <STDIN> ) { $loop = true; while( $loop ) { # loop over line until we can replace no more @tokens@ $cp = $_; foreach $k (keys(%args)) { $v = $args{$k}; next unless $_ =~ s|\@$k\@|$v|g; # print STDERR "replacing $k --> $v\n"; } $loop = 0 if $cp eq $_; } if( $op_cleanup ) { # parse out undefined @tokens@ while( $_ =~ s|\@\S+\@||g ) {} } print; } exit 0; --- NEW FILE: relativePathToSharedMakefile --- #!/usr/bin/perl # Makes relative paths in the contexts of build trees. $shared_makefile = "toc_shared.make.at"; # Usages: # $0 [$shared_makefile_filename] [/starting/point/path] # If $shared_makefile_filename is given, then that name is used instead # of '$shared_makefile'. If a path is given, that is assumed to be our # starting point (it normally assumes $PWD as the starting point). # # It climbs up from the starting point and stops when it finds a # file named '$shared_makefile' (or the name given as the first argument). It # prints a relative path from the starting dir to that path, or no output if # '$shared_makefile' is not found. # # stephan - st...@s1... $configure = $shared_makefile; $topdir = "/"; if( @ARGV == 0 ) { $mode = "findtop"; $subdir = $ENV{'PWD'}; } if( @ARGV == 1 ) { $mode = "findtop"; if( -d $ARGV[0] ) { $subdir = $ARGV[0]; $subdir =~ s!/$!!; } else { $subdir = $ENV{'PWD'}; $configure = $ARGV[0]; } } if( @ARGV == 2 ) { $mode = "twoargs"; $configure = $ARGV[0]; $subdir = $ARGV[1]; } if( ! $mode || $ARGV[0] =~ /-(help|h|\?)/ ) { $usage = "Usages:\n$0 [configure_filename] [/path/to/some/code/project/subdir\n"; print $usage."\n"; exit 1; } if( $subdir !~ m|/| ) { # print "$0: Sorry, but i'm under-featured: i cannot handle relative paths as input!\n"; # print "Try \$PWD/$subdir instead?\n"; $subdir = $ENV{'PWD'}."/".$subdir; # exit 1; } $subdir =~ s|/\./|/|g; # clean up the mess i caused with the above tip :/ # print "$mode: $topdir $subdir\n"; $curdir = $subdir; $relpath = "./"; while( $curdir && $curdir !~ m|^$topdir$| ) { $conf = $curdir."/".$configure; #print "conf=$conf\n"; if( -f $conf ) { last; break; } #print "curdir=[$curdir]\n"; $relpath .= "../"; $curdir =~ s|(.*)/[^/]+$|$1|; } if( ! $curdir ) { $relpath = ""; } #print "relpath=[$relpath]"; $relpath =~ s!/$!!; print $relpath; --- NEW FILE: ccdv.c --- /* ccdv.c * * Copyright (C) 2002-2003, by Mike Gleason, NcFTP Software. * All Rights Reserved. * * Licensed under the GNU Public License. */ #include <unistd.h> #include <sys/types.h> #include <sys/time.h> #include <sys/wait.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #define SETCOLOR_SUCCESS (gANSIEscapes ? "\033\1331;32m" : "") #define SETCOLOR_FAILURE (gANSIEscapes ? "\033\1331;31m" : "") #define SETCOLOR_WARNING (gANSIEscapes ? "\033\1331;33m" : "") #define SETCOLOR_NORMAL (gANSIEscapes ? "\033\1330;39m" : "") #define TEXT_BLOCK_SIZE 8192 #define INDENT 2 #define TERMS "vt100:vt102:vt220:vt320:xterm:xterm-color:ansi:linux:scoterm:scoansi:dtterm:cons25:cygwin" size_t gNBufUsed = 0, gNBufAllocated = 0; char *gBuf = NULL; int gCCPID; char gAction[64] = ""; char gTarget[64] = ""; char gAr[32] = ""; char gArLibraryTarget[64] = ""; int gDumpCmdArgs = 0; char gArgsStr[800]; int gColumns = 80; int gANSIEscapes = 0; int gExitStatus = 95; static void DumpFormattedOutput(void) { char *cp; char spaces[8 + 1] = " "; char *saved; int curcol; int i; curcol = 0; saved = NULL; for (cp = gBuf + ((gDumpCmdArgs == 0) ? strlen(gArgsStr) : 0); ; cp++) { if (*cp == '\0') { if (saved != NULL) { cp = saved; saved = NULL; } else break; } if (*cp == '\r') continue; if (*cp == '\t') { saved = cp + 1; cp = spaces + 8 - (8 - ((curcol - INDENT - 1) % 8)); } if (curcol == 0) { for (i = INDENT; --i >= 0; ) putchar(' '); curcol = INDENT; } putchar(*cp); if (++curcol == (gColumns - 1)) { putchar('\n'); curcol = 0; } else if (*cp == '\n') curcol = 0; } free(gBuf); } /* DumpFormattedOutput */ /* Difftime(), only for timeval structures. */ static void TimeValSubtract(struct timeval *tdiff, struct timeval *t1, struct timeval *t0) { tdiff->tv_sec = t1->tv_sec - t0->tv_sec; tdiff->tv_usec = t1->tv_usec - t0->tv_usec; if (tdiff->tv_usec < 0) { tdiff->tv_sec--; tdiff->tv_usec += 1000000; } } /* TimeValSubtract */ static void Wait(void) { int pid2, status; do { status = 0; pid2 = (int) waitpid(gCCPID, &status, 0); } while (((pid2 >= 0) && (! WIFEXITED(status))) || ((pid2 < 0) && (errno == EINTR))); if (WIFEXITED(status)) gExitStatus = WEXITSTATUS(status); } /* Wait */ static int SlurpProgress(int fd) { char s1[71]; char *newbuf; int nready; size_t ntoread; ssize_t nread; struct timeval now, tnext, tleft; fd_set ss; fd_set ss2; const char *trail = "/-\\|", *trailcp; trailcp = trail; snprintf(s1, sizeof(s1), "%s%s%s... ", gAction, gTarget[0] ? " " : "", gTarget); printf("\r%-70s%-9s", s1, ""); fflush(stdout); gettimeofday(&now, NULL); tnext = now; tnext.tv_sec++; tleft.tv_sec = 1; tleft.tv_usec = 0; FD_ZERO(&ss2); FD_SET(fd, &ss2); for(;;) { if (gNBufUsed == (gNBufAllocated - 1)) { if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) { perror("ccdv: realloc"); return (-1); } gNBufAllocated += TEXT_BLOCK_SIZE; gBuf = newbuf; } for (;;) { ss = ss2; nready = select(fd + 1, &ss, NULL, NULL, &tleft); if (nready == 1) break; if (nready < 0) { if (errno != EINTR) { perror("ccdv: select"); return (-1); } continue; } gettimeofday(&now, NULL); if ((now.tv_sec > tnext.tv_sec) || ((now.tv_sec == tnext.tv_sec) && (now.tv_usec >= tnext.tv_usec))) { tnext = now; tnext.tv_sec++; tleft.tv_sec = 1; tleft.tv_usec = 0; printf("\r%-71s%c%-7s", s1, *trailcp, ""); fflush(stdout); if (*++trailcp == '\0') trailcp = trail; } else { TimeValSubtract(&tleft, &tnext, &now); } } ntoread = (gNBufAllocated - gNBufUsed - 1); nread = read(fd, gBuf + gNBufUsed, ntoread); if (nread < 0) { if (errno == EINTR) continue; perror("ccdv: read"); return (-1); } else if (nread == 0) { break; } gNBufUsed += nread; gBuf[gNBufUsed] = '\0'; } snprintf(s1, sizeof(s1), "%s%s%s: ", gAction, gTarget[0] ? " " : "", gTarget); Wait(); if (gExitStatus == 0) { printf("\r%-70s", s1); printf("[%s%s%s]", ((gNBufUsed - strlen(gArgsStr)) < 4) ? SETCOLOR_SUCCESS : SETCOLOR_WARNING, "OK", SETCOLOR_NORMAL); printf("%-5s\n", " "); } else { printf("\r%-70s", s1); printf("[%s%s%s]", SETCOLOR_FAILURE, "ERROR", SETCOLOR_NORMAL); printf("%-2s\n", " "); gDumpCmdArgs = 1; /* print cmd when there are errors */ } fflush(stdout); return (0); } /* SlurpProgress */ static int SlurpAll(int fd) { char *newbuf; size_t ntoread; ssize_t nread; printf("%s%s%s.\n", gAction, gTarget[0] ? " " : "", gTarget); fflush(stdout); for(;;) { if (gNBufUsed == (gNBufAllocated - 1)) { if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) { perror("ccdv: realloc"); return (-1); } gNBufAllocated += TEXT_BLOCK_SIZE; gBuf = newbuf; } ntoread = (gNBufAllocated - gNBufUsed - 1); nread = read(fd, gBuf + gNBufUsed, ntoread); if (nread < 0) { if (errno == EINTR) continue; perror("ccdv: read"); return (-1); } else if (nread == 0) { break; } gNBufUsed += nread; gBuf[gNBufUsed] = '\0'; } Wait(); gDumpCmdArgs = (gExitStatus != 0); /* print cmd when there are errors */ return (0); } /* SlurpAll */ static const char * Basename(const char *path) { const char *cp; cp = strrchr(path, '/'); if (cp == NULL) return (path); return (cp + 1); } /* Basename */ static const char * Extension(const char *path) { const char *cp = path; cp = strrchr(path, '.'); if (cp == NULL) return (""); return (cp); } /* Extension */ static void Usage(void) { fprintf(stderr, "Usage: ccdv /path/to/cc CFLAGS...\n\n"); fprintf(stderr, "I wrote this to reduce the deluge Make output to make finding actual problems\n"); fprintf(stderr, "easier. It is intended to be invoked from Makefiles, like this. Instead of:\n\n"); fprintf(stderr, "\t.c.o:\n"); fprintf(stderr, "\t\t$(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n"); fprintf(stderr, "\nRewrite your rule so it looks like:\n\n"); fprintf(stderr, "\t.c.o:\n"); fprintf(stderr, "\t\t@ccdv $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n\n"); fprintf(stderr, "ccdv 1.1.0 is Free under the GNU Public License. Enjoy!\n"); fprintf(stderr, " -- Mike Gleason, NcFTP Software <http://www.ncftp.com>\n"); exit(96); } /* Usage */ int main(int argc, char **argv) { int pipe1[2]; int devnull; char emerg[256]; int fd; int nread; int i; int cc = 0, pch = 0; const char *quote; if (argc < 2) Usage(); snprintf(gAction, sizeof(gAction), "Running %s", Basename(argv[1])); memset(gArgsStr, 0, sizeof(gArgsStr)); for (i = 1; i < argc; i++) { quote = (strchr(argv[i], ' ') != NULL) ? "\"" : ""; snprintf(gArgsStr + strlen(gArgsStr), sizeof(gArgsStr) - strlen(gArgsStr), "%s%s%s%s%s", (i == 1) ? "" : " ", quote, argv[i], quote, (i == (argc - 1)) ? "\n" : ""); if ((strcmp(argv[i], "-o") == 0) && ((i + 1) < argc)) { if (strcasecmp(Extension(argv[i + 1]), ".o") != 0) { strcpy(gAction, "Linking"); snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i + 1])); } } else if (strchr("-+/", (int) argv[i][0]) != NULL) { continue; } else if (strncasecmp(Extension(argv[i]), ".c", 2) == 0) { cc++; snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i])); } else if ((strncasecmp(Extension(argv[i]), ".h", 2) == 0) && (cc == 0)) { pch++; snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i])); } else if ((i == 1) && (strcmp(Basename(argv[i]), "ar") == 0)) { snprintf(gAr, sizeof(gAr), "%s", Basename(argv[i])); } else if ((gArLibraryTarget[0] == '\0') && (strcasecmp(Extension(argv[i]), ".a") == 0)) { snprintf(gArLibraryTarget, sizeof(gArLibraryTarget), "%s", Basename(argv[i])); } } if ((gAr[0] != '\0') && (gArLibraryTarget[0] != '\0')) { strcpy(gAction, "Creating library"); snprintf(gTarget, sizeof(gTarget), "%s", gArLibraryTarget); } else if (pch > 0) { strcpy(gAction, "Precompiling"); } else if (cc > 0) { strcpy(gAction, "Compiling"); } if (pipe(pipe1) < 0) { perror("ccdv: pipe"); exit(97); } (void) close(0); devnull = open("/dev/null", O_RDWR, 00666); if ((devnull != 0) && (dup2(devnull, 0) == 0)) close(devnull); gCCPID = (int) fork(); if (gCCPID < 0) { (void) close(pipe1[0]); (void) close(pipe1[1]); perror("ccdv: fork"); exit(98); } else if (gCCPID == 0) { /* Child */ (void) close(pipe1[0]); /* close read end */ if (pipe1[1] != 1) { /* use write end on stdout */ (void) dup2(pipe1[1], 1); (void) close(pipe1[1]); } (void) dup2(1, 2); /* use write end on stderr */ execvp(argv[1], argv + 1); perror(argv[1]); exit(99); } /* parent */ (void) close(pipe1[1]); /* close write end */ fd = pipe1[0]; /* use read end */ gColumns = (getenv("COLUMNS") != NULL) ? atoi(getenv("COLUMNS")) : 80; gANSIEscapes = (getenv("TERM") != NULL) && (strstr(TERMS, getenv("TERM")) != NULL); gBuf = (char *) malloc(TEXT_BLOCK_SIZE); if (gBuf == NULL) goto panic; gNBufUsed = 0; gNBufAllocated = TEXT_BLOCK_SIZE; if (strlen(gArgsStr) < (gNBufAllocated - 1)) { strcpy(gBuf, gArgsStr); gNBufUsed = strlen(gArgsStr); } if (isatty(1)) { if (SlurpProgress(fd) < 0) goto panic; } else { if (SlurpAll(fd) < 0) goto panic; } DumpFormattedOutput(); exit(gExitStatus); panic: gDumpCmdArgs = 1; /* print cmd when there are errors */ DumpFormattedOutput(); while ((nread = read(fd, emerg, (size_t) sizeof(emerg))) > 0) (void) write(2, emerg, (size_t) nread); Wait(); exit(gExitStatus); } /* main */ /* eof ccdv.c */ --- NEW FILE: install-sh --- #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$cpprog" # note: changed from mvprog by stephan chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi # cygwin workaround: added by st...@wa... for use with toc. if [ -f "$src".exe ] ; then src="$src.exe" dst_suffix=".exe" echo CYGWIN WORKAROUND: src=$src fi if [ x"$dir_arg" != x ]; then dst="$src" src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$src" -o -d "$src" ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename "$src"` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi # cygwin workaround: if [ x"$dst_suffix" != x ]; then dst="$dst$dst_suffix" echo "CYGWIN WORKAROUND? dst=$dst" fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd "$src" $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 --- NEW FILE: removeDupeArgs --- #!/usr/bin/perl # Expects a list of command-line arguments, from which it removes any # duplicates after the first instance of any given entry. # Intended to be used to clean up INCLUDES and LDADD-like entries. # # Example: # $0 a b c b b c d e a # would print: # a b c d e %cache = (); @args = (); while( @ARGV ) { $a = $ARGV[0]; shift; next if $cache{$a}; $cache{$a} = 1; push( @args, $a ); } foreach $a (@args) { print $a," "; } print "\n"; --- NEW FILE: create_makefile_stubs.sh --- #!/bin/sh # # Generate stub Makefiles for toc. # # Usage: see help text, below dirs= x_help= while test x != "x$1" ; do arg="$1" shift case "$arg" in -?|--help|-help) x_help=1 ;; *) test -d $arg && dirs="$dirs $arg" ;; esac done # test x1 = "x$x_help" && { cat <<EOF $0: Creates stub files for a toc environment by looking at the contents of a directory. Usage: $0 dir1 [... dirN] dir1 defaults to ., which should be the \$(top_srcdir) of a project tree. For each dir it creates dir/Makefile.suggestion, containing guesses at what toc-related content might be useful in the corresponding Makefile. If called without any options then it acts RECURSIVELY on ".". It does not act recursively if called with directory arguments. This behaviour is arguable, but seems to be reasonable for the use-cases to-date (all 1.5 of them ;). EOF exit 0 } stderr () { # sends $@ to stderr echo "#" "$@" 1>&2 } slashify () { # converts file lists into a format which is more useful to Makefile maintainers. # usage: echo list | slashify perl -ne 's|\n| |g;s|\s+$||;s|\s+|%|g;s|%$|\n|;s|%| \\\n\t|g; print $_,"\n";' } ######################################################################## # check_make_XXX() conventions: # # $1 is the directory name, but they don't really need it. A chdir is # done before processing each dir, so all tests can safely assume pwd # is the directory they are responsible for checking. # # They "should" follow the naming convention check_make_XXX so they # can easily be handled in a loop using only their XXX parts. ######################################################################## ######################################################################## check_make_flexes () { # hanles *.flex echo "############## FLEXES:" export flext=flex local flexes="$(ls *.${flext} 2>/dev/null)" test x"$flexes" != "$flexes" && { stderr "Adding FLEXES" echo "# WARNING: FLEXES stuff only works for C++-based flexers" echo -n "FLEXES = " echo $flexes | sed s/\.${flext}//g echo "FLEXES_ARGS = -+ -p" for f in $flexes; do base=${f%%.${flext}} echo "${base}_FLEXES_ARGS = -P${base}" done echo -n "OBJECTS += " echo $flexes | sed s/\.${flext}/.${flext}.o/g echo "include \$(TOC_MAKESDIR)/flex.make" echo "# Run target FLEXES to process these." echo "# REMINDER: add the generated C++ files to your SOURCES, if needed." echo "############## /FLEXES" } } ######################################################################## check_make_c () { # checks for c/c++-related stuff local headers="$(ls *.h *.hpp 2>/dev/null )" test -n "$headers" && { stderr "Adding HEADERS" echo -n "HEADERS = "; echo $headers | slashify echo "DIST_FILES += \$(HEADERS)" echo "INSTALL_PACKAGE_HEADERS += \$(HEADERS)" echo } local sources="$(ls *.c *.cpp *.c++ *.C *.cxx 2>/dev/null )" test -n "$sources" && { stderr "Adding SOURCES" echo -n "SOURCES = "; echo $sources | slashify echo "DIST_FILES += \$(SOURCES)" echo -n "OBJECTS = " echo $sources | perl -pe 's|(\S+)\.\w+\s|$1.o |g' | slashify echo echo "CLEAN_FILES += \$(OBJECTS)" cat <<EOF build_libs = 0 ifeq (1,\$(build_libs)) STATIC_LIBS = thislib thislib_a_OBJECTS = \$(OBJECTS) thislib_so_OBJECTS = \$(thislib_a_OBJECTS) # thislib_so_VERSION = \$(PACKAGE_VERSION) include \$(TOC_MAKESDIR)/SHARED_LIBS.make include \$(TOC_MAKESDIR)/STATIC_LIBS.make # Run targets STATIC_LIBS and SHARED_LIBS build these. endif build_bins = 0 ifeq (1,\$(build_bins)) BIN_PROGRAMS = thisbin thisbin_bin_OBJECTS = \$(OBJECTS) include \$(TOC_MAKESDIR)/BIN_PROGRAMS.make INSTALL_BINS += \$(BIN_PROGRAMS) # Run target BIN_PROGRAMS to build these. endif EOF } #end SOURCES (and friends) } # end check_make_c ######################################################################## check_make_extra_dist () { # Add some common filenames/patterns to DIST_FILES local xtra= # reminder: toc adds Makefile to DIST_FILES by default, because it's ALWAYS needed. for x in README LICENSE NEWS ChangeLog \ *.at *.qmake \ *.sh *.pl \ *.bat \ *.txt *.TXT *.xml *.lyx \ ; do expr "$x" : '\*' >/dev/null && continue # unexpanded wildcard test -e $x || continue xtra="$xtra $x" done test -z "$xtra" && return stderr "Adding extra DIST_FILES." echo -n "DIST_FILES += " echo $xtra | slashify } ######################################################################## check_make_subdirs () { # add subdirs to SUBDIRS local ls="$(ls -d *)" test -z "$ls" && return local subs= for i in $ls; do test -d $i || continue; test "CVS" = "$i" && continue stderr "Adding SUBDIR $i" subs="$subs $i" done test -n "$subs" && echo "SUBDIRS = $subs" } # checks for existing Makefile check_make_makefile () { true } ############################################################################## # main app driver goes here: test x = "x$dirs" && { dirs="$(find . -type d | sed -e '/\/CVS/d')" } test x = "x$dirs" && { echo "Error: no subdirectories found!" exit 1 } timestamp=$(date) for d in $dirs; do cd $d >/dev/null || { err=$? echo "Error: could not cd to $d" exit $err } out=Makefile.suggestion stderr "Creating $d/$out" { cat <<EOF ################################################### # AUTO-GENERATED guess at a toc-aware Makefile, # based off of the contents of directory: # $d # Created by $0 # $timestamp # It must be tweaked to suit your needs. ################################################### include toc.make EOF for func in subdirs extra_dist flexes c ; do check_make_${func} $d done cat <<EOF all: ################################################### # end auto-generated rules ################################################### EOF } > $out cd - > /dev/null done ######################################################################## # the end ######################################################################## --- NEW FILE: mkdep.c --- /* * Originally by Linus Torvalds. * Smart CONFIG_* processing by Werner Almesberger, Michael Chastain. * * Usage: mkdep cflags -- file ... * * Read source files and output makefile dependency lines for them. * I make simple dependency lines for #include <*.h> and #include "*.h". * I also find instances of CONFIG_FOO and generate dependencies * like include/config/foo.h. * * 1 August 1999, Michael Elizabeth Chastain, <me...@sh...> * - Keith Owens reported a bug in smart config processing. There used * to be an optimization for "#define CONFIG_FOO ... #ifdef CONFIG_FOO", * so that the file would not depend on CONFIG_FOO because the file defines * this symbol itself. But this optimization is bogus! Consider this code: * "#if 0 \n #define CONFIG_FOO \n #endif ... #ifdef CONFIG_FOO". Here * the definition is inactivated, but I still used it. It turns out this * actually happens a few times in the kernel source. The simple way to * fix this problem is to remove this particular optimization. * * 2.3.99-pre1, Andrew Morton <an...@uo...> * - Changed so that 'filename.o' depends upon 'filename.[cS]'. This is so that * missing source files are noticed, rather than silently ignored. * * 2.4.2-pre3, Keith Owens <ka...@oc...> * - Accept cflags followed by '--' followed by filenames. mkdep extracts -I * options from cflags and looks in the specified directories as well as the * defaults. Only -I is supported, no attempt is made to handle -idirafter, * -isystem, -I- etc. * * Aug 2003: stephan beal <st...@s1...> * - removed HPATH requirement for use in the toc project (toc.sourceforge.net) * * Aug 2003: rusty <bo...@us...> * Other changes for use in toc/libfunUtil: * - Add support for C++ file extensions .cc, .C, .c++, .cxx, .cpp. * (Previously, this was doing "a" right thing, by making foo.c++ depend on * the headers #included by foo.c++, with a "touch foo.c++" rule which * would then cause the .o file to be out of date, but "the" right thing is * for foo.o to depend on the headers #included by foo.c++. I guess there * aren't many C++ files in the Linux kernel tree, ha ha.) * * Dec 2003: st...@s1... * Changes for toc.sourceforge.net: * - removed the default 'touch' behaviour to avoid collissions with targets * generated via toc. * * 20 Aug 2004: st...@s1... * - Removed unused hpath from main(). WTF does gcc NOW start to * complain about that!?!?!? * - Added some parens to keep gcc from bitching (again... why now? * Been compiling w/o complaint for over a year). * * */ #include <ctype.h> #include <fcntl.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/fcntl.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> /** TOC_MODE enables: - to 'touch'ing of targets, to avoid overriding rules defined elsewhere in toc. */ #define TOC_MODE 1 char __depname[512] = "\n\t@touch "; #define depname (__depname+9) int hasdep; struct path_struct { int len; char *buffer; }; struct path_struct *path_array; int paths; /* Current input file */ static const char *g_filename; /* * This records all the configuration options seen. * In perl this would be a hash, but here it's a long string * of values separated by newlines. This is simple and * extremely fast. */ char * str_config = NULL; int size_config = 0; int len_config = 0; static void do_depname(void) { if (!hasdep) { hasdep = 1; //printf( "depname=%s, g_filename=%s", depname, g_filename ); printf("%s:", depname); if (g_filename) printf(" %s", g_filename); } } /* * Grow the configuration string to a desired length. * Usually the first growth is plenty. */ void grow_config(int len) { while (len_config + len > size_config) { if (size_config == 0) size_config = 2048; str_config = realloc(str_config, size_config *= 2); if (str_config == NULL) { perror("malloc config"); exit(1); } } } /* * Lookup a value in the configuration string. */ int is_defined_config(const char * name, int len) { const char * pconfig; const char * plast = str_config + len_config - len; for ( pconfig = str_config + 1; pconfig < plast; pconfig++ ) { if (pconfig[ -1] == '\n' && pconfig[len] == '\n' && !memcmp(pconfig, name, len)) return 1; } return 0; } /* * Add a new value to the configuration string. */ void define_config(const char * name, int len) { grow_config(len + 1); memcpy(str_config+len_config, name, len); len_config += len; str_config[len_config++] = '\n'; } /* * Clear the set of configuration strings. */ void clear_config(void) { len_config = 0; define_config("", 0); } /* * This records all the precious .h filenames. No need for a hash, * it's a long string of values enclosed in tab and newline. */ char * str_precious = NULL; int size_precious = 0; int len_precious = 0; /* * Grow the precious string to a desired length. * Usually the first growth is plenty. */ void grow_precious(int len) { while (len_precious + len > size_precious) { if (size_precious == 0) size_precious = 2048; str_precious = realloc(str_precious, size_precious *= 2); if (str_precious == NULL) { perror("malloc"); exit(1); } } } /* * Add a new value to the precious string. */ void define_precious(const char * filename) { int len = strlen(filename); grow_precious(len + 4); *(str_precious+len_precious++) = '\t'; memcpy(str_precious+len_precious, filename, len); len_precious += len; memcpy(str_precious+len_precious, " \\\n", 3); len_precious += 3; } /* * Handle an #include line. */ void handle_include(int start, const char * name, int len) { struct path_struct *path; int i; if (len == 14 && !memcmp(name, "linux/config.h", len)) return; if (len >= 7 && !memcmp(name, "config/", 7)) define_config(name+7, len-7-2); for (i = start, path = path_array+start; i < paths; ++i, ++path) { memcpy(path->buffer+path->len, name, len); path->buffer[path->len+len] = '\0'; if (access(path->buffer, F_OK) == 0) { do_depname(); printf(" \\\n %s", path->buffer); return; } } } /* * Add a path to the list of include paths. */ void add_path(const char * name) { struct path_struct *path; char resolved_path[PATH_MAX+1]; const char *name2; if (strcmp(name, ".")) { name2 = realpath(name, resolved_path); if (!name2) { fprintf(stderr, "realpath(%s) failed, %m\n", name); exit(1); } } else { name2 = ""; } path_array = realloc(path_array, (++paths)*sizeof(*path_array)); if (!path_array) { fprintf(stderr, "cannot expand path_arry\n"); exit(1); } path = path_array+paths-1; path->len = strlen(name2); path->buffer = malloc(path->len+1+256+1); if (!path->buffer) { fprintf(stderr, "cannot allocate path buffer\n"); exit(1); } strcpy(path->buffer, name2); if (path->len && *(path->buffer+path->len-1) != '/') { *(path->buffer+path->len) = '/'; *(path->buffer+(++(path->len))) = '\0'; } } /* * Record the use of a CONFIG_* word. */ void use_config(const char * name, int len) { char *pc; int i; pc = path_array[paths-1].buffer + path_array[paths-1].len; memcpy(pc, "config/", 7); pc += 7; for (i = 0; i < len; i++) { char c = name[i]; if (isupper((int)c)) c = tolower((int)c); if (c == '_') c = '/'; pc[i] = c; } pc[len] = '\0'; if (is_defined_config(pc, len)) return; define_config(pc, len); do_depname(); printf(" \\\n $(wildcard %s.h)", path_array[paths-1].buffer); } /* * Macros for stunningly fast map-based character access. * __buf is a register which holds the current word of the input. * Thus, there is one memory access per sizeof(unsigned long) characters. */ #if defined(__alpha__) || defined(__i386__) || defined(__ia64__) || defined(__x86_64__) || defined(__MIPSEL__) \ || defined(__arm__) #define LE_MACHINE #endif #ifdef LE_MACHINE #define next_byte(x) (x >>= 8) #define current ((unsigned char) __buf) #else #define next_byte(x) (x <<= 8) #define current (__buf >> 8*(sizeof(unsigned long)-1)) #endif #define GETNEXT { \ next_byte(__buf); \ if ((unsigned long) next % sizeof(unsigned long) == 0) { \ if (next >= end) \ break; \ __buf = * (unsigned long *) next; \ } \ next++; \ } /* * State machine macros. */ #define CASE(c,label) if (current == c) goto label #define NOTCASE(c,label) if (current != c) goto label /* * Yet another state machine speedup. */ #define MAX2(a,b) ((a)>(b)?(a):(b)) #define MIN2(a,b) ((a)<(b)?(a):(b)) #define MAX5(a,b,c,d,e) (MAX2(a,MAX2(b,MAX2(c,MAX2(d,e))))) #define MIN5(a,b,c,d,e) (MIN2(a,MIN2(b,MIN2(c,MIN2(d,e))))) /* * The state machine looks for (approximately) these Perl regular expressions: * * m|\/\*.*?\*\/| * m|\/\/.*| * m|'.*?'| * m|".*?"| * m|#\s*include\s*"(.*?)"| * m|#\s*include\s*<(.*?>"| * m|#\s*(?define|undef)\s*CONFIG_(\w*)| * m|(?!\w)CONFIG_| * * About 98% of the CPU time is spent here, and most of that is in * the 'start' paragraph. Because the current characters are * in a register, the start loop usually eats 4 or 8 characters * per memory read. The MAX5 and MIN5 tests dispose of most * input characters with 1 or 2 comparisons. */ void state_machine(const char * map, const char * end) { const char * next = map; const char * map_dot; unsigned long __buf = 0; for (;;) { start: GETNEXT __start: if (current > MAX5('/','\'','"','#','C')) goto start; if (current < MIN5('/','\'','"','#','C')) goto start; CASE('/', slash); CASE('\'', squote); CASE('"', dquote); CASE('#', pound); CASE('C', cee); goto start; /* // */ slash_slash: GETNEXT CASE('\n', start); NOTCASE('\\', slash_slash); GETNEXT goto slash_slash; /* / */ slash: GETNEXT CASE('/', slash_slash); NOTCASE('*', __start); slash_star_dot_star: GETNEXT __slash_star_dot_star: NOTCASE('*', slash_star_dot_star); GETNEXT NOTCASE('/', __slash_star_dot_star); goto start; /* '.*?' */ squote: GETNEXT CASE('\'', start); NOTCASE('\\', squote); GETNEXT goto squote; /* ".*?" */ dquote: GETNEXT CASE('"', start); NOTCASE('\\', dquote); GETNEXT goto dquote; /* #\s* */ pound: GETNEXT CASE(' ', pound); CASE('\t', pound); CASE('i', pound_i); CASE('d', pound_d); CASE('u', pound_u); goto __start; /* #\s*i */ pound_i: GETNEXT NOTCASE('n', __start); GETNEXT NOTCASE('c', __start); GETNEXT NOTCASE('l', __start); GETNEXT NOTCASE('u', __start); GETNEXT NOTCASE('d', __start); GETNEXT NOTCASE('e', __start); goto pound_include; /* #\s*include\s* */ pound_include: GETNEXT CASE(' ', pound_include); CASE('\t', pound_include); map_dot = next; CASE('"', pound_include_dquote); CASE('<', pound_include_langle); goto __start; /* #\s*include\s*"(.*)" */ pound_include_dquote: GETNEXT CASE('\n', start); NOTCASE('"', pound_include_dquote); handle_include(0, map_dot, next - map_dot - 1); goto start; /* #\s*include\s*<(.*)> */ pound_include_langle: GETNEXT CASE('\n', start); NOTCASE('>', pound_include_langle); handle_include(1, map_dot, next - map_dot - 1); goto start; /* #\s*d */ pound_d: GETNEXT NOTCASE('e', __start); GETNEXT NOTCASE('f', __start); GETNEXT NOTCASE('i', __start); GETNEXT NOTCASE('n', __start); GETNEXT NOTCASE('e', __start); goto pound_define_undef; /* #\s*u */ pound_u: GETNEXT NOTCASE('n', __start); GETNEXT NOTCASE('d', __start); GETNEXT NOTCASE('e', __start); GETNEXT NOTCASE('f', __start); goto pound_define_undef; /* * #\s*(define|undef)\s*CONFIG_(\w*) * * this does not define the word, because it could be inside another * conditional (#if 0). But I do parse the word so that this instance * does not count as a use. -- mec */ pound_define_undef: GETNEXT CASE(' ', pound_define_undef); CASE('\t', pound_define_undef); NOTCASE('C', __start); GETNEXT NOTCASE('O', __start); GETNEXT NOTCASE('N', __start); GETNEXT NOTCASE('F', __start); GETNEXT NOTCASE('I', __start); GETNEXT NOTCASE('G', __start); GETNEXT NOTCASE('_', __start); map_dot = next; pound_define_undef_CONFIG_word: GETNEXT if (isalnum(current) || current == '_') goto pound_define_undef_CONFIG_word; goto __start; /* \<CONFIG_(\w*) */ cee: if (next >= map+2 && (isalnum((int)next[-2]) || next[-2] == '_')) goto start; GETNEXT NOTCASE('O', __start); GETNEXT NOTCASE('N', __start); GETNEXT NOTCASE('F', __start); GETNEXT NOTCASE('I', __start); GETNEXT NOTCASE('G', __start); GETNEXT NOTCASE('_', __start); map_dot = next; cee_CONFIG_word: GETNEXT if (isalnum(current) || current == '_') goto cee_CONFIG_word; use_config(map_dot, next - map_dot - 1); goto __start; } } /* * Generate dependencies for one file. */ void do_depend(const char * filename, const char * command) { int mapsize; int pagesizem1 = getpagesize()-1; int fd; struct stat st; char * map; fd = open(filename, O_RDONLY); if (fd < 0) { perror(filename); return; } fstat(fd, &st); if (st.st_size == 0) { fprintf(stderr,"%s is empty\n",filename); close(fd); return; } mapsize = st.st_size; mapsize = (mapsize+pagesizem1) & ~pagesizem1; map = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0); if ((long) map == -1) { perror("mkdep: mmap"); close(fd); return; } if ((unsigned long) map % sizeof(unsigned long) != 0) { fprintf(stderr, "do_depend: map not aligned\n"); exit(1); } hasdep = 0; clear_config(); state_machine(map, map+st.st_size); if (hasdep) { puts(command); if (*command) define_precious(filename); } munmap(map, mapsize); close(fd); } /* * Generate dependencies for all files. */ int main(int argc, char **argv) { int len; add_path("."); /* for #include "..." */ while (++argv, --argc > 0) { if (strncmp(*argv, "-I", 2) == 0) { if (*((*argv)+2) ) { add_path((*argv)+2); } else { ++argv; --argc; } } else if (strcmp(*argv, "--") == 0) { break; } } while (--argc > 0) { const char * filename = *++argv; #if TOC_MODE const char * command = ""; #else const char * command = __depname; #endif g_filename = 0; len = strlen(filename); memcpy(depname, filename, len+1); if (len > 2 && filename[len-2] == '.') { if (filename[len-1] == 'c' || filename[len-1] == 'S' || filename[len-1] == 'C') { depname[len-1] = 'o'; g_filename = filename; command = ""; } } else if (len > 3 && filename[len-3] == '.') { if (filename[len-2] == 'c' && filename[len-1] == 'c') { depname[len-2] = 'o'; depname[len-1] = '\0'; g_filename = filename; command = ""; } } else if (len > 4 && filename[len-4] == '.') { if ( filename[len-3] == 'c' && // check for c++/cxx/cpp ( (filename[len-2] == '+' && filename[len-1] == '+') || (filename[len-2] == 'x' && filename[len-1] == 'x') || (filename[len-2] == 'p' && filename[len-1] == 'p') ) ) { depname[len-3] = 'o'; depname[len-2] = '\0'; g_filename = filename; command = ""; } } do_depend(filename, command); } if (len_precious) { *(str_precious+len_precious) = '\0'; printf(".PRECIOUS:%s\n", str_precious); } return 0; } --- NEW FILE: getMakefileVar --- #!/usr/bin/perl # tries to parse out a value of a var from a Makefile # it does no var expansion, nor file inclusion, nor # anything fancy. One potential use is pulling out # vars from qmake-generated makefiles so they can # be used in more maintainable ways in other places. $var = $ARGV[0]; die "Usage: $0 VARNAME [makefile]" unless $var; $mf = $ARGV[1] || "Makefile"; die "Cannot find $mf!" unless -f $mf; open( INFILE, "<$mf" ) or die "Cannot open $mf!"; while( INFILE && ($line !~ m|^$var|) ) { $line = <INFILE>; if( eof INFILE ) { $line = 0; last; } } if( ! $line ) { exit 127; } $theval = $line; $theval =~ s|^.*=\s*||; #print ">>>theval=$theval\n"; while( $theval =~ m|\\$| ) { $theval =~ s|\\||g; #print ">>>theval=$theval\n"; #print "val=$thevalue"; $line = <INFILE>; chomp( $line ); $theval .= $line; last unless $line =~ m|\\$|; } $theval =~ s| \\\s*| |mg; $theval =~ s/\s+/ /mg; $theval =~ s/^\s+//mg; $theval =~ s/\s+$//mg; close( INFILE ); exit 1 if ! $theval; print $theval."\n"; |
From: stephan b. <sg...@us...> - 2004-12-22 19:04:36
|
Update of /cvsroot/pclasses/pclasses2/toc/sbin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6599/sbin Added Files: configure.sample Makefile toc_core.sh toconfigure Log Message: egg --- NEW FILE: toc_core.sh --- # This file is sourced by configure. Do not run it standalone: # it is designed to be sources from the toconfigure script. # # It contains the implementation of the toc API. # # # All global vars defined in this file are, unless otherwise noted, # considered private - configure is not supposed to touch them # directly, nor are test scripts. # # Sourcing this file from anywhere other than toconfigure will have undefined # results. # ######################################################################## # maintenance notes: # # vars expected from toconfigure: # TOC_HOME - path to toc's top dir # TOP_SRCDIR - directory we want to configure from (e.g., top-most # dir of a source tree). TOC_QUIET=${TOC_QUIET-0} TOC_LOUD=${TOC_LOUD-0} export prefix=${prefix-${TOC_PREFIX-/usr/local}} # prefix will be overridden by the command-line arg --prefix=/path TOC_INCLUDESDIR=${TOP_SRCDIR}/include TOC_TESTSDIR=${TOC_HOME}/tests TOC_MAKEFILES_DIR=$TOC_HOME/make TOC_ATSIGN_PARSER=$TOC_HOME/bin/atsign_parse # utility to replace @TOKENS_LIKE_THIS_ONE@ in streams. TOC_DEBUG=${TOC_DEBUG-0} TOC_SHARED_MAKEFILE=toc_shared.make # TOC_SHARED_MAKEFILE is obsolete, and should Go Away. Use toc.${PACKAGE_NAME}.make.at # and ${TOC_HOME}/make/toc.make.at instead. declare -a CONFIG_DOT_MAKE_ARRAY # array holds key=val strings for makefiles declare -a CONFIG_DOT_H_ARRAY # array holds key=val strings for config.h.at TOC_DELETE_TEMP="test 1 = 1" # set to a false condition to disable deletion of some temp files (for debuggering) TOC_TIMESTAMP=${TOP_SRCDIR}/.toc.configtimestamp touch ${TOC_TIMESTAMP} # TOC_VERBOSE_WARNINGS=${TOC_VERBOSE_WARNINGS-0} # spits out the debug file contents #TOC_CACHE=${TOP_SRCDIR}/configure.last #test -f ${TOC_CACHE} && rm ${TOC_CACHE} # echo $0 $@ >> ${TOC_CACHE}# loses quoted args' quotes { # eye candy, mostly stolen from mod_ssl configure script: which awk >/dev/null && { case $TERM in xterm|xterm*|vt220|vt220*) TOC_BOLD_=`echo dummy | awk '{ printf("%c%c%c%c", 27, 91, 49, 109); }'` # that is frigging clever, no? _TOC_BOLD=`echo dummy | awk '{ printf("%c%c%c", 27, 91, 109); }'` ;; vt100|vt100*) TOC_BOLD_=`echo dummy | awk '{ printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }'` _TOC_BOLD=`echo dummy | awk '{ printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }'` ;; default) TOC_BOLD_='' _TOC_BOLD='' ;; esac } _TOC_BOLD=${_TOC_BOLD-""} TOC_BOLD_=${TOC_BOLD_-""} toc_boldecho () { local args= for i in n e; do if test "$1" = "-${i}"; then args="$args $1" shift fi done echo $args "${TOC_BOLD_}${@}${_TOC_BOLD}" } toc_boldcat () { echo "${TOC_BOLD_}" cat echo "${_TOC_BOLD}" } } # end eye candy TOC_ERR_OK=0 TOC_ERR_ERROR=1 # OKAY, ERROR and WARNING are "core" emoticons: TOC_EMOTICON_OKAY="${TOC_BOLD_}:-)${_TOC_BOLD}" TOC_EMOTICON_ERROR="${TOC_BOLD_}:-(${_TOC_BOLD}" TOC_EMOTICON_WARNING="${TOC_BOLD_}:-O${_TOC_BOLD}" # "unofficial" emoticons:x TOC_EMOTICON_GRIEF="${TOC_BOLD_}:'-(${_TOC_BOLD}" TOC_EMOTICON_WTF="${TOC_BOLD_}:-?${_TOC_BOLD}" toc_debug () { test "$TOC_DEBUG" -ne 0 || return 0; echo "toc_debug: " "$@" 1>&2 return 0 } toc_die () { # $1 = error code (defaults to $?) # $2+ = optional informational text # sample: toc_test mytest || toc_die $? "mytest failed." err=${1-$?} shift echo -n "${TOC_EMOTICON_ERROR} " toc_boldecho "toc_die: exiting with error code $err." test -n "$1" && toc_boldecho "$@" exit $err } toc_quietly () { # outputs $@ if ${TOC_QUIET} = 0 # returns 1 if it does not output anything # It it is passed no parameters it reads in from stdin, # thus you can: # toc_quietly <<EOF # blah blah blah # EOF test "x${TOC_QUIET-0}" != "x0" && return 1 test -n "$1" && { echo "$@" return 0 } cat return 0 } toc_loudly () { # outputs $@ if ${TOC_LOUD} != 0 # returns 1 if it does not output anything # It it is passed no parameters it reads in from stdin, # thus you can: # toc_loudly <<EOF # blah blah blah # EOF test "x${TOC_LOUD-0}" = "x0" && return 1 test -n "$1" && { echo "$@" return 0 } cat return 0 } toc_dump_make_properties () { # Dumps the current properties from the makefile array to stdout local i=0 while test $i -lt ${#CONFIG_DOT_MAKE_ARRAY[@]}; do echo ${CONFIG_DOT_MAKE_ARRAY[$i]} i=$((i + 1)) done | ${TOC_HOME}/bin/cleanup_vars return 0 } toc_dump_config_h_properties () { # Dumps the current properties from the config.h array to stdout local i=0 while test $i -lt ${#CONFIG_DOT_H_ARRAY[@]}; do echo ${CONFIG_DOT_H_ARRAY[$i]} i=$((i + 1)) done | ${TOC_HOME}/bin/cleanup_vars return 0 } toc_get_make () { # gets a key which has been previously set # via toc_add_make. The value is not echoed, but is in the # global var ${TOC_GET_MAKE}. Returns 0 if it finds the var # and 1 if it does not. # # $1 = name of var. # [$2] = if 1 then the result is echoed. If 2 then $1=${TOC_GET_MAKE} # is echoed. Default behaviour is to not output anything. # A pneumonic for $2: 1 stands for one part (the value) and 2 # stands for 2 parts (the key and the value). TOC_GET_MAKE= local i=${#CONFIG_DOT_MAKE_ARRAY[@]} local arg="$1" local theval= local ret=1 i=$((i - 1)) while test $i -ge 0; do foo=${CONFIG_DOT_MAKE_ARRAY[$i]} local k="${foo%%=*}" local v="${foo#*=}" test "$arg" = "$k" && { ret=0 theval="$v" break } i=$((i - 1)) done TOC_GET_MAKE="$theval" test "x$2" = "x1" && echo ${TOC_GET_MAKE} test "x$2" = "x2" && echo $arg="${TOC_GET_MAKE}" toc_debug toc_get_make "$@": "$arg=$theval" return $ret } toc_atfilter_as_makefile () { # filters file $1 using the vars currently set for the shared makefile. # $1 = template file # $2 = target file local tmpl=$1 local target=$2 local tmpfile=.toc.atfilter_as_makefile toc_dump_make_properties > $tmpfile toc_atfilter_file $tmpfile $tmpl $target local err=$? rm $tmpfile return $err } toc_create_make () { # todo: completely refactor this func, splitting it up into # several functions. # # Writes out toc_shared.make using the options set via toc_add_make and creates toc.make # echo "Creating ${TOC_SHARED_MAKEFILE} and it's friends... " # set some must-be-set-last vars here: # toc_add_make TOC_SHARED_MAKEFILE=${TOC_SHARED_MAKEFILE} # local toc_shared_qmakefile=${TOC_SHARED_MAKEFILE%%.make}.qmake # toc_add_make TOC_SHARED_QMAKEFILE=${toc_shared_qmakefile} # TOC_SHARED_MAKEFILE_AT=${TOC_SHARED_MAKEFILE}.at # toc_add_make TOC_SHARED_MAKEFILE_AT=${TOC_SHARED_MAKEFILE_AT} # TOC_GENDMAKE_OUT=toc.make # toc_add_make TOC_MAKEFILE=$TOC_GENDMAKE_OUT # so we can add this to DISTCLEAN :/ # create toc.make for everyone who looks like they need it: #echo "${TOC_GENDMAKE_OUT}: " toc_test toc_make | toc_die $? "Error creating toc.make!" test 0 = 1 && { # .qmake support qtat=${toc_shared_qmakefile}.at test -f "$qtat" && { toc_atfilter_as_makefile $qtat ${qtat%%.at} || { toc_die $? "Error filtering $qtat." } qmakeout=toc.qmake #echo "$qmakeout: " local files=$(find ${TOP_SRCDIR} -name Makefile -o -name "*.qmake" | xargs grep -l "^include(.*$qmakeout.*)" ) lastdir= test -n "$files" && for d in $files; do cmake=${d%/*}/${qmakeout} cmake=${cmake##$TOP_SRCDIR/} # make it a relative path, for asthetic reasons :/ toc_makerelative $d relpath=${TOC_MAKERELATIVE} test "$lastdir" = "$cmake" && continue lastdir=$cmake # keep from doing same dir twice :/ tmpfile=${cmake}.tmp cp $makeprops $tocmakeprops cat <<EOF >> $tocmakeprops TOC_TOP_SRCDIR=${relpath} TOC_SHARED_QMAKEFILE=\$\$top_srcdir/${toc_shared_qmakefile} include( \$\$TOC_SHARED_QMAKEFILE ) EOF # echo -n " $cmake ... " toc_atfilter_file $tocmakeprops ${TOC_HOME}/make/toc.qmake.at $cmake || { err=$? echo "Error creating toc.qmake!" exit $err } rm $tocmakeprops # >/dev/null 2>&1 done #echo ${TOC_EMOTICON_OKAY} } # test -f "$qtat" } # end qmake support #echo -n "${TOC_SHARED_MAKEFILE##${TOP_SRCDIR}/}: " # toc_atfilter_as_makefile ${TOC_SHARED_MAKEFILE_AT} ${TOC_SHARED_MAKEFILE} || { # toc_die $? "Error filtering ${TOC_SHARED_MAKEFILE_AT}" # } #set +x #echo " ${TOC_EMOTICON_OKAY}" # rm $makeprops return 0 } # end function toc_create_make { # function toc_find_in_path: shell function to find an app in a given path # usage: # toc_find_in_path appname [/path1:/path/two:path3/foo/bar] # # To keep you from having to run a subshell to assign it to a var, # it it sets the global var TOC_FIND_IN_PATH to the full path # of $1 (which may be empty, meaning it was not found). # # Sample usage: # toc_find_in_path ls && LS=${TOC_FIND_RESULT} # or (newer way): # toc_find_in_path ls && LS=${TOC_FIND_RESULT} # # Using ${TOC_FIND_RESULT} is more maintainable in config tests # because this function is used by all toc_find_XXX functions, # and you can rely on that variable to be set no matter which # of those functions you use. # # Note that TOC_FIND_RESULT is re-set on every call to this # function, so copy it's return value instead of referencing # TOC_FIND_RESULT, especially if you are calling functions # which may, indirectly, call this function. # # It returns 1 if ${TOC_FIND_RESULT} is empty (i.e., if it found anything), # else it returns 0. toc_find_in_path () { toc_debug toc_find_in_path "$@" TOC_FIND_RESULT= # holds the quasi-return value local app=$1 shift local path="$@" test -n "$path" || path="$PATH" # EXPERIMENTAL --with-FOO=/path/to/foo support # local foo # local bar # bar=$(echo $app | tr '[\-\.\\/+]' '[_____]') # # ^^^ there's Grief waiting to happen here :/ # eval foo=\$configure_with_${bar} # test x${foo} != x -a x${foo} != x0 -a x${foo} != x1 && { # toc_loudly -n " Using explicit --with-$app: $foo" # app="${foo}" # path="" # } # /experiment # strange: when run as: toc_find_in_path ls $PATH # path is space-separated! # echo path=$path local oldifs=$IFS IFS=" :;" local found= test -e "$app" && found=$app || for p in $path; do fullp=$p/$app test -e $fullp || continue found=$fullp break done #test -n "$found" || echo "App $app not found in path $path" 1>&2 TOC_FIND_RESULT="$found" # echo $found IFS=$oldifs if [ -r "$found" ] ; then TOC_FIND_RESULT="$found" return 0 else TOC_FIND_RESULT= return 1 fi } } # end funcion toc_find_in_path { # config manipulators # function add_config_{make,h}: helper functions for setting configuration args # These docs are only here to make these functions appear to contain # more arcane functionity than their sleek implementations might otherwise # imply. # # Only call these funcs with one key/val pair at a time, to allow for # proper handling of foo="something with spaces in it" # # usage: toc_add_make VAR="VAR's value, presumably." toc_add_make () { toc_debug "toc_add_make: $@" CONFIG_DOT_MAKE_ARRAY[${#CONFIG_DOT_MAKE_ARRAY[@]}]="$@" } toc_add_config_h () { toc_debug "toc_add_config_h: $@" CONFIG_DOT_H_ARRAY[${#CONFIG_DOT_H_ARRAY[@]}]="$@" } toc_add_config () { toc_add_make "$@" toc_add_config_h "$@" } toc_export () { # the ultimate in laziness: toc_add_config plus shell export. toc_debug toc_export "$@" toc_add_config "$@" local args="$@" local k="${args%%=*}" local v="${args##*=}" eval "export $k='$v'" } } # end config manipulator toc_find_test () { # Sets TOC_FIND_RESULT to the absolute path of the toc test named $1 # Returns 0 if it finds a file, else 1. toc_find_in_path $1 . || \ toc_find_in_path $1.sh . || \ toc_find_in_path ${TOC_TESTSDIR}/$1 || \ toc_find_in_path ${TOC_TESTSDIR}/$1.sh } { # function toc_run test_name [args to pass to test] # Runs a test and returns it's return code. # # If $1 is an existing file, that file is treated # as the test, and sourced, otherwise a lookup # algorithm is used to find test_name.sh. # # Normally clients should use toc_test or toc_test_require instead # of this function. TOC_RUN_DEPTH=0 toc_run () { TOC_RUN_DEPTH=$((TOC_RUN_DEPTH + 1)) local depth=${TOC_RUN_DEPTH} toc_debug "toc_run " "$@" local testname=$1 #${TOC_FIND_RESULT} #TOC_DIR=${TOC_TESTSDIR} local path= local desc= toc_find_test $testname && { path=${TOC_FIND_RESULT} desc=$(sed -ne 's|\#.*toc_run_description.*= *\(.*\)|\1|p;' ${TOC_FIND_RESULT}); # note: ^^^ sed expr should end with 'q', but then i can only read the top-most line, # and i like to have a shebang as the top-most line to help out emacs :/ } || { toc_die 127 toc_run cannot find script for test $testname. } shift # if test ${TOC_LOUD} = 1; then local showname="$testname" test "x${TOC_LOUD-0}" != "x0" -a "x$1" != "x" && showname="$showname $@" toc_loudly -n "[$depth]" i=1; while test $i -le $depth; do echo -n "${TOC_BOLD_}=?=${_TOC_BOLD_}" i=$((i + 1)) done toc_boldecho -n " [$showname] " test -n "$desc" && eval "echo -n $desc" # ^^^ the eval allows us to use $VARS in toc_run_description. as a # side-effect, however, you must escape ><| in toc_run_description! echo local err=0 toc_source_test $testname "$@" err=$? if test ${TOC_FAIL_FAST-0} = 1 -a $err != 0; then toc_die $err "toc_run: TOC_FAIL_FAST is set, and test $testname returned a non-zero error code." fi TOC_RUN_DEPTH=$((TOC_RUN_DEPTH - 1)) return $err } toc_repeat_echo () { # Internal helper. Echoes it's arguments ($2-$N) $1 times. local rep=$1 shift while [ $rep -ge 1 ] ; do echo "$@" " " rep=$((rep - 1)) done } toc_test () { # runs toc_run and warns if there was an error. # It does not exit - it passes back the error code from the test. toc_debug toc_test "$@" local testname=$1 local depth=$((TOC_RUN_DEPTH + 1)) toc_run "$@" || { local ret=$? toc_loudly -n "[${depth}] " toc_repeat_echo 5 -n "${TOC_EMOTICON_WARNING}" toc_boldecho -n "[$testname]" " " toc_repeat_echo 5 -n "${TOC_EMOTICON_WARNING}" echo return $ret } toc_quietly "${TOC_EMOTICON_OKAY} [$testname]" return 0 } toc_test_require () { # calls toc_run and exits if it returns !0 toc_debug toc_test_require "$@" local testname=$1 local depth=$((TOC_RUN_DEPTH + 1)) toc_run "$@" || { local ret=$? toc_loudly -n "[${depth}] " toc_repeat_echo 5 -n "${TOC_EMOTICON_ERROR}" toc_boldecho -n "[$testname]" " " toc_repeat_echo 5 -n "${TOC_EMOTICON_ERROR}" echo exit $ret } toc_quietly "${TOC_EMOTICON_OKAY} [$testname]" return 0 } toc_source_test () { # sources the given test script and returns it's error code. # it accepts a filename or X, where X should resolve to ${TOC_HOME}/tests/X.sh. local test=$1 shift toc_find_test $test || toc_die $? "toc_source_test: $test not found!" local sh=${TOC_FIND_RESULT} #echo "toc_find_test: $test sh=$sh" local err=0 toc_debug "toc_source_test sourcing [$sh $@]" . $sh "$@" err=$? return $err } toc_find () { # toc_find works like toc_test, but searches for the app $1 # in path ${2-${PATH}}. It returns 1 if it finds no file, else zero. # It "returns" the found file in the global var ${TOC_FIND_RESULT}. local bin="$1" shift local path="${@-${PATH}}" # toc_quietly -n -e "? find $bin\t" toc_find_in_path $bin "$path" || { echo -n "${TOC_EMOTICON_WARNING} $bin" toc_loudly -n " not found in $path" echo return 1 } local str="${TOC_EMOTICON_OKAY} $bin" # test "x${TOC_QUIET-0}" = "x0" && str="${TOC_EMOTICON_OKAY}" test "x${TOC_LOUD-0}" != "x0" && str="$str: ${TOC_FIND_RESULT}" toc_quietly "$str" return 0 } toc_find_require () { # Same as toc_find(), except this one exits on error toc_find "$@" || toc_die $? toc_find_require "$@" return 0 } } # end toc_run functions { toc_replace_file () { # toc_replace_file: helper to check if a file is changed, and replace it if it is # usage: toc_replace_file target tmpfile # tmpfile is deleted if target is the same as tmpfile, else it replaces target. # The fact that it echos text is a side-effect of other parts of this code, # so don't rely 100% on that "feature". i.e., it echos to fit in with common usage # of this function, not because it's a logical part of the interface :/. # # It returns 0 if it replaces $1 with $2. It returns 1 if $1 does # not need replacing ($1 and $2 are not different). # # # It exits if it cannot mv or rm a file: that is considered a filesystem/rights-level # problem which needs to be addressed immediately. # # local tgt="$1" local tmp="$2" toc_debug toc_replace_file $tgt $tmp test -f "$tmp" || { echo "toc_replace_file: argument 2 ($2): could not find file." exit 1 } if test -f "$tgt"; then if cmp -s "$tgt" "$tmp"; then toc_debug "toc_replace_file: $tgt is up to date. Deleting $tmp." #echo "toc_replace_file: $tgt fstate=up to date" rm -f "$tmp" return 1 fi fi mv -f "$tmp" "$tgt" || { toc_die 2 "toc_replace_file error: toc_replace_file: Could not move [$tmp] to [$tgt]!" } return 0 } } # end toc_replace_file { toc_atfilter_file () { # uses the @-parser to filter a template file. # It returns !0 only if $TOC_ATSIGN_PARSER throws an error. # $1 = file containing properties to @-filter. # $2 = input template (e.g. toc_shared.make.at) # $3 = output file (e.g. toc_shared.make). It is only changed if # needed, so it is dependencies-safe. local pfile="$1" local tmpl="$2" local ofile="$3" test -f "$pfile" || toc_die $? "toc_atfilter_file: \$1: file not found: $pfile" test -f "$tmpl" || toc_die $? "toc_atfilter_file: \$2: file not found: $tmpl" local tmpfile=$ofile.tmp.toc_atfilter_file ${TOC_ATSIGN_PARSER} -f "$pfile" < "$tmpl" > "$tmpfile" || { local err=$? echo "toc_atfilter_file(): @-parsing failed: error $err " echo ${TOC_EMOTICON_ERROR} return $err } echo -n "$ofile ... " fstate="created" test -f "$ofile" && fstate="updated" toc_replace_file "$ofile" "$tmpfile" || fstate="up to date" echo "$fstate" return 0 } } # end toc_atfilter_file toc_makerelative () { # Makes a relative path from a pair of paths. # Usage: toc_makerelative /foo/bar/one/two /foo/bar # It tries to make a relative path from $1, which must # be a sub-path (or the same as) of $2. # Sets global var TOC_MAKERELATIVE to the "return value". # In the above example, it should = ./../.. local startat="${1-$PWD}" local relto="${2-${TOP_SRCDIR}}" test -n "$relto" || $relto="$PWD" test -f "$startat" && startat="$(dirname $startat)" local dn=$startat/bogus local dn="${dn%*/*}" local rel="." while test -n "$dn" -a "$dn" != "$relto" -a "$dn" != "/"; do rel="$rel/.." dn="${dn%*/*}" done TOC_MAKERELATIVE="${rel##./}" } toc_internal_format_endconfigure () { # internal helper to pretty up some output perl -ane '$| = 1; if( ! -f $F[0] ) { print; next; } $fn = $F[0]; $st = $_; $st =~ s|.*\.\.\.\s+||; write; format STDOUT = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<< $fn, $st . ' # come on... you gotta love perl! } toc_endconfigure () { # ends the configuration process, processing the files # which need to be @-parsed toc_boldecho "==== Creating configuration-dependent files..." { toc_test_require toc_make | toc_internal_format_endconfigure # toc_test_require toc_config_h | toc_internal_format_endconfigure } local clean="$(ls .toc.* 2> /dev/null)" test "x$clean" != x && rm $clean echo ========================================================================= # maintenance note: the above =====... is formatted to line up with the output # from toc_internal_format_endconfigure return 0 } toc_parseargs () { # parses $@ for arguments toc can work with. toc_debug "toc_parseargs: Handling command-line arguments: $@" # mostly stolen from the qt 3.1.0 configure script :) local i=0 local -a passon # clone of $@ to pass on to TOC_PARSEARGS_CALLBACK local configure_args local xtra= echo "$@" | grep -q \\--prefix= || xtra="--prefix=${prefix}" # while [ "$#" -gt 0 ]; do for arg in ${xtra} "$@"; do # local arg="$1"; shift passon[${i}]="$arg" i=$((i + 1)) local VAR= local VAL= #echo arg=$arg case $arg in --help|-?|--?|-help) cat<<-EOF Usage: $0 [--prefix=/path] [--argument=value] [--arg2=val2] ... Standard arguments include: EOF # ^^^^ note usage of hard tabs in the cat data! cat <<EOF | perl -ne '$|=1; next unless m|\w|; m/\t*(.*)\s*\|\s*(.*)/; print " $1\n\t\t$2\n";' --help or -? | Show this help. --help-tests | Show a selection list of test-specific help. --prefix=/path | Top-most path for installation. Default=${prefix} --enable-FEATURE=... | Exports config variable configure_enable_FEATURE. --enable-FEATURE | Equivalent to --enable-FEATURE=1. --disable-FEATURE | Equivalent to --enable-FEATURE=0. --with-FEATURE=... | Sets the config variable configure_with_FEATURE. --with-FEATURE | Equivalent to --with-FEATURE=1. --without-FEATURE | Equivalent to --with-FEATURE=0. --XXX=YYY | Exports config variable XXX=YYY. --XXX | Equivalent to --XXX=1. --toc-quiet,--quiet | Makes configure run more quietly. --toc-loud, --loud | configure will output some otherwise superfluous information. --verbose | Enables --loud and disables --quiet. --toc-fail-fast | Causes configure to abort if toc_test returns non-zero. --toc-debug | Enables debugging output in the configure framework. EOF # ^^^^ note usage of hard tabs in the cat data! cat <<EOF Many configure tests use --XXX and --with/enable-XXX. Try using --help-testname to get test-specific help. e.g. --help-gnu_cpp_tools or --help-zlib. (This does not work for all tests: try --help-tests if it does not work for a given test.) EOF local help=${TOP_SRCDIR}/toc.${PACKAGE_NAME}.help test -f $help && { echo -e "\nHelp options specific to ${PACKAGE_NAME}:\n" local foo=$(head -1 $help) local sh=${foo#\#\!} local hash=${foo%%\!*} test "x#" = "x$hash" -a "x$hash" != "x$sh" -a "x$sh" != "x" || { # lookie like no script of some sort. sh=cat } $sh $help echo "" # just for looks. } local help=toc.${PACKAGE_NAME}.help.sh test -f $help && { echo "" echo "Help options specific to this package:" cat $help echo "" # just for looks. } exit 0 ;; # finally end --help --prefix=*) # reserved. VAR=$(echo $arg | sed "s,^--\(.*\)=.*,\1,;") VAL=$(echo $arg | sed "s,^--.*=\(.*\),\1,") ;; --loud|--toc-loud) VAR=TOC_LOUD VAL=1 ;; --verbose) TOC_QUIET=0 TOC_LOUD=1 export TOC_QUIET TOC_LOUD ;; --quiet) VAR=TOC_QUIET VAL=1 ;; --TOC-[-_]*|--toc[-_]*) # reserved. VAR=$(echo $arg | sed "s,^--\(.*\)=.*,\1,;s,-,_,g;s/^__//;" | tr '[a-z\-]' '[A-Z_]') VAL=$(echo $arg | sed "s,^--.*=\(.*\),\1,;/^--/d;") test -n "$VAL" || VAL=1 ;; --enable-*=*|--with-*=*) # sets configure_with_XXX or configure_enable_XXX VAR=$(echo "$arg" | sed "s,^--\(.*\)=.*,\1,;s,-,_,g") VAL=$(echo "$arg" | sed "s,^--.*=\(.*\),\1,") VAR=configure_${VAR} ;; --enable-*|--with-*) # sets configure_with_XXX=1 or configure_enable_XXX=1 VAR=configure_$(echo $arg | sed "s,^--\(.*\),\1,;s,-,_,g") VAL=1 ;; --disable-*) # sets configure_enable_XXX=0 VAR=configure_$(echo $arg | sed "s,^--disable\(.*\),enable\1,;s,-,_,g") # This needs to be 0, not "", because otherwise you wind up # with "#define HAVE_FOO" when it's been unset, which is not # desirable. This way, at least you get "#define HAVE_FOO 0". VAL=0 ;; --without-*) # sets configure_with_XXX=0 VAR=configure_$(echo $arg | sed "s,^--without\(.*\),with\1,;s,-,_,g") # This needs to be 0, not "", because otherwise you wind up # with "#define HAVE_FOO" when it's been unset, which is not # desirable. This way, at least you get "#define HAVE_FOO 0". VAL=0 export $VAR="$VAL" ;; --*=*) # SOOOOOOO arguable # sets XXX=YYY VAR=$(echo $arg | sed "s,^--\(.*\)=.*,\1,;s,-,_,g") VAL=$(echo $arg | sed "s,^--.*=\(.*\),\1,") ;; --*) # this is soooooo arguable # sets XXX=1 VAR=$(echo $arg | sed "s,^--\(.*\),\1,;s,-,_,g;") VAL=1 ;; *) toc_boldecho "WARNING: unrecognized option: $arg" ;; esac toc_debug toc_parseargs: $arg "VAR=$VAR VAL=$VAL" test -n "$VAR" -a -n "$VAL" && { toc_debug "toc_parseargs: exporting [$VAR]=$VAL" export $VAR="$VAL" toc_export "$VAR=$VAL" # foo=$(echo $VAL | sed -e "s,',\\\\',g") configure_args="$configure_args --$VAR=\"$VAL\"" } done toc_add_config CONFIGURE_ARGUMENTS="$configure_args" # <---- !!!!experimental!!!! test "x${TOC_PARSEARGS_CALLBACK}" != "x" && { ${TOC_PARSEARGS_CALLBACK} "${passon[@]}" return $? } return 0 } # end parseargs # We do some initial sanity checking here, # but any tree-specific checks must be done from configure. toc_parseargs "$@" # WTF??? toc_get_make prefix || toc_add_config prefix=${prefix} toc_loudly 'Loud mode enabled.' toc_source_test toc_tests_help || exit 0 echo "Configuring build environment." toc_quietly <<-EOF ${TOC_BOLD_}Emoticon legend:${_TOC_BOLD} ${TOC_EMOTICON_OKAY} Good News. ${TOC_EMOTICON_ERROR} Bad News. ${TOC_EMOTICON_WARNING} A warning, possibly even Bad News, but we do not yet know if it is fatal: this is build tree dependent. Note that not all config test failures are fatal: it will stop if it fails a test which it /needs/ to pass. EOF # . ${TOC_HOME}/tests/toc_core_tests.sh || { toc_test_require toc_core_tests || { err=$? echo "Core toc sanity test failed (err=$err). This tree is not toc-capable. ${TOC_EMOTICON_ERROR}" exit $err } toc_grep_tests() { # a client-helper func to grep a list of toc test names from an input file. # It echos the list of tests test -z "$1" && toc_die 1 "toc_grep_tests: error: \$1 must be a filename." sed -n -e 's/^ *//;/^toc_test/p;' $1 | cut -d' ' -f 2 } # toc_add_make TOC_CLEAN_FILES="" return 0 --- NEW FILE: configure.sample --- #!/bin/sh # you must set PACKAGE_NAME and PACKAGE_VERSION, and their values # must be filesystem-friendly (i.e., only alph-numeric, dots and underscores) # because they are used to create various files (e.g. mypackage-1.0.7.tar.gz) PACKAGE_NAME= PACKAGE_VERSION= # my preference:: ${PACKAGE_VERSION-$(date +%Y%m%d)} export PACKAGE_NAME PACKAGE_VERSION # toconfigure kicks off the core toc process, which eventually calls # configure.${PACKAGE_NAME}. Do all of your package-specific # checks in configure.${PACKAGE_NAME}. . toc/sbin/toconfigure $@ --- NEW FILE: Makefile --- #!/usr/bin/make -f include toc.make DIST_FILES += toc_core.sh toconfigure --- NEW FILE: toconfigure --- #!/do/not/bash # Source tree configure script, toc-style. # The latest code is at http://toc.sourceforge.net/ # # Do not run this directly: wrap it up in a script called 'configure', # stick it into your top-level build tree, set some environment vars, # and source it. See the configure from the toc distribution for a # quick starting point. # # Requires the the Bourne Again SHell, GNU Make, plus a skew of other open-source utilities # which are typically installed on any Unix-type system. # # $Revision: 1.1 $ # # This whole thing is subject to change at any minute. # # Notes about this configure process: # Project-wide vars are currently defined in: # - this file # - toc.${PACKAGE_NAME}.make.at # - And check the top-level Makefile, to be certain :/ # # # Any options you pass on the command line, like: # ./configure --prefix=/opt # will be filtered through the shared makefile and config.h. # # This tool still requires quite a few things, but it will not aim to be all things # to all projects. Customize as you see fit. # # Note: there are no guarantees that any exit codes mean anything specific! test -z "${PACKAGE_VERSION}" -a -z "${PACKAGE_NAME}" && { echo "toconfigure: environment vars PACKAGE_NAME and PACKAGE_VERSION must be set." exit 1 } configure=configure test -f "$configure" || { echo "toconfigure: could not find [$configure]!" exit 2 } grep -i "toc" $configure > /dev/null || { # this is kind of a callback, actually, since we should only be # sourced from configure. echo "Your configure script does not appear to be toc-aware. It shouldn't be sourcing this file." exit 3 } TOP_SRCDIR=${PWD} TOC_HOME=${TOC_HOME-"${TOP_SRCDIR}/toc"} test -d "${TOC_HOME}" || { echo "The toc home directory, TOC_HOME, not found. Set that variable to the top-most path to your toc installation, or unset it to use the default of ./toc" exit 4 } export TOP_SRCDIR export TOC_HOME export PATH=${TOC_HOME}/bin:${PATH} { # set up the core CORE_SH=${TOC_HOME}/sbin/toc_core.sh . ${CORE_SH} "$@" || { # core toc functions and initial sanity test echo "toconfigure: Pain! Suffering! Loading ${CORE_SH} failed!" exit 5 } } test x1 = "x${new_project}" && { # ./configure --new-project cat <<EOF ********************************************************************** Creating Makefile stubs for new project! This process will create a file called Makefile.suggestion in each subdirectory. These files may be renamed to Makefile and tweaked to suit the needs of your project. ********************************************************************** EOF echo "Press ENTER to continue or Ctrl-C to quit." read ${TOC_HOME}/bin/create_makefile_stubs.sh return } toc_export PACKAGE_NAME="${PACKAGE_NAME}" toc_export PACKAGE_VERSION="${PACKAGE_VERSION}" toc_export TOC_HOME="${TOC_HOME}" toc_export TOC_EMOTICON_OKAY=${TOC_EMOTICON_OKAY} toc_export TOC_EMOTICON_ERROR=${TOC_EMOTICON_ERROR} toc_export TOC_EMOTICON_WARNING=${TOC_EMOTICON_WARNING} # include package-specific configure script. This eases upgrading a project's toc: pkgconfig=${PACKAGE_CONFIGURE_SCRIPT-configure.${PACKAGE_NAME}} test -f $pkgconfig && { . $pkgconfig err=$? test $err -eq 0 || { echo "toconfigure: error: $pkgconfig returned [non-zero] error code $err." exit $err } } # toc_test toc_project_makefile "Looking for toc.${PACKAGE_NAME}.make" toc_add_config SHELL=$(which bash) # toc_test_require toc_configure_finalcheck # toc_configre_finalcheck is arguable :/ ##### end the configuration process and write out our files... toc_endconfigure # if $POSTCONFIG exists it is run as our final step: POSTCONFIG=${TOP_SRCDIR}/postconfig.${PACKAGE_NAME} test -f ${POSTCONFIG} && { . ${POSTCONFIG} || { err=$? echo "${POSTCONFIG} returned non-zero exit status: $?" return $err } } package_configure=${TOP_SRCDIR}/toc.${PACKAGE_NAME}.configure.make toc_dump_make_properties | perl -pe 's|^(\w+)=|$1 ?= |' > ${package_configure} find . -type f -name '.toc.*' | xargs rm -f &>/dev/null # these sometimes cause weird behaviour after a reconfigure cat <<-EOF ========================================================================= ${TOC_EMOTICON_OKAY} Build configuration complete. You may now run make (or gmake). Be sure to read any messages from the tests run by configure. ========================================================================= EOF # ^^^^ note the intentional use of hard tabs in the cat <<-EOF, above. |
Update of /cvsroot/pclasses/pclasses2/toc/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6599/tests Added Files: atfilter_file.sh awk.sh boost.sh bzlib.sh check_dist_md5s.sh compiler_cpp.sh create_pkg-config_data.sh cvs_tools.sh doxygen.sh find_appconfig.sh find_header.sh flex.sh gcc_build_and_run.sh gcc_try_compile.sh gnu_cpp_tools.sh gnu_find.sh gnu_install.sh gnu_make.sh gnu_tar.sh gzip.sh libdl.sh libeditline.sh libexpat.sh libltdl.sh libs11n.sh lyxport.sh Makefile mysql_clients.sh mysql_server.sh PACKAGE_NAME-config.at PACKAGE_NAME-config.sh pclasses.sh perl.sh qt.sh readline.sh running_under_cygwin.sh sed.sh toc_config_h.sh toc_configure_finalcheck.sh toc_core_tests.sh toc_make.sh toc_project_makefile.sh toc_tests_help.sh use_ccdv.sh user_is_stephan_beal.sh zlib.sh Log Message: egg --- NEW FILE: gcc_try_compile.sh --- # toc_run_description = $@ # # 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 compiler, such as -I/some/path. # # 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_test_require gcc_try_compile 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 #test x"$@" = x && { # ^^^ this no workie when, e.g., -I... is passed in, because -I is a flag used by test :/ # echo "usage: try_compile cc_flag|file1.{c,cpp...} [cc_flag|file2...]" # return 1 #} 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.try_compile dotofile=$tmpprefix.o compiler_out=$tmpprefix.out cmd="$CC ${INCLUDES} $@ -c -o $dotofile" echo $cmd > $compiler_out $cmd >> $compiler_out 2>&1 err=$? test -f $dotofile && rm $dotofile test $err != 0 && { echo "Compiler output is in $compiler_out (but will be erased the next time this test is run!)." } || { rm $compiler_out } return $err --- NEW FILE: gnu_tar.sh --- # toc_run_description = search for a genuine GNU tar # toc_begin_help = # Looks for a genuine GNU tar. It first looks for gtar, and then tar, and checks # the binary to see if it is a GNU version. # It honors the configure argument --with-tar=/path/to/tar. # # Exports: # - TAR_BIN=/path/to/tar (or empty string) # - TAR=/path/to/tar (same as TAR_BIN, but deprecated) # # = toc_end_help toc_export TAR= toc_export TAR_BIN= gtar=${configure_with_TAR-gtar} toc_find $gtar || toc_find tar || { echo "tar/gtar not found in PATH" return 1 } gtar=$TOC_FIND_RESULT "$gtar" --version | grep -i GNU > /dev/null || { echo "Your 'tar' ($gtar) appears to be non-GNU." return 1 } toc_find ${TOC_HOME}/make/TARBALL.make toc_export TARBALL_MAKE=${TOC_FIND_RESULT} toc_export TAR=$gtar toc_export TAR_BIN=$gtar return 0 --- NEW FILE: qt.sh --- # toc_run_description = looking for Qt $1 # toc_begin_help = # Calls toc_export for the following: # - QTINCDIR directory containing Qt headers # - QTLIBDIR directory containing Qt libraries # - QTBINDIR directory containing Qt tools (moc, uic, etc.) # - LQT set to "-lqt" # - UIC /path/to/uic # - MOC /path/to/moc # - QMAKE /path/to/qmake # - QT_INCLUDES -I/path/to/Qt/includes # - QT_LDFLAGS -L/path/to/Qt/libs # Also, QTINCDIR, QTLIBDIR, and QTBINDIR are set in the environment. Note # that this intentionally does not set QTDIR, to keep you from using # $QTDIR/bin etc. instead of the QTBINDIR which might have been specified # by the user. # # If you need a specific version of Qt, set both of the following variables # before running this test: # qt_required_version - human-readable version number like "3.1.x" # qt_required_version_glob - version glob like "3.1.*" # Optionally, pass the version as $1 and glob as $2 (be sure to quote the # glob!). # = toc_end_help qt_required_version_version=${1-${qt_required_version_version-'3.x'}} qt_required_version_glob=${2-${qt_required_version_glob-'3.*'}} qt_check_dir () { local var=$1 local dir=$2 local contents=$3 if test -z "$dir"; then cat<<EOF $var environment variable not set, and --with-${var}=... not passed! Use one or the other to point to your Qt $contents, or QTDIR or --with-QTDIR=... to point to the top of your Qt installation. EOF return 1 fi if test -d $dir; then # life is tolerable return 0 else cat<<EOF Directory $dir does not exist! Set the $var environment variable, or pass --with-${var}=... to point to your Qt $contents, or QTDIR or --with-QTDIR=... to point to the top of your Qt installation. EOF return 1 fi } # Use --with-QTDIR=... if we got it; otherwise default to $QTDIR. QTDIR=${configure_with_QTDIR-$QTDIR} toc_export configure_with_qt=0 toc_export HAVE_QT=0 if test -z "${QTDIR}"; then echo "error: either set QTDIR or pass in --with-QTDIR=/path/to/qt" return 1 fi # QTINCDIR/QTLIBDIR/QTBINDIR can be specified independently, in the # environment or on the command line, or we can guess them from QTDIR. QTINCDIR=${configure_with_QTINCDIR-${QTINCDIR-${QTDIR+$QTDIR/include}}} QTLIBDIR=${configure_with_QTLIBDIR-${QTLIBDIR-${QTDIR+$QTDIR/lib}}} QTBINDIR=${configure_with_QTBINDIR-${QTBINDIR-${QTDIR+$QTDIR/bin}}} qt_check_dir QTINCDIR "$QTINCDIR" headers || return 1 qt_check_dir QTLIBDIR "$QTLIBDIR" libraries || return 1 qt_check_dir QTBINDIR "$QTBINDIR" executables || return 1 if test -n "$qt_required_version"; then # This has to be libqt*.so, not libqt.so, because in some cases you # have only libqt-mt.so.x.y.z, and libqt.so is a symlink to that, and # there are no libqt.so.x.y.z symlinks. (At least that's the way it # is with Qt 3.1.1 built from source on my RedHat 8.0 box.) ls $QTLIBDIR/libqt*.so.${qt_required_version_glob} > /dev/null 2>&1 || { echo "Qt $qt_required_version (libqt*.so.$qt_required_version_glob) not found in $QTLIBDIR!" return 1 } echo "Found Qt $qt_required_version at ${QTLIBDIR}" fi export QTDIR export QTINCDIR export QTLIBDIR export QTBINDIR toc_export QTDIR=$QTDIR toc_export QTINCDIR=$QTINCDIR toc_export QTLIBDIR=$QTLIBDIR toc_export QTBINDIR=$QTBINDIR toc_export LQT=-lqt toc_export UIC=${UIC:-$QTBINDIR/uic} toc_export MOC=${MOC:-$QTBINDIR/moc} toc_export QMAKE=${QMAKE:-$QTBINDIR/qmake} toc_export QT_INCLUDES="-I${QTINCDIR}" toc_export QT_LDFLAGS="-L${QTLIBDIR}" configure_with_qt=1 toc_export configure_with_qt=1 toc_export HAVE_QT=1 return 0 --- NEW FILE: Makefile --- SUBDIRS = cpp c include toc.make DIST_FILES += $(wildcard *.sh *.at) all: subdirs --- NEW FILE: libs11n.sh --- #!/do/not/bash # toc_run_description = looking for libs11n-config # # toc_begin_help = # Looks for libs11n (available from s11n.net). Use --s11n-prefix # to set the prefix under which s11n should be found. e.g.: # # ./configure --s11n-prefix=/usr/local # # Optionally, pass the prefix to this test as $1. The default prefix is ${prefix}. # # Only works with libs11n 0.9 or higher. # # This test exports the following config vars: # # - LIBS11N_PREFIX: an empty value if the test fails or s11n's # installation prefix if the test passes. # # - LIBS11N_CLIENT_LDADD: an empty value or: # -L${LIBS11N_PREFIX}/lib -ls11n [possibly also -lz -lbz] # (This should arguably contain -export-dynamic, but clients are expected # to use that, anyway.) # # - LIBS11N_CLIENT_INCLUDES: an INCLUDES-compatible entry, like -I${LIBS11N_PREFIX}/include # # - LIBS11N_LIBRARY_VERSION: the string which is returned by s11n::library_version(). # # - LIBS11N_CONFIG=/path/to/libs11n-config # # = toc_end_help s11n_path=${1-${s11n_prefix-${prefix}}}:${prefix}/bin:${PATH} toc_find libs11n-config $s11n_path || { echo "libs11n-config not found in [$s11n_path]." unset s11n_path return 1 } s11nconfig=${TOC_FIND_RESULT} toc_export LIBS11N_PREFIX=$($s11nconfig --prefix) toc_export LIBS11N_CONFIG=$s11nconfig eval $($s11nconfig --toc-config | sed -e 's/$/; /') unset s11nconfig return 0 --- NEW FILE: boost.sh --- # toc_run_description = looking for boost headers # toc_begin_help = # # Looks for headers for the boost C++ libraries (www.boost.org). # # Requires --with-boost=/path/to/boost or one of the environment vars # ${configure_with_boost} or ${BOOST_HOME}, which must point to the # top-most directory of the boost tree (e.g., the boost source # distribution tree). If this is not set then it checks some common # paths for Boost. For example, if boost lives under # /usr/dev/include/boost, you should set BOOST_HOME=/usr/dev/include # or pass in --with-boost=/usr/dev/include. # # It does not check for boost code which requires compilation, only # some common headers files. # # It calls toc_export for these config vars: # # - HAVE_BOOST = zero or one # - BOOST_HOME = directory ABOVE the boost headers dir, or empty if # HAVE_BOOST is zero. # # It accepts an optional list of boost headers to check, which should # be given as relative paths, assuming a top path of ${BOOST_HOME}. # # = toc_end_help if test x1 = "x${configure_with_boost}"; then configure_with_boost=${BOOST_HOME-${prefix}/include} fi toc_export BOOST_HOME= toc_export HAVE_BOOST=0 test x0 = "x${configure_with_boost}" && { echo "Boost has been explicitely disabled via --without-boost." return 0 } if test x != "${configure_with_boost}"; then checkp="${configure_with_boost}" else checkp="$prefix/include /usr/include /usr/local/include $HOME/include" fi boostpath= for p in $checkp; do test -d $p/boost && { boostpath=$p/boost break } done echo boostpath=$boostpath if test "x$boostpath" = x; then echo "--with-boost=/path/to/boost not set or does not point to a valid boost directory, " echo "and boost includes dir not found in path [$checkp]." unset boostpath unset checkp return 1 fi unset checkp for i in ${@-version.hpp config.hpp}; do toc_find $i $boostpath || { unset boostpath return 1 } done boostpath=${boostpath%%/boost} toc_export HAVE_BOOST=1 toc_export BOOST_HOME="$boostpath" unset boostpath return 0 --- NEW FILE: perl.sh --- # perl? toc_find perl || return toc_add_make PERL=${TOC_FIND_RESULT} --- NEW FILE: libdl.sh --- # toc_run_description = looking for libdl # toc_begin_help = # # Looks for libdl. It calls toc_export # for the following variables: # # HAVE_LIBDL = 0 or 1 # LDADD_LIBDL = empty or "-ldl -rdynamic" # LDADD_DL = empty or "-ldl -rdynamic", possibly with -L/path... # # Note that LDADD_LIBDL is specific to the libdl test, whereas LDADD_DL is used # by both the libdl and libltdl tests. # # = toc_end_help toc_add_config HAVE_LIBDL=0 toc_add_config LDADD_LIBDL= toc_export LDADD_DL= err=1 toc_test gcc_build_and_run ${TOC_HOME}/tests/c/check_for_dlopen_and_friends.c -rdynamic -ldl && { err=0 toc_export HAVE_LIBDL=1 toc_export LDADD_LIBDL="-ldl -rdynamic" toc_export LDADD_DL="${LDADD_LIBDL}" } return $err --- NEW FILE: gcc_build_and_run.sh --- # toc_run_description = $@ # # 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 compiler, 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_test_require gcc_build_and_run 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: toc_tests_help.sh --- #!/do/not/bash # toc_run_description = checks for --help-X and tries to do something about it. # toc_begin_help = # # toc_tests_help looks for vars named help_* and tries to find help text for # tests matching that pattern (that is, help_foo looks for help for test foo). # To add help to your test wrap it in a block which begins with # the text 'toc_begin_help =' and end it with '= toc_end_help' # # This test returns zero only if no --help-X options are specified. # # The --help-TESTNAME options do not properly work with tests which: # # - do not live directly in toc/tests # - contain minus signs in their names # # The workaround is to use --help-tests, which will provide you with a selection # list of all tests under toc/tests and it's subdirectories. # # = toc_end_help toc_show_test_help () { local scr=${1?first argument must be a filename} test -f $scr || toc_die 127 "Test $scr not found!" sed -n '/^# *toc_begin_help *=/,/^#\ *= *toc_end_help/p' $scr | \ sed '/^# *toc_begin_help *=/d;/^# *= *toc_end_help/d;s/^# */ /;' } toc_select_test_help () { local tests=$(cd ${TOC_HOME}/tests; find . -type f -name '*.sh' | xargs grep -l toc_begin_help | sort | sed -e "s,\./,,;s,\.sh,,;") PS3="Select a test to show it's help: " select T in $tests; do echo "Help for '$T' test:" toc_show_test_help ${TOC_HOME}/tests/${T}.sh break # i'd like to loop, but the selection list is only shown on the first run, # and quickly scrolls off the screen, making a 'break' the only usable option. done } if test x1 = x${help_tests} ; then toc_select_test_help return 1 fi helps="$(env | grep '^help_')" test -n "$helps" || return 0 for h in $helps; do test=${h##help_} test=${test%%=*} echo "help: $test" toc_find_test $test || { echo "Error: cannot find test $test." return 1 } scr=${TOC_FIND_RESULT} grep -q "toc_begin_help" $scr || { echo "No help text found." continue } toc_show_test_help $scr done return 1 --- NEW FILE: gnu_cpp_tools.sh --- # toc_run_description = looking for GNU C/C++ compiler/linker tools. # toc_begin_help = # It takes the following configure arguments: # --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-warn causes stuff to be built -Wall. To turn on -Werror, do: --enable-warn="-Wall -Werror" etc. # --enable-werror same as --enable-warn="-Wall -Werror" # # It calls toc_export for the following: # - CC /path/to/gcc? # - LD /path/to/ld # - LDD /path/to/ldd # - CXX /path/to/g++ # - AR /path/to/ar # - NM /path/to/nm (optional component) # - STRIP /path/to/strip (optional component) # - INCLUDES probably empty # - CPPFLAGS probably empty # - OPT -g or -O2 (or some other value specified by --enable-debug) # - CFLAGS_OPT same as OPT (prefered for naming's sake) # - WARN -Wall (or some other value specified by --enable-warn or --enable-werror) # - CFLAGS probably empty (or maybe -pipe) # - CXXFLAGS probably empty (or maybe -pipe) # - LDFLAGS probably empty # = toc_end_help CC= for foo in \ ar-AR gcc-CC g++-CXX ld-LD ldd-LDD \ ; do key=${foo%%-*} var=${foo##*-} toc_find $key || { echo "Couldn't find required app: $key in PATH [$PATH]" return 1 } toc_export $var=${TOC_FIND_RESULT} done for foo in \ nm-NM strip-STRIP \ ; do key=${foo%%-*} var=${foo##*-} toc_find $key toc_add_make $var="${TOC_FIND_RESULT}" done toc_add_make INCLUDES="$INCLUDES" toc_add_make CPPFLAGS="$CPPFLAGS" if test "$configure_enable_debug" = 1; then 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 -DNDEBUG=1" else # They specified some flags. OPT="$configure_enable_debug" fi toc_add_make OPT="$OPT" toc_add_make CFLAGS_OPT="$OPT" if test "$configure_enable_warn" = 1; then WARN="-Wall $WARN" elif test "${configure_enable_warn:-0}" = 0; then WARN= else # They specified some flags. WARN="$configure_enable_warn" fi if test "x$configure_enable_werror" != x0; then if test "x$configure_enable_werror" = x1; then WARN="-Wall -Werror $WARN" else WARN="$WARN $configure_enable_werror" fi fi toc_add_make WARN="$WARN" # Presumably we could determine whether -pipe works instead of assuming # it does... CFLAGS="-pipe $CFLAGS" CXXFLAGS="-pipe $CXXFLAGS" toc_add_make CFLAGS="$CFLAGS" toc_add_make CXXFLAGS="$CXXFLAGS" toc_add_make LDFLAGS="$LDFLAGS" --- NEW FILE: mysql_clients.sh --- # toc_run_description = looking for mysql clients # toc_begin_help = # Looks for mysql client apps and sets the following config vars: # HAVE_MYSQL_CLIENTS=1 or 0 # MYSQL=/path/to/mysql # MYSQLADMIN=/path/to/mysqladmin # MYSQLDUMP=/path/to/mysqldump # = toc_end_help toc_add_config MYSQL= toc_add_config MYSQLDUMP= toc_add_config MYSQLADMIN= toc_add_config HAVE_MYSQL_CLIENTS=0 if test "x${configure_with_mysql}" = "x0"; then echo "mysql checks have been explicitely disabled." return 0 fi ret=0 path="${configure_with_mysql-${PATH}}" test "x$path" = "x1" && path="${PATH}" for x in \ mysql=MYSQL \ mysqladmin=MYSQLADMIN \ mysqldump=MYSQLDUMP \ ; do f=${x%%=*} v=${x##*=} # echo search path=$path toc_find $f "$path" err=$? if test $err = 0; then bin="${TOC_FIND_RESULT}" else ret=1 bin= fi toc_add_config $v="${bin}" done test $ret = 0 && { toc_add_config HAVE_MYSQL_CLIENTS=1 } return $ret --- NEW FILE: compiler_cpp.sh --- for foo in \ gcc cc \ ; do toc_find $foo || continue CC=${TOC_RUN_FIND_FAILOK} echo C compiler: ${TOC_RUN_FIND_FAILOK} break done for foo in \ g++ gcc c++ \ ; do toc_find $foo || continue CXX=${TOC_RUN_FIND_FAILOK} echo C++ compiler: ${TOC_RUN_FIND_FAILOK} break done export CC CXX toc_add_make CC=${CC} toc_add_make CXX=${CXX} return 0 --- NEW FILE: PACKAGE_NAME-config.sh --- #!/do/not/bash # toc_run_description = creating ${PACKAGE_NAME}-config # toc_begin_help = # # This test creates a script, ${top_srcdir}/${PACKAGE_NAME}-config, # useful for trees building libraries. Clients of your library (in # particular, their configure scripts) can get information about how # to compile and link against your library via this script. # # Sample usage: # toc_test_require package_config infile \ # PACKAGE_PREFIX=LIBMYLIB_ \ # CLIENT_LDADD="-L${prefix}/lib -lmylib" \ # CLIENT_INCLUDES="-I${prefix}/include" # # # All variables passed to this test are passed directly on to # ${TOC_HOME}/bin/atsign_parse, with the exception of $1: if $1 is an # existing file it is stripped from the list and use as an input # template, otherwise it is passed on. # # A default template file for the script is provided with this test, # toc/tests/PACKAGE_NAME-config.at, and it is used if $1 is not an # existing file. The default template depends on the arguments # show in the usage sample above. Client-provided templates can # of course use whatever variables they like. # # In the default template, PACKAGE_PREFIX is a prefix which gets # prepended to some variable names in the output, to allow # package-config scripts from multiple libraries to produce # non-colliding output. This value must be a single token, and should # probably be something like LIBMYLIB_. # # Run the generated ${PACKAGE_NAME}-config script to see # what it does. # # Remember to add ${PACKAGE_NAME}-config to the INSTALL_BINS # and DISTCLEAN_FILES variables in your ${top_srcdir}/Makefile! # # = toc_end_help infile="$1" if [ ! -e "$infile" ] ; then infile=${TOC_HOME}/tests/PACKAGE_NAME-config.at else shift fi ofile=${PACKAGE_NAME}-config ${TOC_HOME}/bin/atsign_parse \ PACKAGE_NAME="${PACKAGE_NAME}" \ PACKAGE_VERSION="${PACKAGE_VERSION}" \ prefix="${prefix}" \ "$@" \ < $infile > ${ofile} || { err=$? echo "Error filtering $infile to $ofile!" return $err } chmod +x ${ofile} --- NEW FILE: gnu_make.sh --- # toc_run_description = search for a genuine GNU make, the Make of makes. toc_find gmake || toc_find make || return toc_export MAKE=${TOC_FIND_RESULT} "$MAKE" --version | grep -qi GNU || { echo "Your make appears to be non-GNU." return 1 } --- NEW FILE: libeditline.sh --- # toc_run_description = looking for liblineedit # toc_begin_help = # Searches for liblineedit, a BSD-licensed replacement for GNU libreadline. # #Use --without-libeditline to explicitely disable libeditline support. # #toc_export is called for the following variables: # # HAVE_EDITLINE = 0 or 1 # # LIBEDITLINE_LDADD = empty or -leditline, possibly with -lncurses # # = toc_end_help toc_export HAVE_EDITLINE=0 toc_export LIBEDITLINE_LDADD= configure_with_libeditline=${configure_with_libeditline-1} test "x${configure_with_libeditline}" = "x0" && { echo "libeditline has been explictely disabled with --without-libeditline." return 0 } _libpath=/usr/lib:/usr/local/lib:${prefix}/lib:/lib _do=0 for L in libeditline.so libeditline.a; do toc_find $L "$_libpath" && { _do=1 break } done test x$_do = x0 && { echo "libeditline library file not found." unset _do unset _libpath return 0 } rllib=${TOC_FIND_RESULT} rlincpath=/usr/include:/usr/include/editline:/usr/local/include:/usr/local/include/editline:${prefix}/include:${prefix}/include/editline for inc in editline.h; do toc_find $inc $rlincpath || { err=$? echo "Header file $inc not found in path [$rlincpath]" unset rlincpath unset rllib return $err } done unset rlincpath LIBEDITLINE_LDADD="-leditline" # odd: lineedit sources never included curses.h, but do use curses functions, # leading to an unknown symbol in your app if we don't tell you that you need # to link against curses: #if ldd $rllib 2> /dev/null | grep ncurses &>/dev/null ; then # echo "It seems that libeditline also requires linking against -lncurses." LIBEDITLINE_LDADD="${LIBEDITLINE_LDADD} -lncurses" #fi toc_export HAVE_EDITLINE=1 toc_export LIBEDITLINE_LDADD="${LIBEDITLINE_LDADD}" unset nc return 0 --- NEW FILE: awk.sh --- # toc_run_description = looking for gawk/awk/nawk err=0 toc_find gawk || toc_find awk || toc_find nawk || err=1 toc_add_make AWK=$TOC_FIND_RESULT return $err --- NEW FILE: flex.sh --- # toc_run_description = looking for GNU flex # toc_begin_help = # Looks for flex in $1 (defaults to $PATH) and FlexLexer.h # in some common paths. It calls toc_export for the following # variables: # # FLEX=/path/to/flex (maybe empty) # FLEX_BIN= same thing, but preferred for style's sake # FLEXLEXER_H=/path/to/FlexLexer.h # # It honors the following configure arguments: # # --with-flex=/path/to/flex # --with-flexlexer=/path/to/FlexLexer.h # --without-flex sets FLEX to an empty string. # # It returns zero if flex is found, else non-zero. # A missing FlexLexer.h is not considered an error, since it # is only useful for C++ # # = toc_end_help if [ x0 = x${configure_with_flex-1} ]; then echo "Explicitely disabled via --without-flex." toc_export FLEX= toc_export FLEX_BIN= toc_export FLEXLEXER_H= return 0 fi toc_find ${configure_with_flex-flex} flex ${1-${PATH}} err=$? toc_export FLEX=${TOC_FIND_RESULT} toc_export FLEX_BIN=${TOC_FIND_RESULT} toc_find ${configure_with_flexlexer-FlexLexer.h} /usr/include:/usr/local/include:$PWD/include toc_export FLEXLEXER_H=${TOC_FIND_RESULT} return $err --- NEW FILE: pclasses.sh --- #!/do/not/bash # toc_run_description = checking for P::Classes libs and headers... # toc_begin_help = # Checks for the existance of the P::Classes libs and headers. # # Exports the following variables: # # HAVE_PCLASSES = 0 or 1 # # PCLASSES_LDADD = -Lpclasses_prefix -l... (each pXXX lib) # # = toc_end_help paths="${configure_with_pclasses-${prefix}}:/usr:/usr/local:$HOME" toc_debug "pclasses search path=[$paths]" ret=0 pprefix= for H in pany.h psqldriver.h piomanager.h; do toc_find include/pclasses/$H "$paths" || { ret=1 break } test x != "x${pprefix}" && continue pprefix="${TOC_FIND_RESULT%%/include/pclasses/*}" done pldadd="" for L in pcore pcrypto pio pnet psql; do toc_find lib/lib${L}.so "$paths" || { ret=1 break } pldadd="${pldadd} -l$L" done toc_export PCLASSES_PREFIX="${pprefix}" test 0 = $ret && { toc_export PCLASSES_LDADD="-L${pprefix}/lib -L${pprefix}/lib/pclasses ${pldadd}" toc_export HAVE_PCLASSES=1 } || { toc_export HAVE_PCLASSES=0 } unset pldadd paths pprefix return $ret --- NEW FILE: toc_project_makefile.sh --- # Creates toc.${PACKAGE_NAME}.make from toc.${PACKAGE_NAME}.make.at # This file is sought by toc.make (but is always optional) mf=${1-toc.${PACKAGE_NAME}.make} tmpl=$mf.at test -f $tmpl || { toc_add_make toc_include_project_makefile=0 echo "No project-specific makefile found at [$mf]." echo "This is /probably/ not a problem." return 1 } toc_atfilter_as_makefile $tmpl $mf || { err=$? echo "Error filtering $tmpl!" return $err } # toc_add_make toc_include_project_makefile="\$(top_srcdir)/${mf}" --- NEW FILE: libexpat.sh --- #!/do/not/bash # toc_run_description = checking for expat XML parser... # toc_begin_help = # # Exports the variable HAVE_LIBEXPAT to 0 or 1. # If --without-libexpat is passed to configure then this test # sets HAVE_LIBEXPAT to 0 and returns success. # # = toc_end_help if [ x0 = "x${configure_with_libexpat}" ]; then echo "libexpat disabled explicitely with --without-libexpat." toc_export HAVE_LIBEXPAT=0 return 0 fi src=check4expat.c cat <<EOF > $src // taken from expat's outline.c example, expat 1.95.7 #include <stdio.h> #include <expat.h> #define BUFFSIZE 8192 char Buff[BUFFSIZE]; int Depth; static void XMLCALL start(void *data, const char *el, const char **attr) {} static void XMLCALL end(void *data, const char *el) {} int main(int argc, char *argv[]) { XML_Parser p = XML_ParserCreate(NULL); if (! p) { fprintf(stderr, "Couldn't allocate memory for parser\n"); exit(-1); } XML_SetElementHandler(p, start, end); return 0; } EOF workie=1 toc_test gcc_build_and_run $src -lexpat || workie=0 rm $src toc_export HAVE_LIBEXPAT=${workie} unset workie test 1 = ${HAVE_LIBEXPAT} return $? --- NEW FILE: create_pkg-config_data.sh --- #!/do/not/bash # toc_run_description = creating ${PACKAGE_NAME}.pc # toc_begin_help = # # This test creates a data file for pkg-config, useful for trees # building libraries. With this data clients of your library can get # information about how to compile and link against your library via # the pkg-config tool. # The output file is called ./${PACKAGE_NAME}.pc, and should be added # to the top-level makefile's INSTALL_PKGCONFIG and DISTCLEAN_FILES vars. # It will be installed to ${prefix}/lib/pkgconfig. # Sample usage: # toc_test_require create_pkg-config # Please see 'man pkg-config' for more information about pkg-config # conventions. # This test makes use of the following environment variables: # # - PACKAGE_FRIENDLY_NAME = a "friendly-form" name of the package. # Defaults to the toc-conventional PACKAGE_NAME. # # - PACKAGE_VERSION = toc-conventional # # - PACKAGE_DESCRIPTION = a description of the package. e.g., "A tool to # do Blah." # # - PACKAGE_LDADD = list of linker flags required to link against this # package, include -L and -l options. e.g. -L/usr/X11R6/lib # Note that -L${prefix}/lib is automatically added ONLY if this # var is NOT set. # Corresponds to pkg-config's Libs entry. # # - PACKAGE_CFLAGS = list of C preprocessor flags needed to compile # against this package. e.g., -I/usr/X11R6/include # Note that -I${prefix}/include is automatically added ONLY if this # var is NOT set. # Corresponds to pkg-config's CFlags entry. # # - PACKAGE_CONFLICTS = pkg-config 'Conflicts:' info string # # - PACKAGE_REQUIRES = pkg-config 'Requires:' info string # # Note that configure code may need append additional information to # the output to the generated file, like "my_module_version", and # other not-always-used entries. # # Achtung: this test will return with an error in some cases even # when it creates the output file. For example, if PACKAGE_DESCRIPTION # is not set then it will do so, primarily to verbosely warn the user # to set it. # # Remember to add ${PACKAGE_NAME}.pc to the INSTALL_PKGCONFIG # and DISTCLEAN_FILES variables in your ${top_srcdir}/Makefile! # # = toc_end_help _ret=0 for i in PACKAGE_DESCRIPTION; do test x = "x$(eval echo \${$i})" && { toc_boldecho "Warning: variable not set: $i" _ret=1 } done pkgconfdir=${prefix}/lib/pkgconfig echo "x${PKG_CONFIG_PATH}" | grep "${pkgconfdir}" >/dev/null || { cat <<EOF ${TOC_BOLD_}Warning: the dir [$pkgconfdir] is not in the current PKG_CONFIG_PATH. This means that pkg-config may not be able to find ${PACKAGE_NAME}.pc after installation.${_TOC_BOLD} EOF } unset pkgconfdir cat <<EOF > ${PACKAGE_NAME}.pc # created by toc's create_pkg-config_data test. $(date) prefix=${prefix} exec_prefix=\${prefix} libdir=\${prefix}/lib includedir=\${prefix}/include Name: ${PACKAGE_FRIENDLY_NAME-${PACKAGE_NAME}} Description: ${PACKAGE_DESCRIPTION} Version: ${PACKAGE_VERSION} Requires: ${PACKAGE_REQUIRES} Libs: ${PACKAGE_LDADD-"-L\${libdir}"} Cflags: ${PACKAGE_CFLAGS-"-I\${includedir}"} EOF return $_ret --- NEW FILE: toc_configure_finalcheck.sh --- # does some closing-time checks on the configure environment. ret=0 for ifile in \ ${TOP_SRCDIR}/toc_shared.make ${TOP_SRCDIR}/include/config.h \ ; do \ grep -iqe "@[A-Z0-9_][A-Z0-9_]*@" $ifile && { boldecho -n "WARNING: " echo "$ifile contains un-parsed @tokens@. This may or may not be an error. ${TOC_EMOTICON_WARNING}" ret=1 # note that this check is broken because it is generic: # we should not include @tokens@ which are commented-out in makefiles, # but the makefile comment delimiter is the first char of the #define # directive for config.h.at. # one day i'll code separate tests for each file. } done return $ret --- NEW FILE: find_appconfig.sh --- #!/do/not/bash # toc_run_description = looking for $1-config # toc_begin_help = # This test searches for $1-config in the path $2. # The search path defaults to ${prefix}/bin:$PATH. # # # The config var ${1}_config is exported, and will contain the path of # the config app or empty if it was not found. Note that any "-" # characters in $1 are converted to "_" for this purpose. # FIND_APPCONFIG is also exported to the path of the found config app, # but will be reset on each call to this function. It is intended to # be helpful when running this test in loops, e.g., for x in foo bar; # do ... done # Example: # # toc_test_require find_appconfig my-lib # # will search for my-lib-config in ${prefix}/bin:$PATH # and will export ${my_lib_config} to the path where it # is found. # # = toc_end_help _app=${1} test x = "x$_app" && { cat <<EOF Usage error: this test requires the base name of a lib or app as it's first argument, and an optional PATH as it's second argument. Example: toc_test_require find_appconfig gtk will search for gtk-config in ${prefix}/bin:$PATH EOF return 1 } _spath=${2-${prefix}/bin:$PATH} toc_find ${_app}-config $_spath _app=$(echo $_app | sed -e s/-/_/g) toc_export ${_app}_config=${TOC_FIND_RESULT} toc_export FIND_APPCONFIG=${TOC_FIND_RESULT} unset _app unset _spath test x != "x${TOC_FIND_RESULT}" return $? --- NEW FILE: PACKAGE_NAME-config.at --- #!/bin/sh # # This gets filtered at configure-time to create # ${PACKAGE_NAME}-config. usage() { cat <<EOF 1>&2 $0: shows information useful for configuring/building @PACKAGE_NAME@ client applications. Usage: $0 [options] Options: --libs : prints linker information about what libs clients should link to --includes : prints INCLUDES information --prefix : prints the library's installation prefix --version : prints the library's version --toc-make : prints a makefile snippet suitable for use with toc makefiles --toc-config : prints info suitable for use in a toc configure script EOF } foo=$1 test "x" = "x$1" && { usage exit 1; } version="@PACKAGE_VERSION@" ldadd="@CLIENT_LDADD@" includes="@CLIENT_INCLUDES@" prefix="@prefix@" for arg in "$@"; do case $arg in --help|-?|-h) usage ;; --libs) echo $ldadd ;; --includes) echo $includes ;; --prefix) echo $prefix ;; --version) echo $version ;; --toc-make) cat <<EOF @PACKAGE_PREFIX@CLIENT_LDADD=$ldadd @PACKAGE_PREFIX@CLIENT_INCLUDES=$includes @PACKAGE_PREFIX@LIBRARY_VERSION=$version EOF ;; --toc-config) cat <<EOF toc_export @PACKAGE_PREFIX@CLIENT_LDADD="$ldadd" toc_export @PACKAGE_PREFIX@CLIENT_INCLUDES="$includes" toc_export @PACKAGE_PREFIX@LIBRARY_VERSION="$version" EOF ;; *) echo "Unrecognized option: $arg" exit 2 ;; esac done --- NEW FILE: user_is_stephan_beal.sh --- #!/do/not/bash # toc_run_description = If you appear to be stephan beal, set up some common stuff... test xstephan = "x${USER}" || return 1 got=0 for h in cheyenne ludo jareth hoggle owl; do test x$h = "x${HOSTNAME}" && got=1 done test $got = 0 && return 1 echo "Setting up stephan's always-used settings..." { # for gnu_cpp_tools: echo "Enabling debug/werror/wall." export configure_enable_debug=1 export configure_enable_werror=1 export configure_enable_wall=1 } return 0 --- NEW FILE: use_ccdv.sh --- #!/do/not/bash # ^^^ help out emacs # # toc_run_description = use ccdv compiler front-end? # # toc_begin_help = # # Running this test enabled Mike Gleason's ccdv compiler front-end, # which simply pretties-up compiler output. The ccdv source lives in # ${TOC_HOME}/bin/ccdv.c and is released under the GNU GPL. # # Use the --disable-ccdv configure option to explicitely disable it. # # = toc_end_help test 0 = "${configure_enable_ccdv-1}" && { echo "ccdv has been explicitely disabled with --disable-ccdv." return 0 } test x != "x${CC}" || { echo 'This test requires that the CC environment variable be set to a C compiler!' return 1 } ccdvsrc=${TOC_HOME}/bin/ccdv.c toc_find $ccdvsrc || { unset ccdvsrc return 1 } ${CC} -o ccdv ${ccdvsrc} || { unset ccdvsrc echo "Compilation of ccdv failed!" return 1 } unset ccdvsrc return 0 --- NEW FILE: readline.sh --- # toc_run_description = looking for GNU libreadline/libhistory # toc_begin_help = # Searches for GNU libreadline. # #Use --without-libreadline to explicitely disable libreadline support. # #toc_export is called for the following variables: # # HAVE_READLINE = 0 or 1 # # LIBREADLINE_LDADD = empty or -lreadline, possibly with -lncurses # # = toc_end_help toc_export HAVE_READLINE=0 toc_export LIBREADLINE_LDADD= configure_with_libreadline=${configure_with_libreadline-1} test "x${configure_with_libreadline}" = "x0" && { echo "libreadline has been explictely disabled with --without-libreadline." return 0 } _libpath=/usr/lib:/usr/local/lib:${prefix}/lib:/lib _do=0 for L in libreadline.so libreadline.so.4 libreadline.a; do toc_find $L "$_libpath" && { _do=1 break } done test x$_do = x0 && { echo "libreadline library file not found." unset _do unset _libpath return 0 } rllib=${TOC_FIND_RESULT} rlincpath=/usr/include:/usr/include/readline:/usr/local/include:/usr/local/include/readline:${prefix}/include:${prefix}/include/readline for inc in readline.h history.h; do toc_find $inc $rlincpath || { err=$? echo "Header file $inc not found in path [$rlincpath]" unset rlincpath unset rllib return $err } done unset rlincpath LIBREADLINE_LDADD="-lreadline" if ldd $rllib 2> /dev/null | grep ncurses &>/dev/null ; then echo "It seems that libreadline also requires linking against -lncurses." LIBREADLINE_LDADD="${LIBREADLINE_LDADD} -lncurses" fi toc_export HAVE_READLINE=1 toc_export LIBREADLINE_LDADD="${LIBREADLINE_LDADD}" unset nc return 0 --- NEW FILE: sed.sh --- toc_find sed || return toc_add_make SED=${TOC_FIND_RESULT} return 0 --- NEW FILE: gzip.sh --- toc_find gzip || return toc_add_make GZIP=${TOC_FIND_RESULT} return 0 --- NEW FILE: mysql_server.sh --- # toc_run_description = looking for a running mysql server # toc_begin_help = # Looks for a running mysql server: # $@ = optional sql code, used on connecting to the db. # # This script requires that the mysql_clients test has been # run, and will run it HAVE_MYSQL_CLIENTS is not 1. # # It accepts these optional config arguments: # --mysql-host=server # --mysql-user=user # --mysql-password=password # --mysql-port=server_port # --mysql-db=database_name # # = toc_end_help # # toc_add_config HAVE_MYSQL_SERVER=0 toc_get_make HAVE_MYSQL_CLIENTS test "x${TOC_GET_MAKE}" = "x1" || { toc_test mysql_clients || return $? } sql="${@-show databases}" toc_get_make MYSQL client=${TOC_GET_MAKE} args= for x in \ user=mysql_user \ host=mysql_host \ password=mysql_password \ port=mysql_port \ database=mysql_db \ ; do # map --mysql-FOO to --FOO arg for mysql client: k="${x%%=*}" v=$"${x##*=}" uc=$(echo $v | tr [a-z] [A-Z]) eval v='$'${v} test -z "$v" || args="$args --$k=${v}" toc_add_make $uc="$v" done echo -n "Attempting to connect to mysql server:" " " # echo $client $args -e "'$sql'" $client $args -e "$sql" > /dev/null err=$? if test $err != 0 ; then echo -n ${TOC_EMOTICON_ERROR} " " toc_boldecho "Could not connect to server!" return $err fi echo ${TOC_EMOTICON_OKAY} toc_add_config HAVE_MYSQL_SERVER=1 return 0 --- NEW FILE: running_under_cygwin.sh --- # toc_run_description = building under cygwin? test -d /cygdrive/c err=$? if test $err = 0 ; then toc_add_config CYGWIN=1 echo "Detected cygwin." else toc_add_config CYGWIN=0 fi 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. # It calls toc_export for the following vars: # # - HAVE_BZ2LIB = 0 or 1 # - LDADD_BZ2LIB = empty or -lz # # Pass --disable-bzlib to configure to explicitely set # HAVE_BZLIB to zero. # # It returns zero if HAVE_BZLIB==1, else non-zero. # = toc_end_help toc_export HAVE_BZLIB=0 toc_export LDADD_BZLIB= test x0 = x${configure_enable_bzlib} && { echo "bzlib explicitely disabled via --disable-bzlib." return 0 } toc_find libbz2.a ${prefix}/lib:/usr/lib:/usr/local/lib:${LD_LIBRARY_PATH} zlib_a=${TOC_FIND_RESULT} toc_find 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=$? if [ x1 = x${HAVE_BZLIB} ]; then toc_export HAVE_BZLIB=1 toc_export LDADD_BZLIB=-lbz2 return 0 fi return 1 --- NEW FILE: cvs_tools.sh --- #!/do/not/bash # toc_run_description = looking for CVS client tools # toc_begin_help = # Looks for the cvs client tools. Exports: # # - CVS_BIN=/path/to/cvs # # It honors the configure argument --with-cvs=/path/to/cvs # = toc_end_help cvs=${configure_with_cvs-cvs} toc_find $cvs toc_export CVS_BIN=${TOC_FIND_RESULT} test x = "x${CVS_BIN}" && return 1 return 0 --- NEW FILE: zlib.sh --- # toc_run_description = looking for zlib # toc_begin_help = # Searches for libz.a and zlib.h in commonly-used locations. # It calls toc_export for the following vars: # # - HAVE_ZLIB = 0 or 1 # - LDADD_ZLIB = empty or -lz # # Pass --disable-zlib to configure to explicitely set # HAVE_ZLIB to zero. # # It returns zero if HAVE_ZLIB==1, else non-zero. # = toc_end_help toc_export HAVE_ZLIB=0 toc_export LDADD_ZLIB= test x0 = x${configure_enable_zlib} && { echo "zlib explicitely disabled via --disable-zlib." return 0 } toc_find libz.a ${prefix}/lib:/usr/lib:/usr/local/lib:${LD_LIBRARY_PATH} zlib_a=${TOC_FIND_RESULT} toc_find zlib.h ${prefix}/include:/usr/include:/usr/local/include zlib_h=${TOC_FIND_RESULT} test "x" = "x$zlib_a" -o "x" = "x$zlib_h" HAVE_ZLIB=$? if [ x1 = x${HAVE_ZLIB} ]; then toc_export HAVE_ZLIB=1 toc_export LDADD_ZLIB=-lz return 0 fi return 1 --- NEW FILE: libltdl.sh --- # toc_run_description = looking for libltdl # toc_begin_help = # # Looks for libltdl. It calls toc_export # for the following variables: # # HAVE_LIBLTDL = 0 or 1 # LDADD_LIBLTDL = -lltdl or empty # LDADD_DL = empty or "-ltdl -rdynamic", possibly with -L/path... # # Note that LDADD_LIBLTDL is specific to the libltdl test, whereas LDADD_DL is used # by both the libdl and libltdl tests. # # = toc_end_help # Many thanks to Roger Leigh for introducing me to ltdl! toc_add_config HAVE_LIBLTDL=0 toc_add_config LDADD_LIBLTDL= toc_export LDADD_DL= err=1 toc_test gcc_build_and_run ${TOC_HOME}/tests/c/check_for_ltdlopen_and_friends.c -rdynamic -lltdl && { err=0 toc_export HAVE_LIBLTDL=1 toc_export LDADD_LIBLTDL="-lltdl -rdynamic" toc_export LDADD_DL="${LDADD_LIBLTDL}" } return $err --- NEW FILE: find_header.sh --- #!/do/not/bash # toc_run_description = Looking for header file $1 # toc_begin_help = # # Searches for a header file, passed as $1, # in the search path $2. $2 defaults to: # ${prefix}/include:/usr/include:/usr/local/include # # After running this the variable TOC_FIND_RESULT # holds the position of the file, or is empty # if the file is not found. # # The environment variable FIND_HEADER_PATH is set to # to path where $1 was found. Note that it is reset # on every call to this test, and is not toc_exported. # # = toc_end_help test x = "x$1" && { cat <<EOF Usage error: \$1 should be the name of a header file. \$2 is an optional search path. EOF return 1 } header=$1 shift defname=HAVE_$(echo ${header} | tr '[a-z/.]' '[A-Z__]') toc_find $header ${@-${prefix}/include:/usr/include:/usr/local/include} export FIND_HEADER_PATH="${TOC_FIND_RESULT%%/$header}" if test -n "${FIND_HEADER_PATH}"; then toc_export ${defname}=1 else toc_export ${defname}=0 fi unset header test x != "x${TOC_FIND_RESULT}" return $? --- NEW FILE: toc_config_h.sh --- #!/do/not/bash # toc_run_description = creating config.h # toc_begin_help = # Creates a config.h from config.h.at. # Accepts optional $1 naming a target config.h-like # file. The file $1.at must exist for this to work. # = toc_end_help toc_config_h () { # $1 = target file. $1.at must exist. # todo: add support for multiple input files. # i use a function so i can use local vars local propsfile=.config.h.properties local configh=$1 configh=${configh##${TOP_SRCDIR}/} local tmpl=$configh.at test -f $tmpl || { echo "Note: no $tmpl found, so $configh will not be created." return 0 } i=0 test -f "$propsfile" && rm "$propsfile" toc_dump_config_h_properties > $propsfile toc_atfilter_file $propsfile $tmpl $configh rm $propsfile return 0 } files="$@" test -z "$files" && files=${TOC_INCLUDESDIR}/config.h toc_config_h "$files" return $? --- NEW FILE: gnu_install.sh --- # tests for GNU install toc_add_make PACKAGE_IS_INSTALLABLE=0 toc_find ginstall || toc_find install || { echo "install or ginstall not found in your PATH: $PATH" return 1 } app=${TOC_FIND_RESULT} "$app" --help | 2>&1 grep -qi GNU || { echo "Your 'install' ($app) appears to be non-GNU." return 1 } toc_add_make GNUINSTALL_BIN=$app toc_add_make PACKAGE_IS_INSTALLABLE=1 return 0 --- NEW FILE: gnu_find.sh --- # toc_run_description = search for GNU find toc_find find || return 1 app=${TOC_FIND_RESULT} "$app" --version | grep -qi GNU || { echo "Your 'find' ($app) appears to be non-GNU." return 1 } toc_add_make FIND=$app return 0 --- NEW FILE: atfilter_file.sh --- #!/do/not/bash # toc_run_description = creating $2 test x = "x$2" && { echo "Error: this test requires args \$1 and \$2:" echo "\$1 = input (template) file." echo "\$2 = output file." return 1 } toc_atfilter_as_makefile $1 $2 --- NEW FILE: toc_make.sh --- #!/do/not/bash # toc_run_description = creating included makefiles # Do not run this test manually: it is run by the toc core. TOC_MAKE=toc.make TOC_QMAKE=toc.qmake toc_add_make TOC_MAKE=${TOC_MAKE} toc_add_make TOC_QMAKE=${TOC_QMAKE} # set -x toc_make_toc_make () { # use a function because bash doesn't allow local vars outside of functions. local usage="usage: arg1==target makefile basename. arg2=input template" local themake=${1?$usage} local themakein=${2?$usage} echo "Creating $themake ... " local makeprops=${TOP_SRCDIR}/.toc.make.tmp toc_dump_make_properties > $makeprops local thedir local tocmake local relpath local shortform local tocmakeprops for d in $(find ${TOP_SRCDIR} -name Makefile -o -name GNUMakefile -o -name Makefile.toc -o -name '*.qmake' \ | xargs grep -E -l "include.+${themake}" | sort -u); do #echo "d=$d" >&2 thedir=$(dirname $d) tocmake=${thedir}/$themake toc_makerelative $thedir relpath=${TOC_MAKERELATIVE} tocmake=${tocmake##$TOP_SRCDIR/} # make it short, for asthetic reasons :/ shortform=${thedir##${PWD}/} test "$shortform" = "$PWD" && shortform= # top-most dir # echo "tocmake=$tocmake relpath=$relpath shortform=$shortform" tocmakeprops=${cmake}.props cp $makeprops $tocmakeprops cat <<EOF >> $tocmakeprops TOP_SRCDIR=${relpath##./} TOC_RELATIVE_DIR=${shortform##./} EOF toc_atfilter_file $tocmakeprops $themakein $tocmake \ || toc_die $? "Error creating $themake!" rm $tocmakeprops touch $tocmake # required for proper auto-reconfigure :/ done } toc_make_toc_make ${TOC_MAKE} ${TOC_HOME}/make/toc.make.at err=$? test $err != 0 && { echo "Error creating ${TOC_MAKE} makefiles!" return $err } test -f ${TOP_SRCDIR}/toc.${PACKAGE_NAME}.qmake.at && { toc_make_toc_make ${TOC_QMAKE} ${TOC_HOME}/make/toc.qmake.at err=$? test $err != 0 && { echo "Error creating ${TOC_QMAKE} makefiles!" return $err } } return $err --- NEW FILE: lyxport.sh --- #!/do/not/bash # toc_run_description = looking for lyxport # toc_begin_help = # Looks for the lyxport tool (http://www-hep.colorado.edu/~fperez/lyxport). # Use --without-lyxport to disable it. It exports these variables: # # - LYXPORT_BIN=/path/to/lyxport # - LYXPORT_MAKE=/path/to/lyxport.make (part of toc) # Additionally, it *might* export the following: # # # - PS2PDF_BIN # - LYX_BIN # - LATEX_BIN # - LATEX2HTML_BIN # - DVIPS_BIN # - DVI2TTY_BIN # # Usage: put something like the following in your makefile template: # # configure_with_lyxport = @configure_with_lyxport@ # ifeq (1,$(configure_with_lyxport)) # LYXPORT_L2HARGS = -nonavigation -show_section_numbers -split 0 -noimages # LYXPORT_ARGS = -c -tt # LYXPORT_ARGS += --html --opts_l2h '$(LYXPORT_L2HARGS)' # LYXPORT_ARGS += --ps --pdf # endif # # = toc_end_help toc_export LYXPORT_BIN= toc_export LYXPORT_MAKE= toc_add_make configure_with_lyxport=0 test "x${configure_with_lyxport-1}" = "x0" && { echo "lyxport has been explicitely disabled." return 1 } configure_with_lyxport=${configure_with_lyxport-1} lyxport=lyxport test x1 != x${configure_with_lyxport} && lyxport=${configure_with_lyxport} path=${PATH}:${TOC_HOME}/bin toc_find $lyxport $path || { echo "lyxport not found. You can possibly find lyxport at http://www-hep.colorado.edu/~fperez/lyxport" return 1 } lyxport=${TOC_FIND_RESULT} lyxport_makefile=${TOC_HOME}/make/lyxport.make toc_find $lyxport_makefile || { echo "lyxport requires $lyxport_makefile" return 1 } lyxport_make=${TOC_FIND_RESULT} auxtools="lyx latex latex2html dvips ps2pdf dvi2tty" foundtools=0 for i in $auxtools; do toc_find $i && foundtools=1 test "$i" = "lyx" -a -z "${TOC_FIND_RESULT}" && { echo "Required app $i not found in PATH." return 1 } fn=${TOC_FIND_RESULT} big=$(echo $i | tr [:lower:] [:upper:])_BIN toc_export ${big}=$fn done test "x$foundtools" = "x0" && { echo "None of the auxillary tools for lyxport found: $auxtools" return 1 } toc_export LYXPORT_BIN=${lyxport} toc_export LYXPORT_MAKE=${lyxport_make} toc_export configure_with_lyxport=${configure_with_lyxport} return 0 --- NEW FILE: toc_core_tests.sh --- #!/do/not/bash # toc_run_description = Looking for required build components... # toc_begin_help = # To be sourced from toc_core.sh. This is the core sanity checker for # toc. Any test which MUST pass for a tree to be considered # toc-capable may be placed in here. # = toc_end_help toc_run running_under_cygwin # toc_quietly "Looking for required build components:" for x in \ bash=SHELL \ cat=CAT \ cut=CUT \ ls=LS \ perl=PERL \ sed=SED \ xargs=XARGS \ ; do f=${x%%=*} v=${x##*=} toc_find $f || { echo "configure couldn't find required app: $f" return 1 } test "x$v" = "xXtocX" && continue toc_add_make $v=${TOC_FIND_RESULT} done toc_find less || toc_find more || { echo "Found neither 'more' nor 'less'!!!" return 1 } toc_find_require install-sh ${TOC_HOME}/bin # toc_add_make INSTALLER_BIN="\$(top_srcdir)/${TOC_FIND_RESULT##${PWD}/}" toc_add_make INSTALLER_BIN="${TOC_FIND_RESULT}" toc_find_require makedist ${TOC_HOME}/bin toc_add_make TOC_MAKEDIST_BIN="${TOC_FIND_RESULT}" # it's very arguable to make makedist a required component :/ for x in \ awk \ gnu_make \ gnu_find \ gnu_tar \ ; do toc_test $x || { echo "${TOC_EMOTICON_ERROR} $x test failed." return 1 } done #toc_test gnu_install || { # boldecho "Didn't find GNU install. You won't be able to do a 'make install'." #} toc_quietly "Looking for optional build components:" for x in \ gzip=GZIP \ bzip2=BZIP \ zip=ZIP \ ; do f=${x%%=*} v=${x##*=} foo=configure_with_${f} toc_find $f toc_add_make $v=${TOC_FIND_RESULT} done return 0 --- NEW FILE: doxygen.sh --- #!/do/not/bash # toc_run_description = looking for doxygen, API doc generation tool. # toc_begin_help = # # Looks for doxygen in the ${PATH} or the binary specified using # --with-doxygen=/path/to/doxygen. It calls toc_export for the # following vars: # # - DOXYGEN_BIN=/path/to/doxygen, or empty string if we got # --without-doxygen or a bad value for --with-doxygen=... # # It returns zero if it finds doxygen, else non-zero. # # = toc_end_help if test "x${configure_with_doxygen}" = "x0"; then echo "doxygen support has been explicitely disabled." toc_export DOXYGEN_BIN= return 1 fi if test "x${configure_with_doxygen}" = x || test "x${configure_with_doxygen}" = x1; then toc_find_in_path doxygen "$PATH" && DOXYGEN_BIN=${TOC_FIND_RESULT} elif test "x${configure_with_doxygen}" = x0; then DOXYGEN_BIN= else if test -x ${configure_with_doxygen}; then DOXYGEN_BIN="${configure_with_doxygen}" else # I hate shell scripts!! echo '--with-doxygen "'"${configure_with_doxygen}"'" isn'"'t executable!" toc_export DOXYGEN_BIN= return 1 fi fi toc_export DOXYGEN_BIN="$DOXYGEN_BIN" return 0 --- NEW FILE: check_dist_md5s.sh --- # toc_run_description = checking MD5 sums of your distribution distname=${PWD##*/} fn=${1-md5.sums.${distname}} test ! -f $fn && { echo "File $fn not found. Skipping md5 check." return 0; } toc_find_in_path md5sum || { echo "md5sum not found in your PATH. Skipping md5 check! ${TOC_EMOTICON_WARNING}" return 0 } md5=${TOC_FIND_RESULT} tmp=.toc.checkmd5.foo ret=0 $md5 -c $fn > $tmp || { grep FAILED $tmp echo "md5 check failed! Your distribution does not seem to be an unmodified copy of ${PACKAGE_NAME}!" ret=1 } rm $tmp return $ret |
Update of /cvsroot/pclasses/pclasses2/toc/make In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6599/make Added Files: BIN_PROGRAMS.make C_BINS_FROM_SOURCES.make c_bins.make C_DEPS.make cleaner.make cpp_bins.make cpp_dynamic_libs.make cpp_helper.make cpp_lib_testapp.make cpp_static_libs.make deps.make dist.make DOXYGEN.make FILE_FILTERS.make flex.make headers_symlinks.make install.380.make install.make INSTALL_XXX.make LYX_EXPORT.make lyxport.make LYXPORT.make Makefile makerules.BIN_PROGRAMS makerules.C_BINS_FROM_SOURCES makerules.FILE_FILTERS makerules.INSTALL_XXX makerules.LYX_EXPORT makerules.LYXPORT makerules.QMAKE2MAKE makerules.QT_MOC_DEPS makerules.RSYNC makerules.SCP makerules.SHARED_LIBS makerules.STATIC_LIBS makerules.TARBALL mkdirs.make NAMESPACE.make PCH.make qmake2make.make QMAKE2MAKE.make QT_MOC_DEPS.make qt_moc.make qt.sh RSYNC.make SCP.make SHARED_LIBS.make STATIC_LIBS.make subdirs_traverser.make symlinker.make symlink_headers.make SYMLINK_HEADERS.make TARBALL.make tests.make toc_functions.make toc.make.at toc.qmake.at Log Message: egg --- 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)/BIN_PROGRAMS.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 = $(TOC_MAKESDIR)/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) ifeq (1,$(MAKING_CLEAN)) @echo "$(MAKECMDGOALS): skipping BIN_PROGRAMS rules generation." else @echo "Generating BIN_PROGRAMS rules."; \ $(call toc_generate_rules,BIN_PROGRAMS,$(BIN_PROGRAMS)) > $@ endif -include $(BIN_PROGRAMS_DEPSFILE) 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 bins: BIN_PROGRAMS endif # ^^^ got $(BIN_PROGRAMS) ??? --- NEW FILE: toc_functions.make --- #!make # ^^^ let's help out emacs :/ # this file contains more-or-less generic call()able Make functions. ###################################################################### # toc_atparse_file call()able: # Similar to the toc shell function of the same name, except for different arguments: # Filters an input file using toc's at-parser (e.g., @TOKENS@), and sends output to $2. # $2 is only updated if the generated output is different, so it is dependencies-safe. # Args: # $1 = input template # $2 = output file # $3 = list of properties, e.g. FOO=bar BAR=foo TOC_ATPARSER_BIN = $(TOC_BINDIR)/atsign_parse ifeq (,$(wildcard $(TOC_ATPARSER_BIN))) $(error Could not find TOC_ATPARSER_BIN at $(TOC_ATPARSER_BIN)!) endif toc_atparse_file = \ echo -n 'toc_atparse_file: '; $(TOC_ATPARSER_BIN) $(3) < $(1) > $(2).tmp; \ if cmp -s $(2).tmp $(2); then rm -f $(2).tmp; echo "$(2) is up to date."; \ else mv -f $(2).tmp $(2); echo "Updated $(2)."; fi ###################################################################### # toc_generate_rules() callable: # $1 = rules name, e.g., INSTALL_XXX, BIN_PROGRAMS, etc. # $2 = arguments to pass to makerules.$(1) # Sample: # .toc.foo.deps: # $(toc_generate_rules,foo,arg1=val1 -arg2) # Executes script $(TOC_MAKESDIR)/makerules.foo, passing it $(2). toc_generate_rules = $(SHELL) $(TOC_MAKESDIR)/makerules.$(1) $(2) # the $(SHELL) prefix here is a kludge: systems where /bin/sh is Bourne # fail to build, but the nature of the errors makes it quite difficult # to track down where the failure is. The side-effect of this kludge # is that makerules.foo must be a shell script. :/ ###################################################################### # toc_get_makefile_var call()able: # $1 = VAR_NAME # $2 = optional filename (defaults to Makefile) toc_get_makefile_var = $(shell $(TOC_HOME)/bin/getMakefileVar $(1) $(2)) ###################################################################### # toc_compile_c_binary call()able function: # compiles/links list of source files [$($(1)_bin_SOURCES) $($(1)_bin_OBJECTS)and $(2)] # to create $(1). It uses the optional $($(1)_bin_CFLAGS). toc_compile_c_binary = $(CC) $(C_BINS_FROM_SOURCES_CFLAGS) $(CFLAGS) $($(1)_bin_CFLAGS) -o $(1) $($(1)_bin_SOURCES) $($(1)_bin_OBJECTS) $(2) $(C_BINS_FROM_SOURCES_LFLAGS) $(LDFLAGS) $($(1)_bin_LFLAGS) # does $(LDFLAGS) /really/ belong here??? ###################################################################### # toc_made_c_deps call()able function: # generates make dependencies for c/c++ files. # $1 = C/C++ sources to process. # $2 = INCLUDES (e.g., -I. -I/usr/include, with or without the -I). # $2 defaults to $(INCLUDES). toc_make_c_deps = inc="$(patsubst %,-I%,$(wildcard $(patsubst -I%,%,$(2))))"; \ test "x$$inc" = "x" && inc="$(INCLUDES)"; \ $(TOC_MKDEP_BIN) $$inc -- $(1) # the $(wildcard) oddness above is to remove duplicate entires and invalid # dirs (mkdeps no likie invalid ones). # maintenance note: $(TOC_MKDEP_BIN) comes from C_DEPS.make ifneq (,$(CCDV_BIN)) COMPILE_COMMAND_QUIET_PREFIX = @ else COMPILE_COMMAND_QUIET_PREFIX = endif ###################################################################### # Experimental override of %.o:%.cpp COMPILE_COMMAND_CXX = $(CXX) $(CXXFLAGS) $($(subst .,_,$<)_CXXFLAGS) \ $(CPPFLAGS) $($(subst .,_,$<)_CPPFLAGS) $($(<).CPPFLAGS) $(TARGET_ARCH) -c -o $@ $< # ^^^ ..._CPPFLAGS == e.g., main.cpp.CPPFLAGS or main_cpp_CPPFLAGS %.o: %.cpp $(COMPILE_COMMAND_QUIET_PREFIX)$(COMPILE_COMMAND_CXX) ###################################################################### # Experimental override of %.o:%.c COMPILE_COMMAND_C = $(CC) $(CFLAGS) $($(subst .,_,$<)_CFLAGS) \ $(CPPFLAGS) $($(subst .,_,$<)_CPPFLAGS) $(TARGET_ARCH) -c -o $@ $< %.o: %.c $(COMPILE_COMMAND_QUIET_PREFIX)$(COMPILE_COMMAND_C) --- NEW FILE: symlinker.make --- # Makefile snippet to create symlinks. # # sample usage: # default: all # SYMLINKS = $(wildcard somedir/*.h) # include path/to/this_file # all: links $(SYMLINKS): @if test -e $@ -a ! -e `basename $@`; then \ link="ln -s $@ ."; \ echo $$link; \ test -L $@ && continue; \ test -f $@ && $$link || echo "link failed!"; \ fi .PHONY: links $(SYMLINKS) # todo: figure out how to do this in the context of the qmake-driven build: #ifneq($(USE_PCH),'') # @if test ! -L $(notdir $@.pch); then \ # link="ln -s $@.pch ."; \ # echo $$link; \ ### test -L $@.pch && continue; \ ### test -f $@.pch && $$link || echo "link failed!"; \ # $$link || echo "link failed!"; \ # fi #endif links: $(SYMLINKS) clean: cleanlinks cleanlinks: @cleanfiles= ; \ for f in $(notdir $(SYMLINKS)); do \ if test -L $$f; then \ cleanfiles="$$cleanfiles $$f"; \ fi; \ if test -L $$f.pch; then \ cleanfiles="$$cleanfiles $$f.pch"; \ fi; \ done; \ if test -n "$$cleanfiles"; then \ echo rm $$cleanfiles; \ rm $$cleanfiles; \ fi --- NEW FILE: C_DEPS.make --- #!/do/not/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. # # Note that generated sources which do not exist when this snippet is # loaded will not be depped. Since that normally only happens on # a first-time build, when everything is re-built anyway, this is # not a practical problem. DEPS_C_SOURCES_GLOB ?= *.cpp *.c *.c++ *.C *.cc *.moc # *.h *.hpp *.h++ *.hxx SOURCE_FILES_TO_DEP ?= $(sort $(wildcard $(DEPS_C_SOURCES_GLOB))) TOC_C_DEPS_MAKEFILE = $(TOC_MAKESDIR)/C_DEPS.make TOC_MKDEP_SRC = $(TOC_HOME)/bin/mkdep.c TOC_MKDEP_BIN = $(top_srcdir)/mkdep $(TOC_MKDEP_BIN): $(TOC_C_DEPS_MAKEFILE) $(TOC_MKDEP_SRC) @$(call toc_compile_c_binary,$@,$(TOC_MKDEP_SRC)) DISTCLEAN_FILES += $(TOC_MKDEP_BIN) ifneq (,$(SOURCE_FILES_TO_DEP)) # We've got sources. Let's dep 'em... TOC_C_DEPSFILE = .toc.C_DEPS.make $(TOC_C_DEPSFILE): $(TOC_MKDEP_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 C_DEPS: $(TOC_C_DEPSFILE) deps: C_DEPS CLEAN_FILES += $(TOC_C_DEPSFILE) all: C_DEPS else # no sources to dep. Set up a dummy target. C_DEPS: endif --- NEW FILE: qt_moc.make --- # This is out-moded. Don't use it. # # manages moc file dependencies and compiling for Qt moc sources. # # Usage: # include $(TOC_MAKESDIR)/qt_moc.make # # Effects: # - moc_*.* are managed for you (deps, compiling QT_MOC_MAKEFILE = $(TOC_MAKESDIR)/qt_moc.make QT_MOC_DEPSFILE = .toc.QT_MOC_DEPS.make moc_%.cpp: @in=$@; in=$${in%%.cpp}.h; in=$${in##moc_}; \ cmd="$(MOC) $$in -o $@"; echo $$cmd; $$cmd QT_MOC_RULESGEN = $(TOC_MAKESDIR)/makerules.QT_MOC_DEPS QT_MOC_DEPS: $(QT_MOC_DEPSFILE) $(QT_MOC_DEPSFILE): Makefile $(QT_MOC_MAKEFILE) $(QT_MOC_RULESGEN) @echo "Generating moc file dependencies..."; \ $(QT_MOC_RULESGEN) > $@ include $(QT_MOC_DEPSFILE) deps: QT_MOC_DEPS mocs: QT_MOC_DEPS $(QT_MOC_OUT_SOURCES) all: QT_MOC_DEPS --- NEW FILE: qt.sh --- # toc_run_description = looking for Qt $1 # toc_begin_help = # Calls toc_export for the following: # - QTINCDIR directory containing Qt headers # - QTLIBDIR directory containing Qt libraries # - QTBINDIR directory containing Qt tools (moc, uic, etc.) # - LQT set to "-lqt" # - UIC /path/to/uic # - MOC /path/to/moc # - QMAKE /path/to/qmake # - QT_INCLUDES -I/path/to/Qt/includes # - QT_LDFLAGS -L/path/to/Qt/libs # Also, QTINCDIR, QTLIBDIR, and QTBINDIR are set in the environment. Note # that this intentionally does not set QTDIR, to keep you from using # $QTDIR/bin etc. instead of the QTBINDIR which might have been specified # by the user. # # If you need a specific version of Qt, set both of the following variables # before running this test: # qt_required_version - human-readable version number like "3.1.x" # qt_required_version_glob - version glob like "3.1.*" # Optionally, pass the version as $1 and glob as $2 (be sure to quote the # glob!). # = toc_end_help qt_required_version_version=${1-${qt_required_version_version-'3.x'}} qt_required_version_glob=${2-${qt_required_version_glob-'3.*'}} qt_check_dir () { local var=$1 local dir=$2 local contents=$3 if test -z "$dir"; then cat<<EOF $var environment variable not set, and --with-${var}=... not passed! Use one or the other to point to your Qt $contents, or QTDIR or --with-QTDIR=... to point to the top of your Qt installation. EOF return 1 fi if test -d $dir; then # life is tolerable return 0 else cat<<EOF Directory $dir does not exist! Set the $var environment variable, or pass --with-${var}=... to point to your Qt $contents, or QTDIR or --with-QTDIR=... to point to the top of your Qt installation. EOF return 1 fi } # Use --with-QTDIR=... if we got it; otherwise default to $QTDIR. QTDIR=${configure_with_QTDIR-$QTDIR} toc_export configure_with_qt=0 toc_export HAVE_QT=0 if test -z "${QTDIR}"; then echo "error: either set QTDIR or pass in --with-QTDIR=/path/to/qt" return 1 fi # QTINCDIR/QTLIBDIR/QTBINDIR can be specified independently, in the # environment or on the command line, or we can guess them from QTDIR. QTINCDIR=${configure_with_QTINCDIR-${QTINCDIR-${QTDIR+$QTDIR/include}}} QTLIBDIR=${configure_with_QTLIBDIR-${QTLIBDIR-${QTDIR+$QTDIR/lib}}} QTBINDIR=${configure_with_QTBINDIR-${QTBINDIR-${QTDIR+$QTDIR/bin}}} qt_check_dir QTINCDIR "$QTINCDIR" headers || return 1 qt_check_dir QTLIBDIR "$QTLIBDIR" libraries || return 1 qt_check_dir QTBINDIR "$QTBINDIR" executables || return 1 if test -n "$qt_required_version"; then # This has to be libqt*.so, not libqt.so, because in some cases you # have only libqt-mt.so.x.y.z, and libqt.so is a symlink to that, and # there are no libqt.so.x.y.z symlinks. (At least that's the way it # is with Qt 3.1.1 built from source on my RedHat 8.0 box.) ls $QTLIBDIR/libqt*.so.${qt_required_version_glob} > /dev/null 2>&1 || { echo "Qt $qt_required_version (libqt*.so.$qt_required_version_glob) not found in $QTLIBDIR!" return 1 } echo "Found Qt $qt_required_version at ${QTLIBDIR}" fi export QTDIR export QTINCDIR export QTLIBDIR export QTBINDIR toc_export QTDIR=$QTDIR toc_export QTINCDIR=$QTINCDIR toc_export QTLIBDIR=$QTLIBDIR toc_export QTBINDIR=$QTBINDIR toc_export LQT=-lqt toc_export UIC=${UIC:-$QTBINDIR/uic} toc_export MOC=${MOC:-$QTBINDIR/moc} toc_export QMAKE=${QMAKE:-$QTBINDIR/qmake} toc_export QT_INCLUDES="-I${QTINCDIR}" toc_export QT_LDFLAGS="-L${QTLIBDIR}" configure_with_qt=1 toc_export configure_with_qt=1 toc_export HAVE_QT=1 return 0 --- NEW FILE: Makefile --- #!/usr/bin/make -f default: all include toc.make DIST_FILES += $(wildcard *.make *.at makerules.*) --- NEW FILE: makerules.LYXPORT --- #!/bin/sh # Creates makefile rules for use with LYXPORT.make test 0 = ${#@} && { echo "usage: $0 file1.lyx [... fileN.lyx]" exit 1 } thisapp="\$(TOC_MAKESDIR)/makerules.LYXPORT" filters_makefile="\$(TOC_MAKESDIR)/LYXPORT.make" exts="pdf html ps" echo "############################## LYXPORT rules:" for t in "$@"; do echo "###################### ${t}:" echo -n "CLEAN_FILES += " for ext in $exts; do echo -n ${t%%.lyx}.$ext" " done echo cat <<EOF ${t}_LYXPORT_ARGS ?= \$(LYXPORT_ARGS) .PHONY: lyxport-${t} LYXPORT-${t} lyxport-${t}: \$(LYXPORT_BIN) \$(${t}_LYXPORT_ARGS) ${t} \$(${t}_LYXPORT_DEST) root=\$(patsubst %.lyx,%,${t}); \\ for x in $exts; do \\ mv \$\$root/\$\$root.\$\$x . || exit; \\ done; \\ \$(PERL_BIN) -i -pe "s|\$\${root}.html||g" \$\${root}.html || exit; \\ rm -fr \$\${root} # that perl call cleans up the self-links in the html file, because # such links break if you rename the html file (as i always do :/) LYXPORT: lyxport-${t} LYXPORT-${t}: lyxport-${t} lyxport: lyxport-${t} LYXPORT-post: LYXPORT-${t} ###################### /${t} EOF done echo "LYXPORT: LYXPORT-post" echo "lyxport: LYXPORT-post" echo "LYXPORT-post:" echo "# implement the LYXPORT-post target to implement post-lyxport logic." echo "############################## end LYXPORT rules" --- NEW FILE: deps.make --- # deprecated file. It's replacement is: include $(TOC_MAKESDIR)/C_DEPS.make --- NEW FILE: makerules.C_BINS_FROM_SOURCES --- #!/bin/sh # creates some makefile code for the $(C_BINS_FROM_SOURCES) var test -z "$1" && { echo "usage: $0 appone [apptwo ...]" exit 1 } echo "C_BINS_FROM_SOURCES_COMMON_DEPS += $0" cat <<EOF ifneq (,\$(CCDV_BIN)) C_BINS_FROM_SOURCES_QUIET_PREFIX = @ else C_BINS_FROM_SOURCES_QUIET_PREFIX = endif EOF for t in $@; do cat <<EOF $t: \$(C_BINS_FROM_SOURCES_COMMON_DEPS) \$(${t}_bin_SOURCES) \$(${t}_bin_OBJECTS) \$(C_BINS_FROM_SOURCES_QUIET_PREFIX)\$(call toc_compile_c_binary,${t},) CLEAN_FILES += $t bin-$t: $t bins: bin-$t EOF done --- NEW FILE: cpp_dynamic_libs.make --- # deprecated file. It's replacement is: include $(TOC_MAKESDIR)/SHARED_LIBS.make --- NEW FILE: mkdirs.make --- # Use like this: # MKDIRS = list of dirs # include $(top_makefilesdir)/mkdirs.make # mytarget: $(MKDIRS) # # That's it! That's look for those dirs, create them if they # don't exist, and exit if it can't make one. mkdir=mkdir ## mkdir=mkdirhier $(MKDIRS): @test -d $@ || $(mkdir) $@ && exit 0; \ echo "Failed to create dir [$@]!"; \ exit 1; --- NEW FILE: cpp_static_libs.make --- # deprecated file. It's replacement is: include $(TOC_MAKESDIR)/STATIC_LIBS.make --- NEW FILE: cleaner.make --- #!/usr/bin/make -f # Usage: # # CLEAN_FILES += *~ foo bar # DISTCLEAN_FILES += nekkid_pic_of_mrs_walters.jpg # include path/to/this/file # # That creates 'clean' and 'distclean' targets which will nuke those files/dirs. # # Special case: cleaning subdirs in an order other than that specified in $(SUBDIRS): # # Set TOC_OVERRIDE_CLEAN to 1 /before including toc.make/ in any given # makefile in order to have 'clean' clean/distclean targets, i.e., one you can # re-order all you want by using dependencies. # e.g.: # clean: $(addprefix clean-,bin sbin lib doc tests .) # or: # clean: precleaner subdirs-clean clean-. aftercleaner # # If you do this the default clean/distclean behaviour will be to do NOTHING, # so you must be sure to set the dist/clean deps. .PHONY: clean distclean clean-. CLEAN_FILES += $(DEPS_FILE) $(DIST_LISTFILE) ###################################################################### # toc_clean_files call()able function: deletes all files passed in via # $(1). toc_clean_files = test "x$(1)" = "x" && exit 0; \ for x in $(1) ""; do test -z "$${x}" && continue; \ test -w $$x || continue; \ rmargs=""; test -d $$x && rmargs="-rf"; \ rm $$rmargs $$x || exit; \ done; \ exit 0 clean-%: # assume $* is a subdirectory @$(call toc_make_subdirs,$*,clean) distclean-%: # assume $* is a subdirectory @$(call toc_make_subdirs,$*,distclean) clean-.: clean-subdirs ifeq (1,$(configure_build_quietly)) @echo "Cleaning up..."; \ $(call toc_clean_files,$(wildcard $(CLEAN_FILES))) else @echo "Cleaning up: $(wildcard $(CLEAN_FILES))"; \ $(call toc_clean_files,$(wildcard $(CLEAN_FILES))) # i hate the duplicate wildcard, but i can't pass shell-expanded vars # to $(call ...). endif distclean-.: distclean-subdirs @echo -n "Cleaning up... " ifeq (1,$(configure_build_quietly)) @$(call toc_clean_files,$(wildcard $(CLEAN_FILES) $(DISTCLEAN_FILES))); \ echo else @echo $(wildcard $(CLEAN_FILES) $(DISTCLEAN_FILES)); \ $(call toc_clean_files,$(wildcard $(CLEAN_FILES) $(DISTCLEAN_FILES))) endif subdirs-clean: # implemented elsewhere subdirs-distclean: # implemented elsewhere clean-subdirs: subdirs-clean distclean-subdirs: subdirs-distclean # toc-XXX stubs: don't use these directly #toc-clean: subdirs-clean clean-. #toc-distclean: subdirs-distclean distclean-. # we clean depth-first to keep some top-level generated files from being nuked :/ ifeq (1,$(TOC_OVERRIDE_CLEAN)) clean: distclean: else clean: clean-. distclean: distclean-. endif --- NEW FILE: toc.make.at --- #!/bin/make # # toc.make.at: template makefile for toc.make, a core concept of the # toc build process. This is filtered at the end of the configure # process. toc.make must be included by your Makefiles. # # All of the "at-vars" in this file are expected to come in # via the configure process, either from core tests or from # the core itself. # # Ideally this file should be free of project-specific code: # put that in $(top_srcdir)/toc.$(PACKAGE_NAME).make.at and # in $(top_srcdir)/configure.$(PACKAGE_NAME) run: # toc_test_require toc_project_makefile SHELL = @SHELL@ default: all all: FORCE: ; @true # try to save some grief later: .toc.%: $(wildcard *) ifneq (,$(strip $(filter distclean clean,$(MAKECMDGOALS)))) MAKING_CLEAN = 1 else MAKING_CLEAN = 0 endif #PACKAGE_VERSION = @PACKAGE_VERSION@ #PACKAGE_NAME = @PACKAGE_NAME@ top_srcdir = @TOP_SRCDIR@ retoc: @echo "Cleaning up .toc.*"; ls="$$(ls .toc.* 2>/dev/null)"; test x = "x$ls" && exit 0; \ rm $$ls; ${MAKE} $$ls PACKAGE_NAME = @PACKAGE_NAME@ ##### include configure-created code: toc_config_vars = $(top_srcdir)/toc.$(PACKAGE_NAME).configure.make include $(toc_config_vars) ##### DESTDIR is for autotools 'make install' compatibility ifneq (,$(DESTDIR)) DESTDIR := $(DESTDIR)/ endif ##### some conventional vars: prefix ?= @prefix@ top_includesdir = $(top_srcdir)/include top_libdir = $(top_srcdir)/lib top_bindir = $(top_srcdir)/bin toc_project_makefile = $(wildcard $(top_srcdir)/toc.$(PACKAGE_NAME).make) toc_project_makefile_at = $(wildcard $(top_srcdir)/toc.$(PACKAGE_NAME).make.at) TOC_HOME ?= @TOC_HOME@ # todo: check if this is under $(top_srcdir), so we can make this path relative. ##### deprecated: toc_topdir ?= $(TOC_HOME) toc_makesdir ?= $(TOC_HOME)/make toc_bindir ?= $(TOC_HOME)/bin # replacements are below... ##### TOC_MAKESDIR = $(TOC_HOME)/make TOC_BINDIR = $(TOC_HOME)/bin TOC_SBINDIR = $(TOC_HOME)/sbin TOC_PWD_FROM_TOPSRC = @TOC_RELATIVE_DIR@ # e.g., in lib/foo, TOC_PWD_FROM_TOPSRC == lib/foo TOC_MAKE = toc.make TOP_TOC_MAKE = $(top_srcdir)/$(TOC_MAKE) ############################################################ # Experimental: auto-run configure if we think we need to # Run configure with --enable-auto-reconfigure to get it. ifeq (1,$(configure_enable_auto_reconfigure)) $(TOC_MAKE): $(TOC_MAKESDIR)/$(TOC_MAKE).at \ $(toc_project_makefile_at) \ $(top_srcdir)/configure $(top_srcdir)/configure.$(PACKAGE_NAME) @echo "$@ dependencies updated: [$?]. Reconfiguring..."; \ touch $@; ${MAKE} toc-reconfigure toc-reconfigure: $(TOC_MAKE) cd $(top_srcdir); ./configure $(CONFIGURE_ARGUMENTS) ifneq (,$(toc_config_vars)) $(toc_config_vars): $(TOC_MAKE) endif endif # end autoreconfigure ############################################################3 ##### some core utilities: AWK_BIN = @AWK@ PERL_BIN = @PERL@ SED_BIN = @SED@ TAR_BIN = @TAR@ GZIP_BIN = @GZIP@ BZIP_BIN = @BZIP@ ZIP_BIN = @ZIP@ INSTALLER_BIN = @INSTALLER_BIN@ TOC_MAKEDIST_BIN = @TOC_MAKEDIST_BIN@ DIST_FILES += Makefile TOC_EMOTICON_OKAY=@TOC_EMOTICON_OKAY@ TOC_EMOTICON_WARNING= @TOC_EMOTICON_WARNING@ TOC_EMOTICON_ERROR=@TOC_EMOTICON_ERROR@ # TOC_SHARED_MAKEFILE is deprecated! TOC_SHARED_MAKEFILE = $(wildcard $(top_srcdir)/@TOC_SHARED_MAKEFILE@) ifneq (,$(TOC_SHARED_MAKEFILE)) include $(TOC_SHARED_MAKEFILE) endif CLEAN_FILES += $(wildcard .toc.* core *~) DISTCLEAN_FILES += $(wildcard \ $(TOC_MAKE) toc.qmake \ $(TOC_SHARED_MAKEFILE) toc_shared.qmake \ toc.$(PACKAGE_NAME).make \ toc.$(PACKAGE_NAME).configure.make \ ) ifeq (.,$(top_srcdir)) DISTCLEAN_FILES += toc.$(PACKAGE_NAME).configure.make endif ##################################################### some common C/C++ stuff: # C*FLAGS come from the gnu_cpp_tools toc test: CONFIG_H = $(wildcard $(top_includesdir)/config.h) INCLUDES += -I. ifneq (,$(CONFIG_H)) INCLUDES += -I$(top_srcdir)/include CPPFLAGS += -DHAVE_CONFIG_H=1 endif ifeq (1,$(configure_cpp_debug)) CPPFLAGS += -g endif CPPFLAGS += $(INCLUDES) $(WARN) $(CFLAGS_OPT) ##################################################### end C/C++ stuff ######################################################################## # configure_build_quietly IS GOING AWAY! DON'T USE IT configure_build_quietly = 0 ######################################################################## # CCDV_BIN: see TOC_HOME/bin/ccdv.c for details. This is a compiler # front-end to pretty up C/C++ compiler output. # We set this BEFORE INCLUDING PROJECT-SPECIFIC MAKEFILE CODE so # the ifeq()-based rules will behave properly. CCDV_BIN = $(wildcard $(top_srcdir)/ccdv) ifneq (,$(CCDV_BIN)) CC := $(CCDV_BIN) $(CC) CXX := $(CCDV_BIN) $(CXX) AR := $(CCDV_BIN) $(AR) ifeq (.,$(top_srcdir)) DISTCLEAN_FILES += $(CCDV_BIN) endif endif # /CCDV_BIN ######################################################################## include $(TOC_MAKESDIR)/toc_functions.make include $(TOC_MAKESDIR)/cleaner.make include $(TOC_MAKESDIR)/subdirs_traverser.make include $(TOC_MAKESDIR)/C_DEPS.make include $(TOC_MAKESDIR)/INSTALL_XXX.make include $(TOC_MAKESDIR)/dist.make #### finally, get the project-specific code: ifneq (,$(toc_project_makefile)) include $(toc_project_makefile) endif --- NEW FILE: cpp_lib_testapp.make --- # makefile snippet for running e-based apps # If you are going to include cpp_{static,dynamic}_lib.make, You should # include those before including this one. # # you must define: # THISLIB_TESTS = list of app names # then include this file. # for each FOO in $(THISLIBLIB_TESTS) you must have the file FOO.cpp # in place for this to work. (Sorry, it's braindeaded-level automation.) # If cpp_static_lib has been included it builds a statically-linked binary # named "FOO" from FOO.o and $(THISLIB_STATIC). # If cpp_dynamic_lib has been included it builds a dynamically-linked binary # "FOO_dynamic" from FOO.o and $(THISLIB_SHARED). # (This FOO_dynamic naming convention will change - i don't like it.) # todo: need better way of handling name descrepancy between static and dyn-linked bins. libtests: $(THISLIB_TESTS) submakes: $(THISLIB_TESTS) SUBMAKE_SOURCES = $(patsubst %,%.cpp,$(THISLIB_TESTS)) DIST_FILES += $(SUBMAKE_SOURCES) SUBMAKE_OBJECTS += $(patsubst %,%.o,$(THISLIB_TESTS)) SUBMAKE_COMMON_DEPS += Makefile $(THISLIB_STATIC) ifneq ($(THISLIB_STATIC),) # shared? CLEAN_FILES += $(THISLIB_TESTS) $(patsubst %,%.o,$(THISLIB_TESTS)) endif ifneq ($(THISLIB_SHARED),) # shared? CLEAN_FILES += $(patsubst %,%_dynamic,$(THISLIB_TESTS)) $(patsubst %,%_dynamic.o,$(THISLIB_TESTS)) endif #fore_namexform = $(patsubst .,_,$(1)) #foreach(fore_namexform,$(THISLIB_TESTS), # LDFLAGS += -export-dynamic call_linkmessage = echo '$(1) linking binary: $(3)' $(THISLIB_TESTS): $(SUBMAKE_COMMON_DEPS) $(SUBMAKE_OBJECTS) ifneq ($(THISLIB_STATIC),) # static? @$(call call_linkmessage,Statically,$@,$@) $(CXX) $(LDFLAGS) -o $@ $@.o $(THISLIB_STATIC) $(THISLIB_EXTRAOBJECTS) -lstdc++ # note that the order of the libs here is significant :/ endif # build shared versions? ifneq ($(THISLIB_SHARED),) # shared? @$(call call_linkmessage,Dynamically,$@,$(@)_dynamic) $(CXX) $(LDFLAGS) -export-dynamic -o $(@)_dynamic $@.o $(THISLIB_SHARED) $(THISLIB_EXTRAOBJECTS) -lstdc++ endif # build shared versions? # Note that the above usage of $(LDFLAGS) is not known to be valid. :/ It works in my # extremely simple cases. runtests: # does not account for dyn-linked bins... @for t in $(THISLIB_TESTS); do echo "Running $t..."; ./$$t || exit $$?; done --- NEW FILE: install.make --- # deprecated file. It's replacement is: include $(TOC_MAKESDIR)/INSTALL_XXX.make --- NEW FILE: install.380.make --- # these rules only work with GNU Make 3.80 and higher... # #!/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 = --mode=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 $(GNUINSTALL_BIN))) $(error install.make requires that the variable GNUINSTALL_BIN point to GNU install.) 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 call()able: # $1=file list, $2=destdir, $3=flags for $(GNUINSTALL_BIN) toc_make_install = $(call TOC_MAKE_INSTALL_GREP_KLUDGE,$(1)); \ 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="$(GNUINSTALL_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 = $(call TOC_MAKE_INSTALL_GREP_KLUDGE,$(1)); \ 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 = $(call TOC_MAKE_INSTALL_GREP_KLUDGE,$(1)); \ test -d $(2) || mkdir -p $(2) || exit; \ for b in $(1) ""; do test -z "$$b" && continue; \ target=$(2)/$$b; \ test $$target -ef $$b && continue; \ echo "Symlinking $$target"; ln -s -f $$PWD/$$b $$target || exit $$?; \ done # toc_make_install_so: installs foo.so.X.Y.Z and symlinks foo.so, foo.so.X and foo.so.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 = $(call TOC_MAKE_INSTALL_GREP_KLUDGE,$(1)); \ test -d $(5) || mkdir -p $(5) || exit; \ wholename=$(1).$(2).$(3).$(4); \ target=$(5)/$$wholename; \ test $$wholename -ef $$target || { \ echo "Installing/symlinking $$target"; \ cmd="$(GNUINSTALL_BIN) -s $$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); \ # } GNUINSTALL_FLAGS_NONBINS = --mode=0644 GNUINSTALL_FLAGS_BINS = -s define INSTALL_MAKE_VARS_TEMPLATE INSTALL_$(1)_DEST ?= $$(prefix)/$(2) INSTALL_$(1)_INSTALL_FLAGS ?= $(3) endef # set up the initial install locations and install flags: $(eval $(call INSTALL_MAKE_VARS_TEMPLATE,BINS,bin,$(GNUINSTALL_FLAGS_BINS))) $(eval $(call INSTALL_MAKE_VARS_TEMPLATE,SBINS,sbin,$(GNUINSTALL_FLAGS_BINS))) $(eval $(call INSTALL_MAKE_VARS_TEMPLATE,LIBS,lib,$(GNUINSTALL_FLAGS_NONBINS))) $(eval $(call INSTALL_MAKE_VARS_TEMPLATE,PACKAGE_LIBS,lib/$(PACKAGE_NAME),$(GNUINSTALL_FLAGS_NONBINS))) $(eval $(call INSTALL_MAKE_VARS_TEMPLATE,LIBEXECS,libexec,$(GNUINSTALL_FLAGS_NONBINS))) $(eval $(call INSTALL_MAKE_VARS_TEMPLATE,HEADERS,include,$(GNUINSTALL_FLAGS_NONBINS))) $(eval $(call INSTALL_MAKE_VARS_TEMPLATE,PACKAGE_HEADERS,include/$(PACKAGE_NAME),$(GNUINSTALL_FLAGS_NONBINS))) $(eval $(call INSTALL_MAKE_VARS_TEMPLATE,PACKAGE_DATA,share/$(PACKAGE_NAME),$(GNUINSTALL_FLAGS_NONBINS))) $(eval $(call INSTALL_MAKE_VARS_TEMPLATE,DOCS,share/doc/$(PACKAGE_NAME),$(GNUINSTALL_FLAGS_NONBINS))) define INSTALL_MAKE_INSTALL_TARGETS install-$(1):;\ @$$(call toc_make_install,$$(INSTALL_$(1)),$$(INSTALL_$(1)_DEST),$$(INSTALL_$(1)_INSTALL_FLAGS)) endef $(foreach foo,$(TOC_INSTALL_TARGET_BASENAMES),$(eval $(call INSTALL_MAKE_INSTALL_TARGETS,$(foo)))) define INSTALL_MAKE_UNINSTALL_TARGETS uninstall-$(1):;\ @$$(call toc_make_uninstall,$$(INSTALL_$(1)),$$(INSTALL_$(1)_DEST)) endef $(foreach foo,$(TOC_INSTALL_TARGET_BASENAMES),$(eval $(call INSTALL_MAKE_UNINSTALL_TARGETS,$(foo)))) define INSTALL_MAKE_INSTALL_SYMLINK_TARGETS install-$(1)-symlink:;\ @$$(call toc_make_install_symlink,$$(INSTALL_$(1)),$$(INSTALL_$(1)_DEST)) endef $(foreach foo,$(TOC_INSTALL_TARGET_BASENAMES),$(eval $(call INSTALL_MAKE_INSTALL_SYMLINK_TARGETS,$(foo)))) install_targets = $(TOC_INSTALL_TARGET_BASENAMES) subdirs install: $(patsubst %,install-%,$(install_targets)) uninstall: $(patsubst %,uninstall-%,$(install_targets)) install-symlink: $(patsubst %,install-%-symlink,$(install_targets)) install-bins: install-BINS uninstall-bins: uninstall-BINS install-sbins: install-SBINS uninstall-sbins: uninstall-SBINS install-libs: install-LIBS uninstall-libs: uninstall-LIBS install-libexecs: install-LIBEXECS uninstall-libexecs: uninstall-LIBEXECS install-pkgdata: install-PACKAGE_DATA uninstall-pkgdata: uninstall-PACKAGE_DATA install-headers: install-HEADERS uninstall-headers: uninstall-HEADERS install-pkgheaders: install-PACKAGE_HEADERS uninstall-pkgheaders: install-PACKAGE_HEADERS install-docs: install-DOCS uninstall-docs: uninstall-DOCS install-subdirs: @$(call toc_make_subdirs,$(SUBDIRS),install) install-subdirs-symlink: @$(call toc_make_subdirs,$(SUBDIRS),install-symlink) uninstall-subdirs: @$(call toc_make_subdirs,$(SUBDIRS),uninstall) --- NEW FILE: makerules.QT_MOC_DEPS --- #!/bin/bash # Generates makefile dependencies for files in $PWD which look like # they are mocable. This does not create any rules for actually # creating moc files. # # Usage: # $0 [moc_prefix] # where moc_prefix defaults to 'moc_', and is used to name # output files. MOC_PRE=${1-moc_} ARGS="$@" headers=$(ls *.h *.hpp *.hxx 2>/dev/null) test x = "x$headers" && exit 0 cat <<EOF ############################################################ # moc dependency rules generated by: # $0 $@ EOF for H in ${headers}; do if ! grep -l "Q_OBJECT" $H &>/dev/null; then continue fi base=${H%%.h*} base=${base##${MOC_PRE}} mocbase="${MOC_PRE}${base}" mocpp="${mocbase}.cpp" mocobj="${mocbase}.o" echo "${mocpp}: ${H}" echo "${mocobj}: ${mocpp}" echo "CLEAN_FILES += ${mocpp} ${mocobj}" done cat <<EOF # end moc dependency rules. ############################################################ EOF --- NEW FILE: QT_MOC_DEPS.make --- # This is out-moded. Don't use it. # # manages moc file dependencies and compiling for Qt moc sources. # # Usage: # include $(TOC_MAKESDIR)/qt_moc.make # # Effects: # - $(MOC_PREFIX)*.* are managed for you (deps, compiling MOC_PREFIX = moc_ QT_MOC_MAKEFILE = $(TOC_MAKESDIR)/qt_moc.make QT_MOC_DEPSFILE = .toc.QT_MOC_DEPS.make $(MOC_PREFIX)%.cpp: @in=$@; in=$${in%%.cpp}.h; in=$${in##$(MOC_PREFIX)}; \ cmd="$(MOC) $$in -o $@"; echo $$cmd; $$cmd QT_MOC_RULESGEN = $(TOC_MAKESDIR)/makerules.QT_MOC_DEPS QT_MOC_DEPS: $(QT_MOC_DEPSFILE) $(QT_MOC_DEPSFILE): Makefile $(wildcard *.h *.hpp *.hxx) $(QT_MOC_RULESGEN) ifeq (1,$(MAKING_CLEAN)) @echo "$(MAKECMDGOALS): skipping moc file dependencies generation." else @echo "Generating moc file dependencies..."; \ $(QT_MOC_RULESGEN) $(MOC_PREFIX) > $@ endif -include $(QT_MOC_DEPSFILE) deps: QT_MOC_DEPS mocs: QT_MOC_DEPS $(QT_MOC_OUT_SOURCES) all: QT_MOC_DEPS --- NEW FILE: TARBALL.make --- #!/do/not/make # # a toc snippet to help provide support for creating tarballs. # It expects $(TAR_BIN) to be set via the configure process (e.g., via the # gnu_tar test). # # Define: # # TARBALL_TARGETS = target1 [...targetN] # optional: TARBALL_FLAGS = flags to pass to tar (e.g., -z for gzip) # optional: TARBALL_CHDIR = [path to cd to before starting] # # For each target in TARBALL_TARGETS you must define the following: # # target1_TARBALL_FILES = list of files/dirs to tar # target1_TARBALL = destination filename # optional: target1_TARBALL_FLAGS = takes precedence over TARBALL_FLAGS # optional: target1_TARBALL_CHDIR = [path to cd to before starting] # # xxx_TARBALL_CHDIR is an odd-case var, and is not required (it defaults # to .) # # To run all TARBALL targets run one of: # make TARBALL # # To run one of them: # make TARBALL-targetname TARBALL_MAKEFILE = $(TOC_MAKESDIR)/TARBALL.make ifeq (,$(TAR_BIN)) $(warning you must define TAR_BIN before using the TARBALL targets. Try running the gnu_tar toc test.) TARBALL: $(patsubst %,tar-%,$(TARBALL_TARGETS)): else TARBALL_RULES_GENERATOR = $(TOC_MAKESDIR)/makerules.TARBALL $(TARBALL_RULES_GENERATOR): $(TARBALL_MAKEFILE): TARBALL_INCFILE = .toc.TARBALL.make CLEAN_FILES += $(TARBALL_INCFILE) $(TARBALL_INCFILE): $(TARBALL_RULES_GENERATOR) $(TARBALL_MAKEFILE) Makefile ifeq (1,$(MAKING_CLEAN)) @echo "$(MAKECMDGOALS): skipping TARBALL rules generation." else @echo "Generating TARBALL rules."; \ $(call toc_generate_rules,TARBALL,$(TARBALL_TARGETS)) > $@ endif -include $(TARBALL_INCFILE) .PHONY: TARBALL TARBALL: endif # ^^^ end no-tar guard --- NEW FILE: makerules.LYX_EXPORT --- #!/bin/sh # For use in generating rules for LYX_EXPORT.make. test 0 = ${#@} && { echo "usage: $0 file1.lyx [... fileN.lyx]" exit 1 } thisapp="\$(TOC_MAKESDIR)/makerules.LYX_EXPORT" filters_makefile="\$(TOC_MAKESDIR)/LYX_EXPORT.make" cat <<EOF ############################## LYX_EXPORT rules: ifeq (,\$(LYX_BIN)) \$(error LYX_BIN must be set to the path to lyx!) endif LYX_EXPORT_FORMATS ?= html pdf EOF for t in "$@"; do echo "###################### ${t}_lyx:" cat <<EOF ${t}_lyx_FORMATS ?= \$(LYX_EXPORT_FORMATS) ${t}_lyx_EXPORT_ARGS ?= \$(LYX_EXPORT_ARGS) LYX_EXPORT-${t}: @for f in \$(${t}_lyx_FORMATS); do \\ echo "Exporting ${t}.lyx to ${t}.\$\$f..."; \\ \$(LYX_BIN) -e \$\$f ${t}.lyx \$(${t}_lyx_EXPORT_ARGS) >/dev/null || exit; \\ done .PHONY: LYX_EXPORT-${t} LYX_EXPORT: LYX_EXPORT-${t} CLEAN_FILES += \$(patsubst %,${t}.%,\$(${t}_lyx_EXPORT_FORMATS)) EOF done cat <<EOF # implement the LYX_EXPORT-post target to do post-export processing, # like renaming foo.XXX to foo-\$(PACKAGE_NAME).XXX. LYX_EXPORT-post: LYX_EXPORT: LYX_EXPORT-post EOF echo "############################## end LYX_EXPORT rules" --- NEW FILE: DOXYGEN.make --- #!/do/not/make # a (big) snippet to build API docs using doxygen # Much of this process was written by Rusty Ballinger. # # Edit the file Doxyfile template, Doxyfile.at, using # @at-token@ conventions. # # Define: # DOXYGEN_PREDEF = predfined C vars # DOXYGEN_ATPARSE_ARGS = list of args to pass to the @at-parser@ # Some globally-defined vars are pre-set. # In particular you may want to add: # DOXYGEN_INPUT="index.txt $(top_includesdir)/yourincludes)" # DOXYGEN_FILTER=/path/to/filter (may be left blank) # Useful sometimes for perl/sed'ing, e.g., C macros in API docs. # # Sample: # INCLUDES_DIRS = $(addprefix $(top_includesdir)/,lib1 otherlib) # # DOXYGEN_PREDEF = \ # HAVE_CONFIG_H=1 # # DOXYGEN_ATPARSE_ARGS = \ # DOXYGEN_INPUT="index.txt $(INCLUDES_DIRS)" # # Of course your Doxyfile.at must have the appropriate @tokens@ in it, # but the one shipped with this file is already set up for you. ifeq (,$(DOXYGEN_BIN)) $(error The variable DOXYGEN_BIN must be set before including this file.) endif DOXYFILE = Doxyfile DOXYGEN_HTML_OUTDIR ?= ./doxygen DOXYGEN_IN = Doxyfile.at DIST_FILES += $(DOXYGEN_IN) index.txt DOXYGEN_INSTALL_DIRNAME ?= doxygen-$(PACKAGE_NAME)-$(PACKAGE_VERSION) docs: doxygen clean: clean-doxygen install: install-doxygen DOXYGEN_ATPARSE_ARGS += \ top_srcdir="${top_srcdir}" \ top_libdir="${top_libdir}" \ top_includesdir="${top_includesdir}" \ PERL="$(PERL)" \ PACKAGE_NAME="$(PACKAGE_NAME)" \ PACKAGE_VERSION="$(PACKAGE_VERSION)" \ PREDEFINED="$(DOXYGEN_PREDEF)" \ DOXYGEN_FILTER="$(DOXYGEN_FILTER)" \ DOXYGEN_HTML_OUTDIR="$(DOXYGEN_HTML_OUTDIR)" DOXYGEN_MAKE = $(toc_makesdir)/DOXYGEN.make atparser = $(top_srcdir)/toc/bin/atsign_parse $(top_srcdir)/configure: $(DOXYFILE): $(DOXYGEN_FILTER) $(DOXYGEN_IN) Makefile $(top_srcdir)/configure @echo "Creating $@."; \ $(call toc_atparse_file,$(DOXYGEN_IN),$@, \ $(DOXYGEN_ATPARSE_ARGS) \ ) CLEAN_FILES += $(DOXYFILE) INSTALL_DEST_DOXYGEN = $(INSTALL_DOCS_DEST) DISTCLEAN_FILES += $(DOXYFILE) doxygen: clean-doxygen $(DOXYFILE) $(DOXYGEN_BIN) @echo HTML output is in $(DOXYGEN_HTML_OUTDIR). clean-doxygen: -rm -fr $(DOXYGEN_HTML_OUTDIR) latex doxygen_finaldest = $(INSTALL_DOCS_DEST)/$(DOXYGEN_INSTALL_DIRNAME) install-doxygen: doxygen @echo "Installing HTML docs to $(doxygen_finaldest)" @test -d $(doxygen_finaldest) && exit 0; rm -fr $(doxygen_finaldest) @test -d $(INSTALL_DOCS_DEST) && exit 0; mkdir -p $(INSTALL_DOCS_DEST) @cp -r $(DOXYGEN_HTML_OUTDIR) $(doxygen_finaldest) uninstall-doxygen: @echo "Uninstalling doxgen-generated docs: $(doxygen_finaldest)" @-test -d $(doxygen_finaldest) || exit 0; rm -fr $(doxygen_finaldest) uninstall: uninstall-doxygen # all: docs --- NEW FILE: toc.qmake.at --- # toc.qmake.at: template makefile for toc.qmake, part of the # toc build process. This is filtered at the end of the configure # process. toc.qmake may be included by your qmake files. # # many of the $$vars seen here come from toc.@PACKAGE_NAME@.make, # and all @TOKENS@ are replaced at configure-time. top_srcdir = @TOP_SRCDIR@ include( $$top_srcdir/toc.@PACKAGE_NAME@.configure.make ) QTDIR = @QTDIR@ QTBINDIR = @QTBINDIR@ QTINCDIR = @QTINCDIR@ QTLIBDIR = @QTLIBDIR@ # -lqt (or -lqt-mt?) if we have Qt, nothing if we don't. LQT = @LQT@ UIC = @UIC@ MOC = @MOC@ QMAKE = @QMAKE@ ############################ most of this comes from the gnu_cpp_tools toc test: CC = @CC@ INCLUDES += @INCLUDES@ # C preprocessor flags, used in compiling C & C++ files. CPPFLAGS += @CPPFLAGS@ CPPFLAGS += $$INCLUDES -DHAVE_CONFIG_H=1 # Optimization flags (-g or -On) used in compiling C & C++ files. OPT = @OPT@ # Warning flags (-Wall, -Werror, -woff, etc.) used in compiling C & C++ files. WARN = @WARN@ # C flags, used in compiling C files. Includes $$OPT and $$WARN. QMAKE_CFLAGS += @CFLAGS@ QMAKE_CFLAGS += $$OPT $$WARN # C++ flags, used in compiling C++ files. Includes $$OPT and $$WARN. QMAKE_CXXFLAGS += @CXXFLAGS@ QMAKE_CXXFLAGS += $$OPT $$WARN # ld flags, used in linking binaries. QMAKE_LFLAGS += @LDFLAGS@ ########################### include( $$top_srcdir/toc.@PACKAGE_NAME@.qmake ) --- NEW FILE: SHARED_LIBS.make --- # Links objects into a dynamically-linked library using $(CXX) # (only tested with 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! # foo_so_INSTALL_DEST = # optional installation path. Defaults to $(INSTALL_LIBEXECS_DEST) # foo_so_INSTALL = 0 # optional: suppresses generation of installation rules. i.e., # foo.so will not be installed. # include $(TOC_MAKESDIR)/SHARED_LIBS.make # # If foo_so_VERSION is not set then 0.0.0 is assumed. # # Run: # all: SHARED_LIBS # # 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 call()able function # $1 = basename # $2 = extra args for the linker toc_link_shared_lib = { soname=$(1).so; wholename=$${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR).$($(1)_so_PATCH); \ stamp=$${soname}.$($(1)_so_MAJOR); \ test x = "x$($(1)_so_MAJOR)" && { wholename=$${soname}; stamp=$(1).so;}; \ cmd="$(CXX) $(CXXFLAGS) $(LDFLAGS) $($(1)_LDFLAGS) -o $${wholename} -rdynamic -shared \ -Wl,-soname,$${stamp} $($(1)_so_OBJECTS) $(SHARED_LIBS_OBJECTS) $(SHARED_LIBS_LDADD) $($(1)_so_LDADD) $(2)"; \ test x = "x$(CCDV_BIN)" && 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 = $(TOC_MAKESDIR)/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) ifeq (1,$(MAKING_CLEAN)) @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: LYX_EXPORT.make --- #!/do/not/make # # A toc Makefile snippet to export input files using LyX (http://www.lyx.org). # # Usage: # # LYX_EXPORT = mylyxfile myotherfile ... (WITHOUT file extensions) # LYX_EXPORT_FORMATS = format list, as expected by 'lyx -e XXX'. Defaults to 'html pdf'. # LYX_EXPORT_ARGS = optional args to pass to lyx # # optional: mylyxfile_lyx_FORMATS = defaults to LYX_EXPORT_FORMATS # # optional: mylyxfile_lyx_EXPORT_ARGS = defaults to LYX_EXPORT_ARGS # include $(TOC_MAKESDIR)/LYX_EXPORT.make # # all: LYX_EXPORT # # Requires: # LYX_BIN = /path/to/lyx # Any exporters which lyx may need. LYX_EXPORT_MAKE = $(TOC_MAKESDIR)/LYX_EXPORT.make LYX_EXPORT_RULES_GENERATOR = $(TOC_MAKESDIR)/makerules.LYX_EXPORT LYX_EXPORT_INCFILE = .toc.LYX_EXPORT.make CLEAN_FILES += $(LYX_EXPORT_INCFILE) $(LYX_EXPORT_INCFILE): $(LYX_EXPORT_RULES_GENERATOR) $(LYX_EXPORT_MAKE) Makefile ifeq (1,$(MAKING_CLEAN)) @echo "$(MAKECMDGOALS): skipping LYX_EXPORT rules generation." else @echo "Generating LYX_EXPORT rules."; \ $(call toc_generate_rules,LYX_EXPORT,$(LYX_EXPORT)) > $@ endif -include $(LYX_EXPORT_INCFILE) .PHONY: LYX_EXPORT LYX_EXPORT: lyx: LYX_EXPORT --- NEW FILE: INSTALL_XXX.make --- #!/do/not/make # # To be included from the shared toc makefile. # Creates un/install rules for sets of files. # # 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 (some list you can find in this makefile) it # creates 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_X_DEST = $(prefix)/$(PACKAGE_NAME)/bin # INSTALL_X_INSTALL_FLAGS = -m 0775 # # To add new installation groups to this file do the following: # # - Add an MYNEWGROUP='install/path' entry to the var INSTALL_XXX_PATHS. # # - Add INSTALL_MYNEWGROUP_INSTALL_FLAGS var, following the conventions # set by the other ...INSTALL_FLAGS vars in this file. # # Installation can be further customized by using the toc_make_xxx # call()able functions defined below... # ######################################################################## 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. \ Normally it will be set by the toc_core_tests configure test.) endif #INSTALL_BINS_SUFFIX ?= #ifeq (1,$(configure_with_CYGWIN)) #INSTALL_BINS_SUFFIX = .exe #endif ############################################################ # toc_make_install call()able: # $1=file list # $2=destdir. The global $(DESTDIR) is prepended to it # $3=flags for $(INSTALLER_BIN) toc_make_install = test "x$(1)" = x && exit 0; \ dest="$(DESTDIR)$(2)"; \ test -d "$$dest" || mkdir -p "$$dest" || exit; \ for b in $(1) "x"; do test "x$$b" = "xx" && break; \ b=$$(basename $$b); \ target="$$dest/$$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 = "x$(1)" && exit 0; \ dest="$(DESTDIR)$(2)"; \ test -d "$$dest" || mkdir -p "$$dest" || exit; \ for b in $(1) ""; do test -z "$$b" && continue; \ b="$$(basename $$b)"; \ target="$$dest/$$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; \ dest="$(DESTDIR)$(2)"; \ test -e "$$dest" || exit 0; \ for b in $(1) ""; do test -z "$$b" && continue; \ fp="$$dest/$$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; \ dest="$(DESTDIR)$(2)"; \ test -d "$$dest" || mkdir -p "$$dest" || exit; \ for b in $(1) ""; do test -z "$$b" && continue; \ target="$$dest/$$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; \ dest="$(DESTDIR)$(5)"; \ test -d "$$dest" || mkdir -p "$$dest" || exit; \ wholename=$(1).$(2).$(3).$(4); \ target="$$dest"/$$wholename; \ test $$wholename -ef $$target || { \ echo "Installing/symlinking $$target"; \ cmd="$(INSTALLER_BIN) -m 0755 $$wholename $$target"; \ $$cmd || exit; \ }; \ cd "$$dest"; \ 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); \ # } ############# some phony targets... .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-.: ############# TOC_INSTALL_TARGET_BASENAMES += BINS SBINS LIBS PACKAGE_LIBS LIBEXECS HEADERS PACKAGE_HEADERS PACKAGE_DATA DOCS \ ############ internal shortcuts: 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_MAN1_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_MAN2_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_MAN3_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_MAN4_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_MAN5_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_MAN6_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_MAN7_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_MAN8_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_PKGCONFIG_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) ################# ######################################################################## # installation paths, in the format expected by makerules.INSTALL_XXX # They should be relative to ${prefix}. INSTALL_XXX_PATHS += \ 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)' \ MAN1='share/man/man1' \ MAN2='share/man/man2' \ MAN3='share/man/man3' \ MAN4='share/man/man4' \ MAN5='share/man/man5' \ MAN6='share/man/man6' \ MAN7='share/man/man7' \ MAN8='share/man/man8' \ PKGCONFIG='lib/pkgconfig' # INSTALL_XXX_PATHSNotes: # # - LIBEXECS=lib is intentional: i figure that since there is no /usr/libexec # nor /libexec, the traditional usage of LIBEXEC is probably "broken". # # - PKGCONFIG is data files for the pkg-config tool. ######################################################################## ################ Internal use: # 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). INSTALL_MAKEFILE = $(TOC_MAKESDIR)/INSTALL_XXX.make INSTALL_RULES_FILE = $(top_srcdir)/.toc.INSTALL_XXX.make INSTALL_XXX_GENERATOR = $(TOC_MAKESDIR)/makerules.INSTALL_XXX $(INSTALL_RULES_FILE): $(INSTALL_MAKEFILE) $(INSTALL_XXX_GENERATOR) ifeq (1,$(MAKING_CLEAN)) @echo "$(MAKECMDGOALS): skipping INSTALL_XXX rules generation." else @echo "Generating rules for INSTALL_XXX."; \ $(call toc_generate_rules,INSTALL_XXX,\ $(INSTALL_XXX_PATHS) \ ) > $@ endif -include $(INSTALL_RULES_FILE) deps: $(INSTALL_RULES_FILE) ################# --- NEW FILE: makerules.QMAKE2MAKE --- #!/bin/bash # Creates some makefile code for the $(QMAKE2MAKE) var. # Intended for use with QMAKE2MAKE.make make_pre="make." # prefix for generated makefiles qmake_suf=".qmake" # suffix for input qmake files. test -z "$1" && { echo "usage: $0 qmakefile1 [qmakefile2 ...]" echo "Pass the names of *${qmake_suf} files, without the ${qmake_suf} extension." exit 1 } cat <<EOF ######################################################################## # Automatically generated QMAKE2MAKE rules: # $0 $@ EOF for q in $@; do qmf="${make_pre}${q}" qpro="${q}${qmake_suf}" if test ! -e ${qpro}; then echo "$0: The qmake file '${qpro}' does not exist. " \ "Create it or remove '${q}' from your QMAKE2MAKE variable." 1>&2 exit 2 fi cat <<EOF ${qmf}: ${qpro} $0 @cmd="\$(QMAKE) -o \$@ ${qpro}"; echo \$\$cmd; \$\$cmd qmake-${q}: \${MAKE} -f ${qmf} EOF for p in install uninstall first clean distclean staticlib mocables; do # echo "${p}:" qtgt="qmake-${q}-${p}" echo "${qtgt}: ${qmf}" echo -e "\t@echo \"Making target '${p}' in ${qmf}...\";" echo -e "\t\${MAKE} -f ${qmf} ${p}" if test "$p" = "distclean"; then echo -e "\t-rm ${qmf}" fi echo "${p}: ${qtgt}" done echo "qmake-all: qmake-${q}" done cat <<EOF # End QMAKE2MAKE rules for: $@ ######################################################################## EOF --- NEW FILE: headers_symlinks.make --- # Makefile snippet to create symlinks. # # sample usage: # default: all # HEADERS_SYMLINKS = $(wildcard somedir/*.h) # include path/to/this_file # all: links $(HEADERS_SYMLINKS): @test -e `basename $@` && exit 0; \ link="ln -s $@ ."; \ echo $$link; \ $$link || echo "link failed!" .PHONY: headers_links $(HEADERS_SYMLINKS) headers_symlinks: $(HEADERS_SYMLINKS) --- NEW FILE: RSYNC.make --- #!/do/not/make # # a toc snippet to help provide support for uploading stuff over rsync. # It expects $(RSYNC_BIN) to be set via the configure process. # # Author: stephan - sg...@us... # # Usage: # # Define: # # RSYNC_TARGETS = target1 [...targetN] # optional: RSYNC_FLAGS = flags to pass to scp, like -C to enable compression # optional: RSYNC_DEST = [user@remote:]/destination/path # optional: RSYNC_CHDIR = [path to cd to before starting] # # For each target in SCP_TARGETS you must define the following: # # target1_RSYNC_FILES = list of files/dirs to rsync # optional: target1_RSYNC_DEST = [user@remote:]/destination/path # optional: target1_RSYNC_FLAGS = takes precedence over RSYNC_FLAGS # optional: target1_RSYNC_CHDIR = [path to cd to before starting] # # xxx_RSYNC_CHDIR is an odd-case var, and is not required (it defaults # to .) # # At least one of RSYNC_DEST or target_RSYNC_DEST must be set, # and the target_RSYNC_DEST takes precedence. # # To run all RSYNC targets run one of: # make RSYNC # make rsync # # To run one of them: # make RSYNC-targetname # make rsync-targetname # RSYNC_MAKEFILE = $(TOC_MAKESDIR)/RSYNC.make ifeq (,$(RSYNC_BIN)) $(warning you must define RSYNC_BIN before using the RSYNC targets. Try running the rsync toc test.) RSYNC: $(patsubst %,rsync-%,$(RSYNC_TARGETS)): $(patsubst %,RSYNC-%,$(RSYNC_TARGETS)): else RSYNC_RULES_GENERATOR = $(TOC_MAKESDIR)/makerules.RSYNC $(RSYNC_RULES_GENERATOR): $(RSYNC_MAKEFILE): RSYNC_INCFILE = .toc.RSYNC.make CLEAN_FILES += $(RSYNC_INCFILE) $(RSYNC_INCFILE): $(RSYNC_RULES_GENERATOR) $(RSYNC_MAKEFILE) Makefile ifeq (1,$(MAKING_CLEAN)) @echo "$(MAKECMDGOALS): skipping RSYNC rules generation." else @echo "Generating RSYNC rules."; ... [truncated message content] |
From: stephan b. <sg...@us...> - 2004-12-22 19:03:10
|
Update of /cvsroot/pclasses/pclasses2/toc/tests/cpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6318/tests/cpp Log Message: Directory /cvsroot/pclasses/pclasses2/toc/tests/cpp added to the repository |
From: stephan b. <sg...@us...> - 2004-12-22 19:03:07
|
Update of /cvsroot/pclasses/pclasses2/toc/tests/c In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6318/tests/c Log Message: Directory /cvsroot/pclasses/pclasses2/toc/tests/c added to the repository |
From: stephan b. <sg...@us...> - 2004-12-22 19:01:44
|
Update of /cvsroot/pclasses/pclasses2/toc/sbin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6023/sbin Log Message: Directory /cvsroot/pclasses/pclasses2/toc/sbin added to the repository |
From: stephan b. <sg...@us...> - 2004-12-22 19:01:44
|
Update of /cvsroot/pclasses/pclasses2/toc/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6023/tests Log Message: Directory /cvsroot/pclasses/pclasses2/toc/tests added to the repository |
From: stephan b. <sg...@us...> - 2004-12-22 19:01:43
|
Update of /cvsroot/pclasses/pclasses2/toc/make In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6023/make Log Message: Directory /cvsroot/pclasses/pclasses2/toc/make added to the repository |
From: stephan b. <sg...@us...> - 2004-12-22 19:01:42
|
Update of /cvsroot/pclasses/pclasses2/toc/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6023/bin Log Message: Directory /cvsroot/pclasses/pclasses2/toc/bin added to the repository |
From: stephan b. <sg...@us...> - 2004-12-22 19:00:53
|
Update of /cvsroot/pclasses/pclasses2/toc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5829/toc Log Message: Directory /cvsroot/pclasses/pclasses2/toc added to the repository |
From: stephan b. <sg...@us...> - 2004-12-22 18:36:06
|
Update of /cvsroot/pclasses/pclasses2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32382 Added Files: autogen.sh Log Message: egg --- NEW FILE: autogen.sh --- #!/bin/sh if test ! -d admin; then mkdir admin fi export WANT_AUTOMAKE=1.8 export WNAT_AUTOCONF=2.5 if test -n `which autoreconf`; then autoreconf -fi else libtoolize -c -f aclocal $ACLOCALDIRS -I m4 autoheader automake --add-missing --copy autoconf -f fi rm COPYING rm -f config.cache |
From: Christian P. <cp...@us...> - 2004-12-22 18:04:03
|
Update of /cvsroot/pclasses/pclasses2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24669 Removed Files: configure Log Message: Remove auto-generated configure script --- configure DELETED --- |