[Freeswitch-svn] [commit] r7247 - in freeswitch/trunk: . scripts
Freeswitch SVN
stkn at freeswitch.org
Wed Jan 16 09:27:04 EST 2008
Author: stkn
Date: Wed Jan 16 09:27:03 2008
New Revision: 7247
Modified:
freeswitch/trunk/Makefile.am
freeswitch/trunk/scripts/fsxs.in
Log:
The fsxs tool (sort of apxs for FreeSWITCH) is back from the dead.
Changes include an extended usage message and support for e.g. "fsxs --cflags"
style calls to get one or more defined variables on one line (instead of the
"show" command; easier for scripting).
Modified: freeswitch/trunk/Makefile.am
==============================================================================
--- freeswitch/trunk/Makefile.am (original)
+++ freeswitch/trunk/Makefile.am Wed Jan 16 09:27:03 2008
@@ -157,7 +157,7 @@
libfreeswitch_la_LDFLAGS += -lodbc
endif
-bin_SCRIPTS = scripts/gentls_cert
+bin_SCRIPTS = scripts/gentls_cert scripts/fsxs
libs/libedit/src/.libs/libedit.a:
@@ -305,6 +305,27 @@
dox:
cd docs && doxygen $(PWD)/docs/Doxygen.conf
+scripts/fsxs: scripts/fsxs.in
+ @echo creating fsxs
+ @sed -e "s, at MODULES_DIR\@,$(PREFIX)/mod," \
+ -e "s, at LIB_DIR\@,$(PREFIX)/lib," \
+ -e "s, at BIN_DIR\@,$(PREFIX)/bin," \
+ -e "s, at INC_DIR\@,$(PREFIX)/include," \
+ -e "s, at CFG_DIR\@,$(PREFIX)/conf," \
+ -e "s, at DB_DIR\@,$(PREFIX)/db," \
+ -e "s, at PREFIX\@,$(PREFIX)," \
+ -e "s, at CC\@,$(CC)," \
+ -e "s, at LD\@,$(CC)," \
+ -e "s, at INSTALL\@,$(INSTALL)," \
+ -e "s, at MKINSTALLDIRS\@,$(mkdir_p)," \
+ \
+ -e "s|@CFLAGS\@|$(CFLAGS) `$(switch_srcdir)/libs/apr/apr-1-config --cflags --cppflags`|" \
+ -e "s|@INCLUDES\@|-I$(PREFIX)/include|" \
+ -e "s|@SOLINK\@|$(SOLINK)|" \
+ -e "s|@LDFLAGS\@|-L$(PREFIX)/lib|" \
+ -e "s|@LIBS\@|`$(switch_srcdir)/libs/apr/apr-1-config --libs` `$(switch_srcdir)/libs/apr-util/apu-1-config --libs`|" \
+ scripts/fsxs.in > scripts/fsxs
+
eclean: clean
rm -f `find . -type f -name \*~`
rm -f `find . -type f -name \.*~`
Modified: freeswitch/trunk/scripts/fsxs.in
==============================================================================
--- freeswitch/trunk/scripts/fsxs.in (original)
+++ freeswitch/trunk/scripts/fsxs.in Wed Jan 16 09:27:03 2008
@@ -52,14 +52,16 @@
}
sub fsxs_usage {
- print "FreeSwitch fsxs\n(C) 2006 Stefan Knoblich <stkn\@netdomination.org>\n";
+ print "FreeSwitch fsxs\n(C) 2006-2008 Stefan Knoblich <stkn\@netdomination.org>\n";
print "\n";
print "Usage:\n";
print "\t$0 compile [options] <file1 ...>\n";
print "\t$0 link [options] <target> <file1 ...>\n";
print "\t$0 build [options] <target> <file1 ...>\n";
- print "\t$0 install [options] <file1 ...>\n";
- print "\t$0 show <var1 ...>\n\n";
+ print "\t$0 install [options] <file1 ...>\n\n";
+ print "\t$0 show <var1>...[varN]\n";
+ print "\t$0 <--var1>...<--varN>\n\n";
+
print "Command description:\n";
print "\tcompile: Compile source file(s) into object file(s)\n";
print "\tlink: Create module from object file(s)\n";
@@ -80,6 +82,11 @@
print "\t--destdir Installation prefix [install]\n";
print "\n";
+ print "Variable names for \"fsxs show\" / \"fsxs --var\":\n";
+ print "\tcflags ldflags libs solink includes cc ld mkdir install\n";
+ print "\tprefix lib_dir modules_dir db_dir inc_dir cfg_dir bin_dir\n";
+ print "\n";
+
print "Examples:\n";
print "\t$0 compile --add-cflags=\"-DFOO=1 -DBAR\" mod_test.c mod_test2.c\n\n";
print "\t$0 link --add-ldflags=\"-ltest\" mod_test.so mod_test.o mod_test2.o\n\n";
@@ -168,23 +175,50 @@
}
}
+sub fsxs_showq {
+ my @varlist = @_;
+
+ if( $#varlist >= 0 ) {
+ foreach( @varlist ) {
+ if( defined $vars{$_} ) {
+ print "$vars{$_} ";
+ }
+ }
+ }
+}
+
#
# main part
#
if( $#ARGV < 0 ) {
fsxs_usage;
}
-chomp( $command = shift @ARGV );
-if( $command =~ /^install|build|link|compile|show$/ ) {
-
- if( $command =~ /^show|compile|install$/ ) {
- $needs_target = 0;
- }
+if( @ARGV[0] =~ /^\--.+$/ ) {
+ # 'show' shortcut for using fsxs in scripts
+ $needs_target = 0;
+ $command = "showq";
}
else {
- print STDERR "Unknown command: $command\n";
- fsxs_usage;
+ chomp( $command = shift @ARGV );
+
+ if( $command =~ /^install|build|link|compile|show$/ ) {
+
+ # add -lfreeswitch to the front of the library list
+ # we don't want it to be in the show / showq output
+ # but we still want to be able to override it with --set-libs
+ if( $command ne "show" ) {
+ $vars{LIBS} = "-lfreeswitch $vars{LIBS}";
+ }
+
+ if( $command =~ /^show|compile|install$/ ) {
+ $needs_target = 0;
+ }
+ }
+ else {
+ print STDERR "Unknown command: $command\n";
+ fsxs_usage;
+ }
}
# parse environment variables
@@ -196,7 +230,7 @@
foreach(@ARGV) {
chomp( $_ );
- if( $command ne 'show' )
+ if( $command ne "show" && $command ne "showq" )
{
if( /^\--add-cflags=(.*)$/ ) {
$vars{CFLAGS} = "$vars{CFLAGS} $1";
@@ -272,6 +306,9 @@
elsif( $command eq 'show' ) {
fsxs_show( @files );
}
+elsif( $command eq 'showq' ) {
+ fsxs_showq( @files );
+}
elsif( $command eq 'install' ) {
fsxs_install( @files );
}
More information about the Freeswitch-svn
mailing list