]> Pileus Git - ~andy/gtk/commitdiff
examples: build examples that are included in the docs
authorMatthias Clasen <mclasen@redhat.com>
Fri, 15 Oct 2010 16:37:21 +0000 (12:37 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 15 Oct 2010 17:02:50 +0000 (13:02 -0400)
We build the examples that are included in the 'getting started'
chapter of the docs to prevent them from bitrotting. Also
remove the awk scripts used to extract the old examples from
the tutorial, since the tutorial is gone. I'm still leaving
the examples themeselves in place, for possible inclusion in
'getting started' later on.

configure.ac
examples/Makefile.am [moved from examples/Makefile with 51% similarity]
examples/README.1ST [deleted file]
examples/extract.awk [deleted file]
examples/extract.sh [deleted file]
examples/find-examples.sh [deleted file]

index 52f36f9f416ecdf06b7926ade6f68ceb1b3efa43..8a678b54af3ffd2fc37f58148c60251fe00e46d4 100644 (file)
@@ -1640,6 +1640,7 @@ po-properties/Makefile.in
 demos/Makefile
 demos/gtk-demo/Makefile
 demos/gtk-demo/geninclude.pl
+examples/Makefile
 tests/Makefile
 docs/Makefile
 docs/reference/Makefile
similarity index 51%
rename from examples/Makefile
rename to examples/Makefile.am
index 6d54beabb2a3257767e002f1785309fb3fa21f70..e5a9f8d876b76ec4d2fd70baa1176560215327c4 100644 (file)
@@ -1,5 +1,5 @@
 
-SUBDIRS =      arrow \
+DIST_SUBDIRS =         arrow \
                aspectframe \
                base \
                buttonbox \
@@ -28,18 +28,20 @@ SUBDIRS =   arrow \
                spinbutton \
                statusbar \
                table \
-               tictactoe \
-               wheelbarrow
+               tictactoe
+# wheelbarrow
 
-all:
-       list='$(SUBDIRS)'; \
-       for subdir in $$list; do \
-         (cd $$subdir && $(MAKE)); \
-       done
+INCLUDES = \
+       -I$(top_srcdir)                         \
+       -I$(top_srcdir)/gdk                     \
+       -DGDK_DISABLE_DEPRECATED                \
+       -DGTK_DISABLE_DEPRECATED                \
+       $(GTK_DEBUG_FLAGS)                      \
+       $(GTK_DEP_CFLAGS)
 
-clean:
-       list='$(SUBDIRS)'; \
-       for subdir in $$list; do \
-         (cd $$subdir && $(MAKE) clean); \
-       done
+LDADD = \
+       $(top_builddir)/gdk/$(gdktargetlib)             \
+       $(top_builddir)/gtk/$(gtktargetlib)             \
+       $(GTK_DEP_LIBS)
 
+bin_PROGRAMS = hello-world window-default
diff --git a/examples/README.1ST b/examples/README.1ST
deleted file mode 100644 (file)
index f66a60a..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-GTK Example Code - Tony Gale <gale@gtk.org> 980623
---------------------------------------------------
-
-I have written an awk script to automatically extract the code
-examples from the GTK Tutorial (in sgml), so they only have to be
-changed in one place.
-
-It's called 'extract.awk', and there is a shell wrapper to invoke
-it called 'extract.sh'
-
-It takes the following switches:
- -c : Just do checking rather than output files
- -f <filename> : Extract a specific file
- -d : Extract file(s) to current directory
-
-Without the -d switch, the code will be placed in the appropriate
-sub-directory. Those sub-directories will be created if they do not
-exist.
-
-Without the -f switch, all code examples will be extracted.
-
-The shell wrapper assumes that the GTK Tutorial is in the 
-file "../docs/gtk_tut.sgml"
-
-It works by looking for sections of text in the tutorial surrounded
-by, for example:
-
-/* example-start helloworld helloworld.c */
-
-and
-
-/* example-end */
-
-Where "helloworld" is the directory into which the file will be
-placed (which can also be a directory spec like hello/hello1), and
-"helloworld.c" is the file name for the code.
-
-So, the code between these lines would be extracted to the file
-helloworld/helloworld.c
-
-It also handles replacing the sgml tag '&amp;' with '&'
diff --git a/examples/extract.awk b/examples/extract.awk
deleted file mode 100644 (file)
index a1efd67..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-# extract - extract C source files from GTK Tutorial
-# Copyright (C) Tony Gale 1998
-# Contact: gale@gtk.org
-#
-# Command Switches:
-# -c : Just do checking rather than output files
-# -f <filename> : Extract a specific file
-# -d : Extract files to current directory
-# -v : Verbose
-BEGIN {in_example=0; check=0; spec_example=""; do_output=0; flatten=0; verbose=0;
-       for (i=0 ; i < ARGC ; i++) {
-       if ( ARGV[i] == "-c" ) {
-         check = 1;
-         ARGV[i]="";
-       } else if ( ARGV[i] == "-f" ) {
-         spec_example=ARGV[i+1];
-         ARGV[i]="";
-         ARGV[i+1]="";
-         if ( length(spec_example) == 0 ) {
-           print "usage: -f <filename>";
-           exit;
-         }
-       } else if ( ARGV[i] == "-d" ) {
-         flatten = 1;
-         ARGV[i]="";
-       } else if ( ARGV[i] == "-v" ) {
-         verbose = 1;
-         ARGV[i] = "";
-       }
-       }
-}
-
-$2 == "example-end" && in_example == 0           { printf("\nERROR: multiple ends at line %d\n", NR) > "/dev/stderr";
-                                           exit}
-$2 == "example-end"                      { in_example=0; do_output=0 }
-
-in_example==1 && check==0 && do_output==1 { gsub(/&amp;/, "\\&", $0);
-                                           gsub(/&lt;/, "<", $0);
-                                           gsub(/&gt;/, ">", $0);
-                                           print $0 >file_name } 
-
-$2 == "example-start" && in_example == 1 { printf("\nERROR: nested example at line %d\n", NR) > "/dev/stderr";
-                                          exit}
-
-$2 == "example-start"                   { in_example=1 }
-
-$2 == "example-start" && check == 0 \
-  { if ( (spec_example == "") || (spec_example == $4) ) {
-    if ( flatten == 0 ) {
-      if (file_name != "")
-          close(file_name);
-      file_name = sprintf("%s/%s",$3, $4);
-      command = sprintf("mkdir -p %s", $3);
-      system(command);
-    } else {
-      file_name = $4;
-    }
-    if (verbose == 1)
-      printf("%s\n", file_name);
-    do_output=1;
-  }
-  }
-
-
-END {}
-
-
-
diff --git a/examples/extract.sh b/examples/extract.sh
deleted file mode 100755 (executable)
index e7536a9..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /bin/sh
-# extract - extract C source files from GTK Tutorial
-# Copyright (C) Tony Gale 1998
-# Contact: gale@gtk.org
-#
-# extract.awk command Switches:
-# -c : Just do checking rather than output files
-# -f <filename> : Extract a specific file
-# -d : Extract files to current directory
-
-TUTORIAL=../docs/tutorial/gtk-tut.sgml
-
-if [ -x /usr/bin/gawk ]; then
- gawk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5
-else
- if [ -x /usr/bin/nawk ]; then
-  nawk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5
- else
-  if [ -x /usr/bin/awk ]; then
-   awk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5
-  else 
-   if [ -x /bin/awk ]; then
-    awk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5
-   else
-    echo "Can't find awk... please edit extract.sh by hand"
-   fi
-  fi
- fi
-fi
-
diff --git a/examples/find-examples.sh b/examples/find-examples.sh
deleted file mode 100755 (executable)
index 51de23f..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-find . -name CVS -prune -o \
-     -not \( -type d -o -name Makefile.am -o -name find-examples.sh \) -print |
-    sed 's%\./\(.*\)%  examples/\1  \\%'
-echo " examples/find-examples.sh"