--- emacs-cvs-23.0.96.ebuild.orig 2009-07-17 13:29:02 +0900 +++ emacs-cvs-23.0.96.ebuild 2009-07-17 13:32:46 +0900 @@ -31,7 +31,7 @@ LICENSE="GPL-3 FDL-1.3 BSD as-is X11 W3C unicode" SLOT="23" KEYWORDS="~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~x86-macos" -IUSE="alsa dbus gif gpm gtk gzip-el hesiod jpeg kerberos m17n-lib motif png sound source svg tiff toolkit-scroll-bars X Xaw3d xft +xpm" +IUSE="alsa cocoa dbus gif gpm gtk gzip-el hesiod jpeg kerberos m17n-lib motif png sound source svg tiff toolkit-scroll-bars X Xaw3d xft +xpm" RESTRICT="strip" RDEPEND="sys-libs/ncurses @@ -136,6 +136,10 @@ myconf="${myconf} $(use_with sound)" fi + if use X && use cocoa; then + die "the X and cocoa USE-flags cannot be used together, please use one" + fi + if use X; then myconf="${myconf} --with-x" myconf="${myconf} $(use_with toolkit-scroll-bars)" @@ -177,8 +181,14 @@ && ewarn "USE flag \"${f}\" ignored (superseded by \"${tk}\")" tk="${tk}${tk:+ }${f}" done + elif use cocoa; then + einfo "Configuring to build with Cocoa support" + myconf="${myconf} --without-x" + myconf="${myconf} --with-ns" + myconf="${myconf} --disable-ns-self-contained" else myconf="${myconf} --without-x" + myconf="${myconf} --without-ns" fi myconf="${myconf} $(use_with hesiod)" @@ -187,8 +197,14 @@ econf \ --program-suffix=-${EMACS_SUFFIX} \ - --infodir=/usr/share/info/${EMACS_SUFFIX} \ + --infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \ ${myconf} || die "econf emacs failed" + + # very hackish :( + if use cocoa; then + sed -i "s%^\(#define PATH_EXEC\).*%\1 \"${EPREFIX}/usr/libexec/emacs/${PV}/${CHOST}\"%" \ + src/epaths.h || die "PATH_EXEC editing failed" + fi } src_compile() { @@ -204,12 +220,21 @@ src_install () { local i m - emake install DESTDIR="${D}" || die "make install failed" - - rm "${ED}"/usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \ - || die "removing duplicate emacs executable failed" - mv "${ED}"/usr/bin/emacs-${EMACS_SUFFIX} "${ED}"/usr/bin/${EMACS_SUFFIX} \ - || die "moving Emacs executable failed" + # to avoid accidental removal of everything + if use cocoa; then + make install-arch-dep + fi + emake install DESTDIR="${D}" exec_prefix="${EPREFIX}/usr" \ + libexecdir="${EPREFIX}/usr/libexec" \ + || die "make install failed" + + if [ -e "${ED}"usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} ]; then + rm "${ED}"usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \ + || die "removing duplicate emacs executable failed" + mv "${ED}"usr/bin/emacs-${EMACS_SUFFIX} \ + "${ED}"usr/bin/${EMACS_SUFFIX} \ + || die "moving Emacs executable failed" + fi # move info documentation to the correct place for i in "${ED}"/usr/share/info/${EMACS_SUFFIX}/*; do @@ -253,6 +278,15 @@ elisp-site-file-install "${SITEFILE}" || die dodoc README BUGS || die "dodoc failed" + + if use cocoa; then + if [ ! -e "${ED}"/Applications/Gentoo ]; then + mkdir -p "${ED}"/Applications/Gentoo + fi + mv "${S}"/nextstep/Emacs.app "${ED}"/Applications/Gentoo/Emacs-${FULL_VERSION}.app + einfo "Emacs-${FULL_VERSION}.app is in $EPREFIX/Applications/Gentoo." + einfo "You may want to copy it into /Applications by yourself." + fi } emacs-infodir-rebuild() {