Attached is a first stab at getting the generation of those form_*.[Ch] files 
from the .fd ones again. Currently all is horribly broken if the build dir 
and src dir are different.

I decided that since the .[Ch] files are generated, they should go in the 
build tree.

I don't know how to get the xforms/Makefile.am to use them however. Pointers 
welcome.

It'd be good if we could through out the "updatesrc" option in the 
xforms/forms/Makefile.am and just run make normally. To do this, we need to 
ascertain whether $srcdir/form_xxx.fd is newer than $builddir/form_xxx.[Ch]. 
Again, pointers would be good ;-)

If we can do all this, then we can remove the xforms/form_xxx.[Ch] files from 
the repository.

Regards,
Angus
? src/frontends/xforms/forms/form_paragraph_new.fd.gz
? src/frontends/xforms/forms/form_preferences_new.fd.gz
Index: src/frontends/xforms/forms/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/Makefile.am,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile.am
--- src/frontends/xforms/forms/Makefile.am	8 Apr 2002 09:42:58 -0000	1.3
+++ src/frontends/xforms/forms/Makefile.am	9 Apr 2002 11:24:51 -0000
@@ -1,6 +1,7 @@
 include $(top_srcdir)/config/common.am
 
 SHELL = /bin/sh
+SCRIPT = $(srcdir)/fdfix.sh
 
 SUFFIXES = .fd
 
@@ -59,10 +60,11 @@ updatesrc: test
 	rm -f *.[hHcC] *.bak
 
 .fd.C:
-	${SHELL} ./fdfix.sh $<
+	${SHELL} ${SCRIPT} $<
 
 clean-local:
-	rm -f *.[hHcC] *.bak fdfixc_modified.sed
+	rm -f *.[HC] fdfixc_modified.sed \
+	rm -f $(srcdir)/*.[hc] $(srcdir)/*.bak
 
 distclean-local:
-	rm -f *.orig *.rej *~
+	rm -f $(srcdir)/*.orig $(srcdir)/*.rej $(srcdir)/*~
Index: src/frontends/xforms/forms/fdfix.sh
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/fdfix.sh,v
retrieving revision 1.11
diff -u -p -r1.11 fdfix.sh
--- src/frontends/xforms/forms/fdfix.sh	26 Nov 2001 10:19:55 -0000	1.11
+++ src/frontends/xforms/forms/fdfix.sh	9 Apr 2002 11:24:51 -0000
@@ -12,17 +12,25 @@ fi
 FDESIGN=fdesign
 
 # names of the files generated by fdesign and by running the sed scripts
-BASE=`basename $1 .fd`
+BASENAME=`basename $1 .fd`
 
-if [ $1 = $BASE ]; then
+if [ $1 = $BASENAME ]; then
     echo "Input file is not a .fd file. Cannot continue"
     exit 1
 fi
 
-CIN=$BASE.c
-COUT=$BASE.C
-HIN=$BASE.h
-HOUT=$BASE.H
+# need also the path to be able to find the files and sed scripts
+PATHNAME=`dirname $1`
+
+FDFILE=$BASENAME.fd
+CIN=$BASENAME.c
+COUT=$BASENAME.C
+HIN=$BASENAME.h
+HOUT=$BASENAME.H
+
+FDFIXH=$PATHNAME/fdfixh.sed
+FDFIXC=$PATHNAME/fdfixc.sed
+FDFIXC_MOD=fdfixc_modified.sed
 
 # Ascertain the class name from the name of the file
 # eg form_my_new_dialog -> FormMyNewDialog
@@ -31,7 +39,7 @@ SECTION="start"
 i=1
 while :
 do
-    SECTION=`echo $BASE | cut -d_ -f$i`
+    SECTION=`echo $BASENAME | cut -d_ -f$i`
     i=`expr $i + 1 `
 
     if [ $SECTION ]
@@ -45,19 +53,16 @@ do
 done
 
 # Create .c and .h files
-$FDESIGN -convert $1
-FDFIXH=fdfixh.sed
-FDFIXC=fdfixc.sed
-FDFIXC_MOD=fdfixc_modified.sed
+(cd $PATHNAME; $FDESIGN -convert $FDFILE)
 
 # Modify .h file for use by LyX
 echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $HOUT
-sed -f $FDFIXH < $HIN >> $HOUT
+sed -f $FDFIXH < $PATHNAME/$HIN >> $HOUT
 
 # Patch the .h file if a patch exists
 if [ -f "$HOUT.patch" ] ; then
-    echo "Patching $HOUT with $HOUT.patch"
-    patch -s $HOUT < $HOUT.patch
+    echo "Patching $HOUT with $HIN.patch"
+    patch -s $HOUT < $PATHNAME/$HIN.patch
 fi
 
 # Modify the .c file sed-script
@@ -70,14 +75,14 @@ echo "#include <config.h>" >> $COUT
 echo "#include \"xforms_helpers.h\"" >> $COUT
 echo "#include \"gettext.h\"" >> $COUT
 
-grep bmtable $CIN > /dev/null
+grep bmtable $PATHNAME/$CIN > /dev/null
 if [ $? -eq 0 ]; then
     echo "#include \"bmtable.h\"" >> $COUT
 fi
 
 echo >> $COUT
 
-sed -f $FDFIXC_MOD < $CIN >> $COUT
+sed -f $FDFIXC_MOD < $PATHNAME/$CIN >> $COUT
 
 # Patch the .C file if a patch exists
 if [ -f "$COUT.patch" ] ; then
@@ -86,5 +91,5 @@ if [ -f "$COUT.patch" ] ; then
 fi
 
 # Clean up, to leave .C and .h files
-rm -f $CIN $HIN $FDFIXC_MOD
+rm -f $PATHNAME/$CIN $PATHNAME/$HIN $FDFIXC_MOD
 mv $HOUT $HIN

Reply via email to