The attached patch fixes bug 944:
src/frontends/xforms/forms/fdfix.sh uses fixed file names for temporary 
files, thus make dist on SMP fails. 
Fix is trivial -- all temporary files should have $$ (PID) appended to them.

Jean-Marc, please consider for 1.3.x

-- 
Angus
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.703
diff -u -p -r1.703 ChangeLog
--- src/frontends/xforms/ChangeLog	12 Mar 2003 22:17:49 -0000	1.703
+++ src/frontends/xforms/ChangeLog	13 Mar 2003 11:31:26 -0000
@@ -1,3 +1,9 @@
+2003-03-13  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* forms/fdfix.sh: 
+	* forms/fdfixh.sed: fix #944 by making the temporary filenames unique
+	and so enable reentrant builds on SMP machines.
+
 2003-03-12  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Dialogs.C:
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.23
diff -u -p -r1.23 fdfix.sh
--- src/frontends/xforms/forms/fdfix.sh	27 Nov 2002 17:15:23 -0000	1.23
+++ src/frontends/xforms/forms/fdfix.sh	13 Mar 2003 11:31:26 -0000
@@ -15,13 +15,17 @@
 
 INTRO_MESSAGE ()
 {
+test $# -eq 1 || {
+	echo "Expected a file name!"
+	exit 1
+}
+
 # Note that we can't create a variable containing this and then
 # echo it across because some machines require -e to recognize \n et al.
 # Other machines, of course output -e, it not being an option they
 # recognise ;-)
 
-# Set ${OUTPUT_FILE} to ${HOUT} or ${COUT} as appropriate
-cat - > ${OUTPUT_FILE} <<EOF
+cat - > $1 <<EOF
 // File generated by fdesign from ${FDFILE}
 // and modified by fdfix.sh for use by LyX.
 
@@ -69,23 +73,30 @@ HOUT=${BASENAME}.hpp
 # put the sorted, unique list in file ${EXTERN_FUNCS}
 # The contents of this file are used by ${FDFIXH} to replace the mess
 # output by fdesign
-EXTERN_FUNCS=extern.tmp
+# Note that we use unique file names for temp files to enable re-entrant
+# builds with SMP machines
+EXTERN_FUNCS=extern.$$
 sed -n 's/extern void \(.*\)/void \1/p' ${HIN} > ${EXTERN_FUNCS}
 
 if [ -s ${EXTERN_FUNCS} ]; then
-	sort -u ${EXTERN_FUNCS} > tmp
+	TMP=tmp.$$
+	sort -u ${EXTERN_FUNCS} > ${TMP}
 	echo "extern \"C\" {" > ${EXTERN_FUNCS}
-	cat tmp >> ${EXTERN_FUNCS}
+	cat ${TMP} >> ${EXTERN_FUNCS}
 	echo "}" >> ${EXTERN_FUNCS}
-	rm -f tmp
+	rm -f ${TMP}
 fi
 
-FDFIXH=${DIRNAME}/fdfixh.sed
+# First ensure that the sed script knows where to find ${EXTERN_FUNCS}
+FDFIXH=fdfixh.$$
+sed "s/EXTERN_FUNCS/${EXTERN_FUNCS}/" ${DIRNAME}/fdfixh.sed > ${FDFIXH}
 
-OUTPUT_FILE=${HOUT}; INTRO_MESSAGE
+INTRO_MESSAGE ${HOUT}
 
 sed -f ${FDFIXH} < ${HIN} >> ${HOUT}
-rm -f ${EXTERN_FUNCS}
+
+# Don't forget to clean up the temporary files.
+rm -f ${EXTERN_FUNCS} ${FDFIXH}
 
 # Patch the .h file if a patch exists
 if [ -f "${HPATCH}" ] ; then
@@ -122,8 +133,9 @@ FINAL_COUT=${BASENAME}.C
 
 # Pass 1. The bulk of the clean-up
 FDFIXC=${DIRNAME}/fdfixc.sed
-TMP=tmp
-OUTPUT_FILE=${TMP}; INTRO_MESSAGE
+
+TMP=tmp.$$
+INTRO_MESSAGE ${TMP}
 
 echo "#include <config.h>" >> ${TMP}
 echo "#include \"forms_gettext.h\"" >> ${TMP}
Index: src/frontends/xforms/forms/fdfixh.sed
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/fdfixh.sed,v
retrieving revision 1.9
diff -u -p -r1.9 fdfixh.sed
--- src/frontends/xforms/forms/fdfixh.sed	28 Nov 2002 11:59:28 -0000	1.9
+++ src/frontends/xforms/forms/fdfixh.sed	13 Mar 2003 11:31:26 -0000
@@ -29,14 +29,15 @@ s/[ 	]*$//
 
 
 # Immediately after line "#define FD_xxx_h_" that starts off the header file,
-# #include "fdesign_base.h" and append the contents of file "extern.tmp".
+# #include "fdesign_base.h" and append the contents of file EXTERN_FUNCS.
 # This latter is a sorted, unique list of any function declarations.
+# The actual name of the file is inserted by the parent shell script.
 /#define FD/{
 a\
 \
 #include "fdesign_base.h"\
 
-r extern.tmp
+r EXTERN_FUNCS
 }
 
 

Reply via email to