* make-package: Fix typo where tmpparent was used instead of
[bpt/emacs.git] / mac / make-package
index 759f165..dc05858 100755 (executable)
@@ -54,7 +54,7 @@ with_x=no
 comp_diskimage=yes
 self_contained=no
 app_symlink=no
-full_dist=no
+full_dist=yes
 keep_directory=no
 
 ac_prev=
@@ -83,9 +83,9 @@ do
     -with-x | --with-x)
        with_x=yes
        with_app=no ;;
-    --with-full-dist | -with-full-dist | -full-dist | -full)
-       full_dist=yes ;;
-    -self-contained | --with-self-contained-app | -sc)
+    --without-full-dist | -without-full-dist | -no-full-dist | -no-full)
+       full_dist=no ;;
+    --self-contained | -self-contained | --with-self-contained-app | -sc)
        self_contained=yes ;;
     -app-symlink | --app-symlink | -symlink | --symlink | --asl)
        app_symlink=yes ;;
@@ -95,7 +95,8 @@ do
        config_options="$config_options `expr "x$1" : 'x[^,]*,\(.*\)'`" ;;
     -M,* | -m,*)
        make_options="$make_options `expr "x$1" : 'x[^,]*,\(.*\)'`" ;;
-       
+    *)
+       display_usage=yes ;;
   esac
   shift
 done
@@ -126,8 +127,8 @@ Options:
       --with-x            Setup the install to use X Windows for its 
                           windowed display, instead of carbon.  Implies
                           --without-app.
-      --with-full-dist    Include all the .el files in the distribution.
-                          Default is to include only .elc files 
+      --without-full-dist Do not include all the .el files in the distribution.
+                          This is discouraged except if disk space is critical.
       --app-symlink       Have the Emacs.app executable be a symlink
                           to the install in [prefix]/bin/emacs and have
                           the emacs executable link to emacs-${version}
@@ -255,35 +256,38 @@ if test "$full_dist" == "no"; then
     find $sharedir/lisp $sharedir/leim -name "*.elc" -print | sed 's|\(.*\)\.elc$|/bin/rm -f \1.el|' | /bin/sh -s
 fi
 
-if test "$app_symlink" == "yes"; then
-    echo "Replacing bin/emacs with a symbolic link..."
-    # Fix emacs symlink
-    rm ${installprefix}/bin/emacs
-    ln -s $emacsname ${installprefix}/bin/emacs
-fi
-
 if test "$with_app" == "yes"; then
   echo "Creating Emacs.app application"
   tempappdir=${tempparentfull}${appsdir}
+  tempemapp=${tempappdir}/${emapp}/Contents/MacOS/Emacs
   mkdir ${tempappdir}
 
   ## Copy Emacs application
   cp -r Emacs.app ${tempappdir}
   ## Delete any CVS files
-  find ${tempappdir} -name "CVS" -type d -execdir rm -rf {} \;
+  find ${tempappdir} -name "CVS" -type d -exec rm -rf {} \;
+
   ## Have application be a symlink to ${prefix}/bin/emacs
   if test "$app_symlink" == "yes"; then
     echo "Creating application symlink"
-    tempemapp=${tempappdir}/${emapp}/Contents/MacOS/Emacs
     rm ${tempemapp}
-    if test "$self_contained" = "yes"; then
-       ln -s ../../Contents/Resources/bin/${emacsname} ${tempemapp}
-    else
-       ln -s ${prefix}/bin/${emacsname} ${tempemapp}
-    fi
+    ln -s ${prefix}/bin/${emacsname} ${tempemapp}
   fi
 fi
 
+if test "$self_contained" = "yes"; then
+    # Move shared files down to Resources directory
+    mv $installprefix/share/emacs/$version/* $installprefix
+    rm -rf $installprefix/share
+    # These directories might remain in Resources
+    mv $installprefix/bin $installprefix/../MacOS/bin
+    mv $installprefix/libexec $installprefix/../MacOS/libexec
+    # Make the application binary a hard link
+    rm $installprefix/../MacOS/Emacs
+    ln $installprefix/../MacOS/bin/emacs $installprefix/../MacOS/Emacs
+fi
+
+
 # Remove unnecessary .el files
 #if test "$full_dist" = no; then
 #fi
@@ -327,8 +331,8 @@ mkbom ${tempparentfull} Emacs.pkg/Contents/Resources/Emacs.bom
 echo "Generating sizes file"
 sizesfile=Emacs.pkg/Contents/Resources/Emacs.sizes
 
-numFiles=`du -a ${tmpparent} | wc -l`
-installedSize=`du -s ${tmpparent} | cut -f1`
+numFiles=`du -a ${tempparent} | wc -l`
+installedSize=`du -s ${tempparent} | cut -f1`
 compressedSize=`du -s Emacs.pkg | cut -f1`
 
 echo "NumFiles ${numFiles}" > ${sizesfile}