build: rebuild idl if the pidl compiler is changed bso8865_rebuild_idl_on_pidl_change
authorDavid Disseldorp <ddiss@samba.org>
Sun, 15 Apr 2012 23:00:46 +0000 (01:00 +0200)
committerDavid Disseldorp <ddiss@samba.org>
Sun, 15 Apr 2012 23:00:46 +0000 (01:00 +0200)
In determining whether to compile a given .idl source file, build_idl.sh
currently checks:
a) that all build output files exist
b) build output files are newer than their corresponding .idl source

The .idl is rebuilt if either of the above conditions is false.
This logic does not catch the case where the pidl compiler itself is
changed. An IDL rebuild should occur in such a case.

https://bugzilla.samba.org/show_bug.cgi?id=8865

librpc/build_idl.sh

index afab91044bebd535fe29b90bdfc34d9f3ac4044c..23d7b3e329d4bc2a8ea7f1f827fd014691b68852 100755 (executable)
@@ -15,16 +15,17 @@ cd ${srcdir}
 
 [ -d $PIDL_OUTPUTDIR ] || mkdir -p $PIDL_OUTPUTDIR || exit 1
 
 
 [ -d $PIDL_OUTPUTDIR ] || mkdir -p $PIDL_OUTPUTDIR || exit 1
 
-PIDL="$PIDL $ARGS"
+PIDL_CMD="$PIDL $ARGS"
 
 if [ $FULL = 1 ]; then
        echo "Rebuilding all idl files"
 
 if [ $FULL = 1 ]; then
        echo "Rebuilding all idl files"
-       $PIDL $IDL_FILES || exit 1
+       $PIDL_CMD $IDL_FILES || exit 1
        exit 0
 fi
 
 ##
        exit 0
 fi
 
 ##
-## Find newer files rather than rebuild all of them
+## Find newer files rather than rebuild all of them. Also handle the case
+## where the pidl compiler itself is newer.
 ##
 
 list=""
 ##
 
 list=""
@@ -42,6 +43,10 @@ for f in ${IDL_FILES}; do
                list="$list $f"
                break
            }
                list="$list $f"
                break
            }
+           test "`find $PIDL -newer $PIDL_OUTPUTDIR/$o`" != "" && {
+               list="$list $f"
+               break
+           }
        done
 done
 
        done
 done
 
@@ -50,8 +55,8 @@ done
 ##
 
 if [ "x$list" != x ]; then
 ##
 
 if [ "x$list" != x ]; then
-       # echo "${PIDL} ${list}"
-       $PIDL $list || exit 1
+       # echo "${PIDL_CMD} ${list}"
+       $PIDL_CMD $list || exit 1
 fi
 
 cd ${oldpwd}
 fi
 
 cd ${oldpwd}