From a1f2d080d0b27787805942e637d2cb003403fa62 Mon Sep 17 00:00:00 2001 From: "slamm%netscape.com" Date: Thu, 25 Feb 1999 19:21:29 +0000 Subject: [PATCH] Change myconfig to mozconfig. git-svn-id: svn://10.0.0.236/trunk@21952 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/build/autoconf/altoptions.m4 | 23 ++--- mozilla/build/autoconf/find-mozconfig.sh | 39 +++++++++ .../{load-myconfig.sh => load-mozconfig.sh} | 36 ++++---- .../{myconfig2defs.sh => mozconfig2defs.sh} | 84 +++++++------------ mozilla/client.mk | 28 +++---- 5 files changed, 109 insertions(+), 101 deletions(-) create mode 100755 mozilla/build/autoconf/find-mozconfig.sh rename mozilla/build/autoconf/{load-myconfig.sh => load-mozconfig.sh} (64%) rename mozilla/build/autoconf/{myconfig2defs.sh => mozconfig2defs.sh} (56%) diff --git a/mozilla/build/autoconf/altoptions.m4 b/mozilla/build/autoconf/altoptions.m4 index 758aff918f7..2b34dd79518 100644 --- a/mozilla/build/autoconf/altoptions.m4 +++ b/mozilla/build/autoconf/altoptions.m4 @@ -92,22 +92,13 @@ dnl This is used by webconfig to group options define(MOZ_ARG_HEADER, [# $1]) dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file -AC_DEFUN(MOZ_READ_MYCONFIG, +AC_DEFUN(MOZ_READ_MOZCONFIG, [AC_REQUIRE([AC_INIT_BINSH])dnl -# Read in 'myconfig.sh' script to set the initial options. -# See the load-myconfig.sh script for more details. -_topsrcdir=`dirname [$]0` -for _config in $MOZ_MYCONFIG \ - myconfig.sh \ - $_topsrcdir/myconfig.sh \ - $HOME/.mozmyconfig.sh -do - if test -f $_config; then - MOZ_MYCONFIG=$_config; - . $_topsrcdir/build/autoconf/load-myconfig.sh - break - fi -done]) +# Read in 'mozconfig.sh' script to set the initial options. +# See the load-mozconfig.sh script for more details. +TOPSRCDIR=`dirname [$]0` +PATH="$TOPSRCDIR/build/autoconf:$PATH" +. load-mozconfig.sh]) dnl This gets inserted at the top of the configure script -MOZ_READ_MYCONFIG +MOZ_READ_MOZCONFIG diff --git a/mozilla/build/autoconf/find-mozconfig.sh b/mozilla/build/autoconf/find-mozconfig.sh new file mode 100755 index 00000000000..4bc5c3a8cfa --- /dev/null +++ b/mozilla/build/autoconf/find-mozconfig.sh @@ -0,0 +1,39 @@ +#! /bin/sh +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1999 Netscape Communications Corporation. All Rights +# Reserved. +# + +# find-mozconfig.sh - Loads options from mozconfig.sh onto configure's +# command-line. The mozconfig.sh file is searched for in the +# order: +# if $MOZCONFIG is set, use that. +# Otherwise, use $TOPSRCDIR/mozconfig.sh +# Otherwise, use $HOME/.mozconfig.sh +# +topsrcdir=`cd \`dirname $0\`/../..; pwd` + +for _config in $MOZCONFIG \ + $MOZ_MYCONFIG \ + $topsrcdir/mozconfig.sh \ + $topsrcdir/myconfig.sh \ + $HOME/.mozconfig.sh \ + $HOME/.mozmyconfig.sh +do + if test -f $_config; then + echo $_config; + exit 0 + fi +done diff --git a/mozilla/build/autoconf/load-myconfig.sh b/mozilla/build/autoconf/load-mozconfig.sh similarity index 64% rename from mozilla/build/autoconf/load-myconfig.sh rename to mozilla/build/autoconf/load-mozconfig.sh index 0a6be74aa0d..fc49811df3e 100644 --- a/mozilla/build/autoconf/load-myconfig.sh +++ b/mozilla/build/autoconf/load-mozconfig.sh @@ -16,15 +16,15 @@ # Reserved. # -# load-myconfig.sh - Loads options from myconfig.sh onto configure's -# command-line. The myconfig.sh is searched for in the following -# order: $MOZ_MYCONFIG, $objdir/myconfig.sh, $topsrcdir/myconfig.sh. +# load-mozconfig.sh - Loads options from mozconfig.sh onto configure's +# command-line. See find-mozconfig.sh for how the config file is +# found # -# The options from myconfig.sh are inserted into the command-line +# The options from mozconfig.sh are inserted into the command-line # before the real command-line options. This way the real options -# will override any myconfig.sh options. +# will override any mozconfig.sh options. # -# myconfig.sh is a shell script. To add an option to configure's +# mozconfig.sh is a shell script. To add an option to configure's # command-line use the pre-defined function, ac_add_options, # # ac_add_options [ ... ] @@ -33,7 +33,7 @@ # # ac_add_options --with-pthreads --enable-debug # -# ac_add_options can be called multiple times in myconfig.sh. +# ac_add_options can be called multiple times in mozconfig.sh. # Each call adds more options to configure's command-line. # # Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com). @@ -43,12 +43,13 @@ ac_add_options() { for _opt do # Escape shell characters, space, tab, dollar, quote, backslash. - _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;'` + _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;s/@\([^@]*\)@/\$\1/g;'` + _opt=`echo $_opt | sed -e 's/@\([^@]*\)@/\$(\1)/g'` # Avoid adding duplicates case "$ac_options" in *"$_opt"* ) ;; - * ) myconfig_ac_options="$myconfig_ac_options $_opt" ;; + * ) mozconfig_ac_options="$mozconfig_ac_options $_opt" ;; esac done } @@ -60,8 +61,8 @@ mk_add_options() { } ac_echo_options() { - echo "Adding options from $MOZ_MYCONFIG:" - eval "set -- $myconfig_ac_options" + echo "Adding options from $MOZCONFIG:" + eval "set -- $mozconfig_ac_options" for _opt do echo " $_opt" @@ -72,7 +73,7 @@ ac_echo_options() { # Define load the options # ac_options= -myconfig_ac_options= +mozconfig_ac_options= # Save the real command-line options for _opt @@ -83,9 +84,14 @@ do ac_options="$ac_options \"$_opt\"" done -. $MOZ_MYCONFIG +# Call find-mozconfig.sh +# In params: $MOZCONFIG $HOME (old:$MOZ_MYCONFIG) +MOZCONFIG=`$TOPSRCDIR/build/autoconf/find-mozconfig.sh` -ac_echo_options 1>&2 +if [ "$MOZCONFIG" ]; then + . $MOZCONFIG + ac_echo_options 1>&2 +fi -eval "set -- $myconfig_ac_options $ac_options" +eval "set -- $mozconfig_ac_options $ac_options" diff --git a/mozilla/build/autoconf/myconfig2defs.sh b/mozilla/build/autoconf/mozconfig2defs.sh similarity index 56% rename from mozilla/build/autoconf/myconfig2defs.sh rename to mozilla/build/autoconf/mozconfig2defs.sh index f662005a85e..3e2502599b5 100755 --- a/mozilla/build/autoconf/myconfig2defs.sh +++ b/mozilla/build/autoconf/mozconfig2defs.sh @@ -16,94 +16,66 @@ # Reserved. # -# myconfig2defs.sh - Translates myconfig.sh into options for client.mk. +# mozconfig2defs.sh - Translates mozconfig.sh into options for client.mk. # Prints defines to stdout. # -# See load-myconfig.sh for more details +# See load-mozconfig.sh for more details # # Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com). - -# This functions needs to be kept in sync with the code in altoptions.sh. -# Eventually I will put it in some common place. -find_myconfig() { - for _config in $MOZ_MYCONFIG \ - ./myconfig.sh \ - $_topsrcdir/myconfig.sh \ - $HOME/.mozmyconfig.sh - do - if test -f $_config; then - MOZ_MYCONFIG=$_config; - break - fi - done +print_header() { + echo "# gmake" + echo "# This file is automatically generated for client.mk." + echo "# Do not edit. Edit $MOZCONFIG instead." + echo } ac_add_options() { for _opt do - # Escape shell characters, space, tab, dollar, quote, backslash. - _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;'` - - myconfig_ac_options="$myconfig_ac_options $_opt" - done -} - -mk_add_options() { - for _opt - do - # Escape shell characters, space, tab, dollar, quote, backslash. - _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;'` - - myconfig_mk_options="$myconfig_mk_options $_opt" - done -} - -ac_echo_options() { - echo "# gmake" - echo "# This file is automatically generated for client.mk." - echo "# Do not edit. Edit $MOZ_MYCONFIG instead." - echo - eval "set -- $myconfig_ac_options" - for _opt - do + # Escape shell characters, space, tab, dollar, quote, backslash, + # and substitute '@@' with '$(@' with '$( $out_file -fi - -if [ "$MOZ_MYCONFIG" ] +if [ "$MOZCONFIG" ] then - . $MOZ_MYCONFIG - ac_echo_options > $tmp_file + print_header >$tmp_file + . $MOZCONFIG >> $tmp_file + if cmp -s $tmp_file $out_file; then rm $tmp_file else - mv $tmp_file $out_file + mv -f $tmp_file $out_file fi +else + echo "# This file is automatically generated for client.mk." > $out_file fi + diff --git a/mozilla/client.mk b/mozilla/client.mk index 0436ec6525d..11c757e77cd 100644 --- a/mozilla/client.mk +++ b/mozilla/client.mk @@ -38,7 +38,7 @@ # clean (also clobber) # # The nspr library is handled as follows, -# Read $HOME/.mozmyconfig.sh (or $(TOPSRCDIR)/myconfig.sh) and +# Read $HOME/.mozconfig.sh (or $(TOPSRCDIR)/mozconfig.sh) and # get the directory specified by --with-nspr. # If the flag is not there, look for nspr in /usr/bin. # Otherwise, build from tip and install in $(OBJDIR)/dist/nspr @@ -58,10 +58,10 @@ CWD := $(shell pwd) ifeq (mozilla, $(notdir $(CWD))) ROOTDIR := $(shell dirname $(CWD)) -TOPSRCDIR := $(CWD) +TOPSRCDIR := $(CWD) else ROOTDIR := $(CWD) -TOPSRCDIR := $(CWD)/mozilla +TOPSRCDIR := $(CWD)/mozilla endif AUTOCONF := autoconf @@ -72,7 +72,7 @@ MAKE := gmake endif WEBCONFIG_URL := http://cvs-mirror.mozilla.org/webtools/build/config.cgi -WEBCONFIG_FILE := $(HOME)/.mozmyconfig.sh +WEBCONFIG_FILE := $(HOME)/.mozconfig.sh CONFIG_GUESS := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess) ifdef CONFIG_GUESS @@ -81,17 +81,17 @@ else IS_FIRST_CHECKOUT := 1 endif -# Load options from myconfig.sh +# Load options from mozconfig.sh # (See build pages, http://www.mozilla.org/build/unix.html, -# for how to set up myconfig.sh.) -MYCONFIG2DEFS := build/autoconf/myconfig2defs.sh +# for how to set up mozconfig.sh.) +MOZCONFIG2DEFS := build/autoconf/mozconfig2defs.sh run_for_side_effects := \ - $(shell if test ! -f $(TOPSRCDIR)/$(MYCONFIG2DEFS); then \ - cd $(ROOTDIR); \ - cvs co mozilla/$(MYCONFIG2DEFS); \ - fi; \ - $(TOPSRCDIR)/$(MYCONFIG2DEFS) $(TOPSRCDIR)/.client-defs.mk) --include $(TOPSRCDIR)/.client-defs.mk + $(shell cd $(TOPSRCDIR); \ + if test ! -f $(MOZCONFIG2DEFS); then \ + (cd ..; cvs co mozilla/$(MOZCONFIG2DEFS);) \ + fi; \ + $(MOZCONFIG2DEFS) .client-defs.mk) +include $(TOPSRCDIR)/.client-defs.mk ifdef MOZ_OBJDIR OBJDIR := $(MOZ_OBJDIR) @@ -284,7 +284,7 @@ build: nspr $(OBJDIR)/Makefile # Build & install nspr. Classic build, no autoconf. # Linux/RPM available. nspr: $(NSPR_INSTALL_DIR)/lib/libnspr21.so - @echo NSPR is installed in $(NSPR_INSTALL_DIR)/lib + @echo NSPR is installed in $(NSPR_INSTALL_DIR)/lib objdir=$(OBJDIR) $(NSPR_INSTALL_DIR)/lib/libnspr21.so: @-$(MKDIR) -p $(NSPR_INSTALL_DIR)