[PATCH] Build Carbon XEmacs with configure and make.

Malcolm Purvis malcolmp at xemacs.org
Wed Apr 16 02:11:33 EDT 2008


The partial patch below (which is missing ChangeLog entries, due to
problems that I'm having with patcher) adds full support for building
Carbon XEmacs into our normal configure and make scripts, eliminating
the need for the script carbon/build-app.sh.

To build Carbon XEmacs, the sequence is now:

$ ./configure --prefix=$HOME/Desktop/XEmacs.app --with-carbon --without-kkcc \
  --without-mc-alloc --with-mule --without-ldap --enable-error-checking=none \
  --with-optimization --with-cflags-optimization=-O2 
$ make
$ make install

The major user-visible change is how --prefix is interpreted when
--with-carbon is present.

In this case --prefix will refer to the top of the application bundle, rather
than the parent directory of bindir and friends.  It must also end in '.app'.
This means that the user continues to specify the top of the installation tree
via --prefix, even if the underlying structure is different to a normal UNIX
install.

If there is no objection to the change in meaning of --prefix I'll
commit a complete version of this soon.

Malcolm

diff -r 622675caf330 Makefile.in.in
--- a/Makefile.in.in	Sat Apr 05 14:41:43 2008 +0200
+++ b/Makefile.in.in	Wed Apr 16 16:06:22 2008 +1000
@@ -94,6 +94,16 @@ PROGNAME=@PROGNAME@
 PROGNAME=@PROGNAME@
 
 ## ==================== Where To Install Things ====================
+
+#ifdef HAVE_CARBON
+## Under carbon this is the top of the application bundle while prefix points
+## to the standard installation tree under
+## <carbon_prefix>/Contents/Resources.
+carbon_prefix=@carbon_prefix@
+carbon_contents=$(carbon_prefix)/Contents
+carbon_resources=$(carbon_contents)/Resources
+carbon_macos=$(carbon_contents)/MacOS
+#endif
 
 ## The default location for installation.  Everything is placed in
 ## subdirectories of this directory.  The default values for many of
@@ -388,6 +398,15 @@ install-only: ${MAKE_SUBDIR} check-featu
 
 install: all check-features install-arch-dep install-arch-indep
 
+#ifdef HAVE_CARBON
+install install-only: install-carbon-app
+
+install-carbon-app: mkdir
+	$(INSTALL_DATA) $(srcdir)/carbon/Info.plist $(carbon_contents)
+	$(INSTALL_DATA) $(srcdir)/carbon/PkgInfo $(carbon_contents)
+	$(INSTALL_DATA) $(srcdir)/carbon/Emacs.icns $(carbon_resources)
+#endif
+
 install-arch-dep: mkdir
 	for subdir in ${INSTALL_ARCH_DEP_SUBDIR}; do \
 	(cd ./$${subdir} && $(MAKE) $(RECURSIVE_MAKE_ARGS) install prefix=${prefix} \
@@ -411,8 +430,8 @@ install-arch-dep: mkdir
 	-chmod 0755 ${bindir}/${PROGNAME}
 #else
 # ifdef HAVE_CARBON
-	${INSTALL_PROGRAM} src/${PROGNAME} ${bindir}/../../MacOS/XEmacs
-	-chmod 0755 ${bindir}/../../MacOS/XEmacs
+	${INSTALL_PROGRAM} src/${PROGNAME} $(carbon_macos)/XEmacs
+	-chmod 0755  $(carbon_macos)/XEmacs
 	cd ${bindir} && $(RM) ./${PROGNAME}-${version} && ${LN_S} ../../MacOS/XEmacs ${PROGNAME}-${version}
 	cd ${bindir} && $(RM) ./${PROGNAME} && ${LN_S} ${PROGNAME}-${version} ./${PROGNAME}
 # else
@@ -502,6 +521,9 @@ mkdir: FRC.mkdir
 	  ${mandir} ${bindir} ${datadir} ${libdir} \
 #ifdef HAVE_SHLIB
 	  ${moduledir} ${sitemoduledir} \
+#endif
+#ifdef HAVE_CARBON
+    $(carbon_macos) \
 #endif
 	  ${sitelispdir}
 
diff -r 622675caf330 carbon/Emacs.icns
Binary file carbon/Emacs.icns has changed
diff -r 622675caf330 carbon/Info.plist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/carbon/Info.plist	Wed Apr 16 16:06:22 2008 +1000
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleDocumentTypes</key>
+	<array>
+		<dict>
+			<key>CFBundleTypeExtensions</key>
+			<array>
+				<string>*</string>
+			</array>
+			<key>CFBundleTypeName</key>
+			<string>All</string>
+			<key>CFBundleTypeOSTypes</key>
+			<array>
+				<string>****</string>
+			</array>
+			<key>CFBundleTypeRole</key>
+			<string>Viewer</string>
+		</dict>
+	</array>
+	<key>CFBundleExecutable</key>
+	<string>XEmacs</string>
+	<key>CFBundleIconFile</key>
+	<string>Emacs.icns</string>
+	<key>CFBundleIdentifier</key>
+	<string>org.xemacs</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleSignature</key>
+	<string>EMAx</string>
+	<key>CFBundleVersion</key>
+	<string>1.0</string>
+</dict>
+</plist>
diff -r 622675caf330 carbon/PkgInfo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/carbon/PkgInfo	Wed Apr 16 16:06:22 2008 +1000
@@ -0,0 +1,1 @@
+APPLEMAx
\ No newline at end of file
diff -r 622675caf330 carbon/README
--- a/carbon/README	Sat Apr 05 14:41:43 2008 +0200
+++ b/carbon/README	Wed Apr 16 16:06:22 2008 +1000
@@ -4,9 +4,12 @@ Building Carbon XEmacs
 Building Carbon XEmacs
 ----------------------
 
-In this directory type:
+In the top level directory of the XEmacs distribution, run the configure
+program as follows:
 
-  sh < build-app.sh
+$ ./configure --prefix=$HOME/Desktop/XEmacs.app --with-carbon --without-kkcc --without-mc-alloc --with-mule --without-ldap --enable-error-checking=none --with-optimization --with-cflags-optimization=-O2
+$ make
+$ make install
 
 Follow the instructions in the section "Installing Packages" below to
 install additional packages.
diff -r 622675caf330 carbon/XEmacs.app/Contents/Info.plist
--- a/carbon/XEmacs.app/Contents/Info.plist	Sat Apr 05 14:41:43 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleDocumentTypes</key>
-	<array>
-		<dict>
-			<key>CFBundleTypeExtensions</key>
-			<array>
-				<string>*</string>
-			</array>
-			<key>CFBundleTypeName</key>
-			<string>All</string>
-			<key>CFBundleTypeOSTypes</key>
-			<array>
-				<string>****</string>
-			</array>
-			<key>CFBundleTypeRole</key>
-			<string>Viewer</string>
-		</dict>
-	</array>
-	<key>CFBundleExecutable</key>
-	<string>XEmacs</string>
-	<key>CFBundleIconFile</key>
-	<string>Emacs.icns</string>
-	<key>CFBundleIdentifier</key>
-	<string>org.xemacs</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundlePackageType</key>
-	<string>APPL</string>
-	<key>CFBundleSignature</key>
-	<string>EMAx</string>
-	<key>CFBundleVersion</key>
-	<string>1.0</string>
-</dict>
-</plist>
diff -r 622675caf330 carbon/XEmacs.app/Contents/PkgInfo
--- a/carbon/XEmacs.app/Contents/PkgInfo	Sat Apr 05 14:41:43 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-APPLEMAx
\ No newline at end of file
diff -r 622675caf330 carbon/XEmacs.app/Contents/Resources/Emacs.icns
Binary file carbon/XEmacs.app/Contents/Resources/Emacs.icns has changed
diff -r 622675caf330 carbon/build-app.sh
--- a/carbon/build-app.sh	Sat Apr 05 14:41:43 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-carbondir="`pwd`"
-
-(cd xpm; make)
-
-cd ..
-
-# It seems necessary since 21.5.27 to recompile the Lisp files or
-# otherwise functions defined for "carbon" are not included properly.
-# Doing a "make extraclean" is the easiest way to get this done.
-./configure
-make extraclean
-
-#./configure --without-kkcc --without-mc-alloc --with-carbon --with-mule --without-ldap --enable-error-checking=none --prefix=${carbondir}/XEmacs.app/Contents/Resources
-#./configure --with-dump-in-exec --with-carbon --with-mule --without-ldap --enable-error-checking=none --prefix=${carbondir}/XEmacs.app/Contents/Resources
-./configure --without-kkcc --without-mc-alloc --with-carbon --with-mule --without-ldap --enable-error-checking=none --with-optimization --with-cflags-optimization=-O2 --prefix=${carbondir}/XEmacs.app/Contents/Resources
-#./configure --with-dump-in-exec --with-carbon --with-mule --without-ldap --enable-error-checking=none --with-optimization --with-cflags-optimization=-O2 --prefix=${carbondir}/XEmacs.app/Contents/Resources
-
-mkdir -p ${carbondir}/XEmacs.app/Contents/MacOS
-make install
-
-echo
-echo "All done."
-echo
-echo "The XEmacs application bundle that is built can be found at"
-echo
-echo "  ${carbondir}/XEmacs.app."
-echo
-echo "It can now be moved into any other folder (in its entirety) if" 
-echo "necessary.  By default, XEmacs will find packages installed in"
-echo
-echo "  ~/.xemacs"
-echo
-echo "or"
-echo
-echo "  XEmacs.app/Contents/Resources/share."
-echo
-echo "Packages in the second directory are moved along with the"
-echo "application bundle when it is moved."
diff -r 622675caf330 carbon/xpm/Makefile
--- a/carbon/xpm/Makefile	Sat Apr 05 14:41:43 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-CC = gcc
-AR = ar r
-RANLIB = ranlib
-RM = rm -f
-# on sysV, define this as cp.
-INSTALL = install -c
-MKDIRHIER = mkdir
-LN = ln -s
-CDEBUGFLAGS= -O
-
-OBJS= data.o hashtab.o misc.o parse.o Attrib.o CrDatFrI.o CrIFrBuf.o RdFToDat.o RdFToI.o Image.o Info.o
-
-CFLAGS= $(CDEBUGFLAGS) $(DEFINES) $(INCLUDES)
-
-all: libXpm.a
-
-clean: 
-	$(RM) *.o libXpm.a
-
-libXpm.a: $(OBJS)
-	$(AR) libXpm.a $(OBJS)
-	$(RANLIB) libXpm.a
-
-# Other dependencies.
-data.o:  XpmI.h xpm.h
-hashtab.o:  XpmI.h xpm.h
-misc.o:  XpmI.h xpm.h
-parse.o:  XpmI.h xpm.h
-Attrib.o:  XpmI.h xpm.h
-CrDatFrI.o:  XpmI.h xpm.h
-CrIFrBuf.o:  XpmI.h xpm.h
-Image.o:  XpmI.h xpm.h
-Info.o:  XpmI.h xpm.h
-RdFToDat.o:  XpmI.h xpm.h
-RdFToI.o:  XpmI.h xpm.h
diff -r 622675caf330 carbon/xpm/Makefile.in.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/carbon/xpm/Makefile.in.in	Wed Apr 16 16:06:22 2008 +1000
@@ -0,0 +1,72 @@
+## With the traditional VPATH setting, it is not possible to
+## simultaneously compile in-place and in another directory.  The
+## mistaken definition is that *all* dependencies are searched for in
+## the VPATH directory, rather than just the dependencies that are not
+## themselves targets.  Thus, if there is an up-to-date .o file in the
+## in-place location, it will not get recompiled in the not-in-place
+## location.
+
+## The GNU Make "vpath" directive continues this tradition, but at
+## least lets you restrict the classes of files that it applies to.
+## This allows us to kludge around the problem.
+
+#ifdef USE_GNU_MAKE
+vpath %.c @srcdir@
+vpath %.h @srcdir@
+#else
+VPATH=@srcdir@
+#endif
+
+CC = gcc
+AR = ar r
+RANLIB = ranlib
+RM = rm -f
+## on sysV, define this as cp.
+INSTALL = install -c
+MKDIRHIER = mkdir
+LN = ln -s
+CDEBUGFLAGS= -O
+
+OBJS= data.o hashtab.o misc.o parse.o Attrib.o CrDatFrI.o CrIFrBuf.o RdFToDat.o RdFToI.o Image.o Info.o
+
+CFLAGS= $(CDEBUGFLAGS) $(DEFINES) $(INCLUDES)
+
+all: libXpm.a
+
+.PHONY: mostlyclean clean distclean realclean extraclean
+.PHONY: distclean-noconfig realclean-noconfig extraclean-noconfig
+mostlyclean:
+	-$(RM) *.o libXpm.a
+clean: mostlyclean
+
+distclean-noconfig: clean
+
+## This is used in making a distribution.
+## Do not use it on development directories!
+distclean: distclean-noconfig
+	-$(RM) GNUmakefile Makefile Makefile.in
+realclean-noconfig: distclean-noconfig
+realclean: distclean
+extraclean-noconfig: realclean-noconfig
+	-$(RM) *~ \#*
+extraclean: realclean
+	-$(RM) *~ \#*
+
+clean mostlyclean realclean extraclean: 
+
+libXpm.a: $(OBJS)
+	$(AR) libXpm.a $(OBJS)
+	$(RANLIB) libXpm.a
+
+## Other dependencies.
+data.o:  XpmI.h xpm.h
+hashtab.o:  XpmI.h xpm.h
+misc.o:  XpmI.h xpm.h
+parse.o:  XpmI.h xpm.h
+Attrib.o:  XpmI.h xpm.h
+CrDatFrI.o:  XpmI.h xpm.h
+CrIFrBuf.o:  XpmI.h xpm.h
+Image.o:  XpmI.h xpm.h
+Info.o:  XpmI.h xpm.h
+RdFToDat.o:  XpmI.h xpm.h
+RdFToI.o:  XpmI.h xpm.h
diff -r 622675caf330 configure
--- a/configure	Sat Apr 05 14:41:43 2008 +0200
+++ b/configure	Wed Apr 16 16:06:22 2008 +1000
@@ -731,6 +731,7 @@ YFLAGS
 YFLAGS
 SET_MAKE
 GTK_CONFIG
+carbon_prefix
 XMKMF
 X_CFLAGS
 X_PRE_LIBS
@@ -16907,6 +16908,14 @@ _ACEOF
       dragndrop_proto="$dragndrop_proto Carbon" &&  if test "$verbose" = "yes"; then echo "    Appending \"Carbon\" to \$dragndrop_proto"; fi
       with_dragndrop=yes
     fi
+            if test `echo $prefix | sed 's/.*\(\.[^.]*\)$/\1/'` != '.app'; then
+      { { echo "$as_me:$LINENO: error: Under Carbon, the installation prefix must end in .app" >&5
+echo "$as_me: error: Under Carbon, the installation prefix must end in .app" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+                carbon_prefix="${prefix}"
+    prefix="$prefix/Contents/Resources"
+
   fi
 fi
 
@@ -24055,7 +24064,8 @@ echo "${ECHO_T}" >&6; }
       esac
       ;;
         darwin*)
-      if test "$with_carbon" == "yes"; then
+      if test "$with_carbon" = "yes"; then
+	MAKE_SUBDIR="carbon/xpm $MAKE_SUBDIR" &&  if test "$verbose" = "yes"; then echo "    Prepending \"carbon/xpm\" to \$MAKE_SUBDIR"; fi
         libpath_xpm="-L${srcdir}/carbon/xpm"
         incpath_xpm="-I${srcdir}/carbon/xpm"
       fi
@@ -24150,10 +24160,10 @@ _ACEOF
 _ACEOF
 
     LDFLAGS=""$libpath_xpm" $LDFLAGS" &&  if test "$verbose" = "yes"; then echo "    Prepending \""$libpath_xpm"\" to \$LDFLAGS"; fi
-    libs_x=""$libname_xpm" $libs_x" &&  if test "$verbose" = "yes"; then echo "    Prepending \""$libname_xpm"\" to \$libs_x"; fi
     CFLAGS=""$incpath_xpm" $CFLAGS" &&  if test "$verbose" = "yes"; then echo "    Prepending \""$incpath_xpm"\" to \$CFLAGS"; fi
     XE_CFLAGS=""$incpath_xpm" $XE_CFLAGS" &&  if test "$verbose" = "yes"; then echo "    Prepending \""$incpath_xpm"\" to \$XE_CFLAGS"; fi
-          if test "$with_carbon" != "yes"; then
+        if test "$with_carbon" != "yes"; then
+      libs_x=""$libname_xpm" $libs_x" &&  if test "$verbose" = "yes"; then echo "    Prepending \""$libname_xpm"\" to \$libs_x"; fi
       { echo "$as_me:$LINENO: checking for \"FOR_MSW\" xpm" >&5
 echo $ECHO_N "checking for \"FOR_MSW\" xpm... $ECHO_C" >&6; }
       xe_check_libs="$libname_xpm"
@@ -40532,6 +40542,7 @@ YFLAGS!$YFLAGS$ac_delim
 YFLAGS!$YFLAGS$ac_delim
 SET_MAKE!$SET_MAKE$ac_delim
 GTK_CONFIG!$GTK_CONFIG$ac_delim
+carbon_prefix!$carbon_prefix$ac_delim
 XMKMF!$XMKMF$ac_delim
 X_CFLAGS!$X_CFLAGS$ac_delim
 X_PRE_LIBS!$X_PRE_LIBS$ac_delim
@@ -40558,7 +40569,6 @@ ldap_libs!$ldap_libs$ac_delim
 ldap_libs!$ldap_libs$ac_delim
 postgresql_libs!$postgresql_libs$ac_delim
 lwlib_objs!$lwlib_objs$ac_delim
-canna_libs!$canna_libs$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -40600,6 +40610,7 @@ ac_delim='%!_!# '
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+canna_libs!$canna_libs$ac_delim
 ALLOCA!$ALLOCA$ac_delim
 have_esd_config!$have_esd_config$ac_delim
 SRC_SUBDIR_DEPS!$SRC_SUBDIR_DEPS$ac_delim
@@ -40676,7 +40687,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 74; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 75; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff -r 622675caf330 configure.ac
--- a/configure.ac	Sat Apr 05 14:41:43 2008 +0200
+++ b/configure.ac	Wed Apr 16 16:06:22 2008 +1000
@@ -3263,6 +3263,17 @@ if test "$with_carbon" != "no"; then
       XE_APPEND(Carbon, dragndrop_proto)
       with_dragndrop=yes
     fi
+    dnl XEmacs is installed as an Application bundle, therefore the prefix
+    dnl directory must end in .app
+    if test `echo $prefix | sed ['s/.*\(\.[^.]*\)$/\1/']` != '.app'; then
+      AC_MSG_ERROR([Under Carbon, the installation prefix must end in .app])
+    fi
+    dnl Under carbon, --prefix refers to the top of the application bundle,
+    dnl while the data is installed in <prefix>/Contents/Resources.  Adjust
+    dnl the value of $prefix appropriately.
+    carbon_prefix="${prefix}"
+    prefix="$prefix/Contents/Resources"
+    AC_SUBST(carbon_prefix)
   fi
 fi
 
@@ -4075,7 +4086,8 @@ if test "$window_system" != "none"; then
       ;;
     dnl Use the mini version of Xpm in the carbon directory.
     darwin*)
-      if test "$with_carbon" == "yes"; then
+      if test "$with_carbon" = "yes"; then
+	XE_PREPEND(carbon/xpm, MAKE_SUBDIR)
         libpath_xpm="-L${srcdir}/carbon/xpm"
         incpath_xpm="-I${srcdir}/carbon/xpm"
       fi
@@ -4125,11 +4137,11 @@ if test "$window_system" != "none"; then
     dnl #### but doesn't actually verify this assumption.
     AC_DEFINE(HAVE_XPM)
     XE_PREPEND("$libpath_xpm", LDFLAGS)
-    XE_PREPEND("$libname_xpm", libs_x)
     XE_PREPEND("$incpath_xpm", CFLAGS)
     XE_PREPEND("$incpath_xpm", XE_CFLAGS)
     dnl Don't define FOR_MSW for Carbon.
-      if test "$with_carbon" != "yes"; then
+    if test "$with_carbon" != "yes"; then
+      XE_PREPEND("$libname_xpm", libs_x)
       AC_MSG_CHECKING([for "FOR_MSW" xpm])
       xe_check_libs="$libname_xpm"
       AC_LINK_IFELSE([AC_LANG_PROGRAM([],[XpmCreatePixmapFromData();])],
diff -r 622675caf330 src/Makefile.in.in
--- a/src/Makefile.in.in	Sat Apr 05 14:41:43 2008 +0200
+++ b/src/Makefile.in.in	Wed Apr 16 16:06:22 2008 +1000
@@ -382,7 +382,12 @@ otherrtls = $(otherobjs:.o=.c.rtl)
 otherrtls = $(otherobjs:.o=.c.rtl)
 othersrcs = $(otherobjs:.o=.c)
 
+#ifdef HAVE_CARBON
+## For carbon link with the internal copy of Xpm.
+LIBES = $(lwlib_lib) $(malloclib) $(ld_libs_all) $(lib_gcc) -L../carbon/xpm -lXpm
+#else
 LIBES = $(lwlib_lib) $(malloclib) $(ld_libs_all) $(lib_gcc)
+#endif
 
 #ifdef I18N3
 mo_file = $(LIB_SRC)/emacs.mo




More information about the XEmacs-Patches mailing list