[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1239
Date       : Thu Jun  1 20:28:30 BST 2006

Changed paths:
   M /Trunk/XaraLX/Makefile.am
   M /Trunk/XaraLX/Scripts/build-resources.pl
   M /Trunk/XaraLX/configure.in
   M /Trunk/XaraLX/wxOil/Makefile.am

Added flags to control whether international resources are built, and whether svnversion is used
Tidied up configure.in


Diff:
Index: Trunk/XaraLX/configure.in
===================================================================
--- Trunk/XaraLX/configure.in	(revision 1238)
+++ Trunk/XaraLX/configure.in	(revision 1239)
@@ -8,35 +8,42 @@
 
 AM_BINRELOC
 
-DEBUG_FLAGS=""
-OPT_FLAGS="-O3"
-DebugEnable="no"
+# Process command line arguments
+
 AC_ARG_ENABLE(debug,
-[[  --enable-debug          Add more debug information and checks to executable]],
-[
-	if test $enableval = "yes"; then
-		DEBUG_FLAGS="-ggdb -D_DEBUG"
-		OPT_FLAGS="-O0"
-		DebugEnable="yes"
-	fi
-])
+              AS_HELP_STRING([--enable-debug],
+                             [Enable debug information and checks]),
+              DebugEnable="$enableval", DebugEnable="no")
 
-StaticEnable="no"
 AC_ARG_ENABLE(static-exec,
-[[  --enable-static-exec    Build a statically linked version of the executable]],
-[
-	if test $enableval = "yes"; then
-		StaticEnable="yes"
-		DebugEnable="no"
-	fi
-])
+              AS_HELP_STRING([--enable-static-exec],
+                             [Enable build of a static executable]),
+              StaticEnable="$enableval", StaticEnable="no")
 
-# Set language - this should be taken from a configure option
-# Note this MUST be in ISO8859-1 form
+AC_ARG_ENABLE(international,
+              AS_HELP_STRING([--disable-international],
+                             [Disable building of international resources]),
+              InternationalEnable="$enableval", InternationalEnable="yes")
 
-# Stop automake directly including stuff
-XRCINCLUDE=include
+AC_ARG_ENABLE(svnversion,
+              AS_HELP_STRING([--disable-svnversion],
+                             [Disable svn versioning]),
+              SvnVersionEnable="$enableval", SvnVersionEnable="yes")
 
+# Sort out compile lags
+if test "$DebugEnable" = "yes"; then
+	DEBUG_FLAGS="-ggdb -D_DEBUG"
+	OPT_FLAGS="-O0"
+else
+	DEBUG_FLAGS=""
+	OPT_FLAGS="-O3"
+fi
+
+# Note mysteriously we still use --enable-debug to control build flags even when static enabled
+if test "$StaticEnable" = "yes"; then
+	DebugEnable="no"
+fi
+
 # Setup our build flags (if not set by user)
 if test -z "$CFLAGS"; then
 	CFLAGS="-Wall -Wno-unknown-pragmas -g -fexceptions $OPT_FLAGS $DEBUG_FLAGS"
@@ -49,6 +56,13 @@
 	CXXFLAGS="$CXXFLAGS -Wall -Wno-unknown-pragmas -g -fexceptions $DEBUG_FLAGS"
 fi
 
+
+# Set language - this should be taken from a configure option
+# Note this MUST be in ISO8859-1 form
+
+# Stop automake directly including stuff
+XRCINCLUDE=include
+
 AC_PROG_CXX
 AC_PROG_INSTALL
 # We don't need dlopen right now and it's not supported on Darwin
@@ -134,7 +148,7 @@
 GTK_LIBS=""
 
 HAVE_WXRC="no"
-
+WXRC=""
 # Verify minimus requires
 vers=`echo $wxversion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'`
 if test -n "$vers" && test "$vers" -ge 2006003; then
@@ -153,23 +167,24 @@
 		AC_MSG_RESULT([not found])
 	fi
 
-	AC_MSG_CHECKING([wxWidgets wxrc utility])
-	WXRC="`$WXCONFIG --utility=wxrc`"
-
-	if test "$WXRC" = "" ; then
-		AC_MSG_RESULT([not found])
-		HAVE_WXRC="no"
-	else
-		HAVE_WXRC="yes"
-		AC_MSG_RESULT([found])
+	if test "$InternationalEnable" = "yes"; then
+		AC_MSG_CHECKING([wxWidgets wxrc utility])
+		WXRC="`$WXCONFIG --utility=wxrc`"
+	
+		if test "$WXRC" = "" ; then
+			AC_MSG_RESULT([not found, disabling international build])
+			HAVE_WXRC="no"
+			InternationalEnable="no"
+		else
+			HAVE_WXRC="yes"
+			AC_MSG_RESULT([found])
+		fi
 	fi
 
 else
 	AC_MSG_ERROR([wxWidgets 2.6.3 or newer is required])
 fi
 
-BUILD_POFILE=$HAVE_WXRC
-
 # Test for libxml2
 XML2CONFIG=xml2-config
 AC_ARG_WITH(xml2-config,
@@ -299,16 +314,23 @@
 esac
 
 PODIR=""
-if test "$BUILD_POFILE" = "yes" ; then
+BUILDRESFLAGS=""
+if test "$InternationalEnable" = "yes" ; then
 	AM_GNU_GETTEXT([external])
 	AM_GNU_GETTEXT_VERSION([0.14.3])
 	PODIR=po
+	BUILDRESFLAGS="-i $BUILDRESFLAGS"
 fi
 
+if test "$SvnVersionEnable" = "yes" ; then
+	BUILDRESFLAGS="-s $BUILDRESFLAGS"
+fi
+
 AM_CONDITIONAL(PRECOMPILE_ENABLE, [test "$PrecompileEnable" = "yes"])
 AM_CONDITIONAL(STATIC_ENABLE, [test "$StaticEnable" = "yes"])
 AM_CONDITIONAL(DARWIN_LINK, [test "$DarwinLink" = "yes"])
-AM_CONDITIONAL(BUILD_POFILE, [test "$BUILD_POFILE" = "yes"])
+AM_CONDITIONAL(INTERNATIONAL_ENABLE, [test "$InternationalEnable" = "yes"])
+AM_CONDITIONAL(SVNVERSION_ENABLE, [test "$SvnVersionEnable" = "yes"])
 
 AC_SUBST(TOPDIR)
 AC_SUBST(WX_LIBS)
@@ -321,5 +343,6 @@
 AC_SUBST(CDRAW_LIB_DIR)
 AC_SUBST(LIBXML2_LIBS)
 AC_SUBST(PODIR)
+AC_SUBST(BUILDRESFLAGS)
 
 AC_OUTPUT(Makefile PreComp/Makefile Kernel/Makefile wxOil/Makefile tools/Makefile wxXtra/Makefile po/Makefile.in)
Index: Trunk/XaraLX/Scripts/build-resources.pl
===================================================================
--- Trunk/XaraLX/Scripts/build-resources.pl	(revision 1238)
+++ Trunk/XaraLX/Scripts/build-resources.pl	(revision 1239)
@@ -25,6 +25,7 @@
                          build
    -i | --international- build internationalisation resources ; omit to
                          prevent wxrc / xgettext etc usage
+   -s                  - build svnversion
    --xgettext PATH     - pass alternate path to xgettext
    --wxrc PATH         - pass alternate path to wxrc
    --verbose           - be very loud about it
@@ -71,11 +72,13 @@
 my $version="";
 my $user="unknown";
 my $international=0;
+my $svnversionenable=0;
 
 GetOptions( "topdir|t=s" => \$topdir,
 	    "ouputdir|o=s" => \$outputdir,
 	    "force|f!" => \$force,
 	    "international|i!" => \$international,
+	    "svnversion|s!" => \$svnversionenable,
 	    "verbose|v+" => \$verbose,
 	    "version|n=s" => \$version,
 	    "user|u=s" => \$user,
@@ -106,6 +109,15 @@
 $omtime=(stat("$outputdir/resources.h"))[9]; # this may fail, in which case it looks like it was generated at the epoch
 $omtime+=0;
 
+my $potime=0;
+if ($international)
+{
+    # Use the xaralx.po time if it's earlier, to force a rebuild (common case - it's missing)
+    $potime=(stat("$outputdir/xrc/xaralx.po"))[9]; # this may fail, in which case it looks like it was generated at the epoch
+    $potime+=0;
+    $omtime=$potime if ($potime<$omtime);
+}
+
 # And the same thing for svnversion - we look at the cached file states. When we rebuild the cache we check
 # to see if this would result in a different svnversion. The .h file might not change as not every cache file change
 # results in a new svnversion.
@@ -123,6 +135,7 @@
 
 my $newer=0;
 my $svnewer=0;
+my $ponewer=0;
 
 my $f;
 foreach $f (@xrcfiles)
@@ -137,6 +150,10 @@
     {
 	$svnewer=1;
     }
+    if ((stat($f))[9] > $potime)
+    {
+	$ponewer=1;
+    }
 }
 
 foreach $f (@resfiles)
@@ -175,55 +192,76 @@
 # Firstly, let's find the svn version if one was specified (else we leave it)
 if ($version ne "")
 {
-    # First determine whether we need to do a rebuild of svnversion at all
-    # We look to see if any of the files passed on the command line are
-    # newer than svnversion.h
-
-    if (open(VCACHE,"$outputdir/svnversion.cache"))
+    if ($svnversionenable)
     {
-	while(<VCACHE>)
+	# First determine whether we need to do a rebuild of svnversion at all
+	# We look to see if any of the files passed on the command line are
+	# newer than svnversion.h
+	
+	if (open(VCACHE,"$outputdir/svnversion.cache"))
 	{
-	    next if /^\?/; # miss stuff not under version control
-	    # Note svn status prepends $topdir unless it's "." in which case it is not needed
-	    $f=substr($_, 40, -1);
-	    my @s;
-	    @s=stat($f);
-	    my $m;
-	    $m=$s[9]+0;
-	    next if (S_ISDIR($s[2])); # ignore directories
-	    print STDERR "Checking '$f' - mtime $m
" if ($verbose >1);
-	    if (($m == 0) || ($m > $svtime)) # catch case where file disappears
+	    while(<VCACHE>)
 	    {
-		$svnewer=1;
-		print STDERR "$f is NEWER, $m > $svtime 
" if ($verbose);
+		next if /^\?/; # miss stuff not under version control
+		# Note svn status prepends $topdir unless it's "." in which case it is not needed
+		$f=substr($_, 40, -1);
+		my @s;
+		@s=stat($f);
+		my $m;
+		$m=$s[9]+0;
+		next if (S_ISDIR($s[2])); # ignore directories
+		print STDERR "Checking '$f' - mtime $m
" if ($verbose >1);
+		if (($m == 0) || ($m > $svtime)) # catch case where file disappears
+		{
+		    $svnewer=1;
+		    print STDERR "$f is NEWER, $m > $svtime 
" if ($verbose);
+		}
 	    }
+	    close (VCACHE);
 	}
-	close (VCACHE);
+	else
+	{
+	    # No cache file
+	    $svnewer = 1;
+	}
     }
     else
     {
-	# No cache file
+	# svnversion not enabled - we still have to generate something
 	$svnewer = 1;
     }
-
+	
+	
     my $writeversion;
     my @svnversion;
     $writeversion=0;
 
     if ($svnewer || $force)
     {
-	print STDERR "Rebuilding svn version
";
-
-	# Generate the cache
-	system ("svn status -v $topdir > $outputdir/svnversion.cache");
-	
 	my $svnv;
-	$svnv=`svnversion $topdir`;
 	my $bdate;
-	$bdate= `date +"%d-%b-%y %H:%M"`;
-	chomp($bdate);
-	chomp($svnv);
-	print STDERR "svnversion gives $svnv
";
+	if ($svnversionenable)
+	{
+	    print STDERR "Rebuilding svn version
";
+	    
+	    # Generate the cache
+	    system ("svn status -v $topdir > $outputdir/svnversion.cache");
+	    
+	    $svnv=`svnversion $topdir`;
+	    $bdate= `date +"%d-%b-%y %H:%M"`;
+	    chomp($bdate);
+	    chomp($svnv);
+	    print STDERR "svnversion gives $svnv
";
+	}
+	else
+	{
+	    # erase the cache so if versioning is turned back on, it recreates it
+	    unlink("$outputdir/svnversion.cache");
+	   
+	    $svnv="0000";
+	    $bdate="00-00-00 00:00";
+	}
+
 	my $camversionmajor;
 	my $camversionminor;
 	($camversionmajor, $camversionminor)=split('.',$version);
@@ -323,23 +361,21 @@
     }
 }
 
-if (!$buildresources)
+my $ret;
+
+if ($buildresources)
 {
-    ok();
-    exit(0);
+    print STDERR "Rebuilding resources - new checksum $checksum
";
+    unlink ("$outputdir/xrc/$xaralanguage/xrc.check");
+    unlink ("$outputdir/xrc/xrc.check");
+
+    $ret=system("$topdir/Scripts/combinexrc.pl","-b","missing.png","-o","$outputdir/xrc/dialogs.xrc",@dialogfiles);
+    die "Failed to combine dialogs ($ret): $!" if ($ret);
+    $ret=system("$topdir/Scripts/combinexrc.pl","-b","missing.png","-t","-s","-o","$outputdir/xrc/strings.lst",@xrcfiles);
+    die "Failed to combine strings ($ret): $!" if ($ret);
 }
 
-print STDERR "Rebuilding resources - new checksum $checksum
";
-unlink ("$outputdir/xrc/$xaralanguage/xrc.check");
-unlink ("$outputdir/xrc/xrc.check");
-
-my $ret;
-$ret=system("$topdir/Scripts/combinexrc.pl","-b","missing.png","-o","$outputdir/xrc/dialogs.xrc",@dialogfiles);
-die "Failed to combine dialogs ($ret): $!" if ($ret);
-$ret=system("$topdir/Scripts/combinexrc.pl","-b","missing.png","-t","-s","-o","$outputdir/xrc/strings.lst",@xrcfiles);
-die "Failed to combine strings ($ret): $!" if ($ret);
-
-if ($international)
+if ($international && ($buildresources || $ponewer))
 {
     my @strings;
     open(STRINGS,"$outputdir/xrc/strings.lst") || die "Could not open strings.lst: $!";
Index: Trunk/XaraLX/wxOil/Makefile.am
===================================================================
--- Trunk/XaraLX/wxOil/Makefile.am	(revision 1238)
+++ Trunk/XaraLX/wxOil/Makefile.am	(revision 1239)
@@ -44,5 +44,5 @@
 # Ensure wxrc is set to something. If wxconfig can't find it, it becomes an empty string which will upset build-resources.pl
 WXRC := ${if @WXRC@,@WXRC@,echo}
 
-RESOURCEDUMMY := ${if ${strip ${shell $(TOPDIR)/Scripts/build-resources.pl -i -t $(TOPDIR) -o . --version $(VERSION) -x $(XARALANGUAGE) -u $(USER) --wxrc "$(WXRC)" } }, ,${error "Resource build failed"}}
+RESOURCEDUMMY := ${if ${strip ${shell $(TOPDIR)/Scripts/build-resources.pl @BUILDRESFLAGS@ -t $(TOPDIR) -o . --version $(VERSION) -x $(XARALANGUAGE) -u $(USER) --wxrc "$(WXRC)" } }, ,${error "Resource build failed"}}
 
Index: Trunk/XaraLX/Makefile.am
===================================================================
--- Trunk/XaraLX/Makefile.am	(revision 1238)
+++ Trunk/XaraLX/Makefile.am	(revision 1239)
@@ -73,11 +73,8 @@
 
 UNZIP = unzip
 
-version:
-	@make -CwxOil version
+release: all
 
-release: version all
-
 resources:
 	@make -CwxOil xrc/resources.xrs ; \
 	( rm -rf Resources ; mkdir -p Resources ; cd Resources ; $(UNZIP) -q ../wxOil/xrc/resources.xrs )


Xara