emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] Unbreak `make install' in leim/ when leim's ${INSTALLDIR} doesn'


From: Giorgos Keramidas
Subject: [PATCH] Unbreak `make install' in leim/ when leim's ${INSTALLDIR} doesn't exist
Date: Thu, 12 Oct 2006 02:22:54 +0300

The current `make install' target of the leim/ subdirectory has a subtle
problem when ${prefix}/share/emacs/22.0.50/leim does not exist at all.

After `make bootstrap' completes, running `make install' in leim/ fails
with the following error on a FreeBSD and a Solaris system here:

,----------------------------------------------------------------
| # make install
| if [ -d /opt/local/share/emacs/22.0.50/leim ] && [ x`(cd 
/opt/local/share/emacs/22.0.50/leim && /bin/pwd)` != x`(/bin/pwd)` ] ; then \
|   if [ -d /opt/local/share/emacs/22.0.50/leim ] ; then \
|     rm -rf /opt/local/share/emacs/22.0.50/leim/leim-list.el; \
|     rm -rf /opt/local/share/emacs/22.0.50/leim/quail 
/opt/local/share/emacs/22.0.50/leim/ja-dic ; \
|   else \
|     /home/keramida/tmp/emacs/leim/../mkinstalldirs 
/opt/local/share/emacs/22.0.50/leim; \
|   fi; \
|   echo "Copying leim files to /opt/local/share/emacs/22.0.50/leim ..." ; \
|   if [ x`(cd /home/keramida/tmp/emacs/leim && /bin/pwd)` = x`(/bin/pwd)` ] ; 
then \
|     tar -chf - leim-list.el quail ja-dic \
|         | (cd /opt/local/share/emacs/22.0.50/leim; umask 0; tar -xvf - && cat 
> /dev/null) ;\
|   else \
|     tar -chf - leim-list.el quail \
|         | (cd /opt/local/share/emacs/22.0.50/leim; umask 0; tar -xvf - && cat 
> /dev/null) ;\
|     cd /home/keramida/tmp/emacs/leim; \
|     tar -chf - quail/* ja-dic \
|         | (cd /opt/local/share/emacs/22.0.50/leim; umask 0; tar -xvf - && cat 
> /dev/null) ;\
|   fi; \ 
|   rm -rf /opt/local/share/emacs/22.0.50/leim/CVS        
/opt/local/share/emacs/22.0.50/leim/*/CVS; \
|   rm -f  /opt/local/share/emacs/22.0.50/leim/.cvsignore 
/opt/local/share/emacs/22.0.50/leim/*/.cvsignore; \
|   rm -f  /opt/local/share/emacs/22.0.50/leim/.arch-inventory 
/opt/local/share/emacs/22.0.50/leim/*/.arch-inventory; \
|   rm -f  /opt/local/share/emacs/22.0.50/leim/\#*        
/opt/local/share/emacs/22.0.50/leim/*/\#* ; \
|   rm -f  /opt/local/share/emacs/22.0.50/leim/.\#*       
/opt/local/share/emacs/22.0.50/leim/*/.\#* ; \
|   rm -f  /opt/local/share/emacs/22.0.50/leim/*~         
/opt/local/share/emacs/22.0.50/leim/*/*~ ; \
|   rm -f  /opt/local/share/emacs/22.0.50/leim/*.orig     
/opt/local/share/emacs/22.0.50/leim/*/*.orig ; \
| else true; fi
| unset CDPATH; \
| if [ -n "/usr/bin/gzip" ]; \
| then \
|    echo "Compressing *.el ..." ; \
|    (cd /opt/local/share/emacs/22.0.50/leim; for f in `find . -name "*.elc" 
-print`; do \
|         /usr/bin/gzip -9n `echo $f|sed 's/.elc$/.el/'` ; \
|     done) \
| else true; fi
| Compressing *.el ...
| sh: /opt/local/share/emacs/22.0.50/leim: does not exist
| *** Error code 1 (ignored)
| chmod -R a+r /opt/local/share/emacs/22.0.50/leim
| chmod: WARNING: can't access /opt/local/share/emacs/22.0.50/leim
| *** Error code 1 (ignored)
| # 
`----------------------------------------------------------------

The following patch fixes this.  The patch also contains the commit log
from the local tree I used for testing the fix.  Feel free to reuse it,
if it looks like a useful commit log.

--- patch start -------------------------------------------------
# HG changeset patch
# User George Keramidas <address@hidden>
# Date 1160608725 -10800
# Node ID 549c434ebfb50d1a4ca241c8498522c4660c9428
# Parent  34e5fff7519a59470fb437d5eb0a5421e9639e40
Unbreak `make install' in leim/ when leim's ${INSTALLDIR} doesn't exist.

What was happening with the old shell script called by the `install'
target was kind of tricky.  The command:

    if [ x`(cd ${INSTALLDIR} && /bin/pwd)` != x`(/bin/pwd)` ] ; then
      if [ -d ${INSTALLDIR} ] ; then \

contains a backquoted `cd' command into a directory which may not exist.
This causes the /bin/sh shell on Solaris (possibly other systems too),
to abort the entire if-then compound statement, because the `cd' command
fails before the if-then statement has a chance to run at all (i.e. at
backquote-expansion time).

Switching the order of the two if-then checks ensures that `cd' will
only run if ${INSTALLDIR} *really* exists, and `make install' in leim/
works again.

diff -r 34e5fff7519a -r 549c434ebfb5 leim/Makefile.in
*** a/leim/Makefile.in  Wed Oct 11 18:10:15 2006 +0300
--- b/leim/Makefile.in  Thu Oct 12 02:18:45 2006 +0300
***************
*** 216,247 ****
        sed -n '/^[^;]/ p' < ${srcdir}/leim-ext.el >> $@
  
  install: all
!       if [ x`(cd ${INSTALLDIR} && /bin/pwd)` != x`(/bin/pwd)` ] ; then \
!         if [ -d ${INSTALLDIR} ] ; then \
            rm -rf ${INSTALLDIR}/leim-list.el; \
            rm -rf ${INSTALLDIR}/quail ${INSTALLDIR}/ja-dic ; \
!         else \
!           ${srcdir}/${dot}${dot}/mkinstalldirs ${INSTALLDIR}; \
!         fi; \
!         echo "Copying leim files to ${INSTALLDIR} ..." ; \
!         if [ x`(cd ${srcdir} && /bin/pwd)` = x`(/bin/pwd)` ] ; then \
!           tar -chf - leim-list.el quail ja-dic \
!               | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
!         else \
!           tar -chf - leim-list.el quail \
!               | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
!           cd ${srcdir}; \
!           tar -chf - quail/* ja-dic \
!               | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
!         fi; \
!         rm -rf ${INSTALLDIR}/CVS        ${INSTALLDIR}/*/CVS; \
!         rm -f  ${INSTALLDIR}/.cvsignore ${INSTALLDIR}/*/.cvsignore; \
!         rm -f  ${INSTALLDIR}/.arch-inventory ${INSTALLDIR}/*/.arch-inventory; 
\
!         rm -f  ${INSTALLDIR}/\#*        ${INSTALLDIR}/*/\#* ; \
!         rm -f  ${INSTALLDIR}/.\#*       ${INSTALLDIR}/*/.\#* ; \
!         rm -f  ${INSTALLDIR}/*~         ${INSTALLDIR}/*/*~ ; \
!         rm -f  ${INSTALLDIR}/*.orig     ${INSTALLDIR}/*/*.orig ; \
!       else true; fi
        -unset CDPATH; \
        if [ -n "${GZIP_PROG}" ]; \
        then \
--- 216,247 ----
        sed -n '/^[^;]/ p' < ${srcdir}/leim-ext.el >> $@
  
  install: all
!       if [ -d ${INSTALLDIR} ] ; then \
!         if [ x`(cd ${INSTALLDIR} && /bin/pwd)` != x`(/bin/pwd)` ] ; then \
            rm -rf ${INSTALLDIR}/leim-list.el; \
            rm -rf ${INSTALLDIR}/quail ${INSTALLDIR}/ja-dic ; \
!         fi ; \
!       else \
!         ${srcdir}/${dot}${dot}/mkinstalldirs ${INSTALLDIR}; \
!       fi; \
!       echo "Copying leim files to ${INSTALLDIR} ..." ; \
!       if [ x`(cd ${srcdir} && /bin/pwd)` = x`(/bin/pwd)` ] ; then \
!         tar -chf - leim-list.el quail ja-dic \
!               | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
!       else \
!         tar -chf - leim-list.el quail \
!               | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
!         cd ${srcdir}; \
!         tar -chf - quail/* ja-dic \
!               | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
!       fi; \
!       rm -rf ${INSTALLDIR}/CVS        ${INSTALLDIR}/*/CVS; \
!       rm -f  ${INSTALLDIR}/.cvsignore ${INSTALLDIR}/*/.cvsignore; \
!       rm -f  ${INSTALLDIR}/.arch-inventory ${INSTALLDIR}/*/.arch-inventory; \
!       rm -f  ${INSTALLDIR}/\#*        ${INSTALLDIR}/*/\#* ; \
!       rm -f  ${INSTALLDIR}/.\#*       ${INSTALLDIR}/*/.\#* ; \
!       rm -f  ${INSTALLDIR}/*~         ${INSTALLDIR}/*/*~ ; \
!       rm -f  ${INSTALLDIR}/*.orig     ${INSTALLDIR}/*/*.orig
        -unset CDPATH; \
        if [ -n "${GZIP_PROG}" ]; \
        then \
--- patch end ---------------------------------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]