qemacs: upgraded package to upstream

Upgraded app-editors/qemacs to version 0.4.1_pre20170225 on amd64, arm, x86

After inspecting the history of qemacs in chromiumos-overlay it appears that all remaining changes are related to upstream patches. The new version includes more recent versions of patches (e.g. nostrip), or integrated a more permanent solution in the source (e.g. tty utf8 support).

BUG=chromium:213176
TEST=`qemacs --version` on vm

Change-Id: Ia29196a38303f27fd8bdb816f3f682cce498ce5e
Reviewed-on: https://chromium-review.googlesource.com/1115501
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/app-editors/qemacs/Manifest b/app-editors/qemacs/Manifest
new file mode 100644
index 0000000..8dce502
--- /dev/null
+++ b/app-editors/qemacs/Manifest
@@ -0,0 +1 @@
+DIST qemacs-0.4.1_pre20170225.tar.xz 1147408 SHA256 9a3f754effbd9253b7aec9909fea801fc233cf69f98f6c807e5334ae1c8a08a6 SHA512 a17c8901c917f91401e16b4f857735957ab0d3533d9dcc7a0decf768f453b68023f45e1241225a84d35ba793beb69754e0f2caa857165f8223882d5041d56c99 WHIRLPOOL b430a0fd8ecef701d4727acb023d0a56553cf109e18ae64dfec886923ec6e5395d1dae9484c274d298675928c69e0e966f3443c0f9f4f8c6890af15bc0fd52ae
diff --git a/app-editors/qemacs/files/qemacs-0.4.1_pre20170225-Makefile.patch b/app-editors/qemacs/files/qemacs-0.4.1_pre20170225-Makefile.patch
new file mode 100644
index 0000000..0540bcd
--- /dev/null
+++ b/app-editors/qemacs/files/qemacs-0.4.1_pre20170225-Makefile.patch
@@ -0,0 +1,42 @@
+Removes forced march setting and align-functions on x86, as they would
+override user's CFLAGS.
+
+--- qemacs-orig/Makefile
++++ qemacs/Makefile
+@@ -29,35 +29,11 @@
+     cmd  := 
+ endif
+ 
+-ifeq ($(CC),gcc)
+-  CFLAGS  += -Wall -g -O2 -funsigned-char
+-  # do not warn about zero-length formats.
+-  CFLAGS   += -Wno-format-zero-length
+-  LDFLAGS  += -g
+-endif
+-
+-#include local compiler configuration file
+--include $(DEPTH)/cflags.mk
+-
+-ifdef TARGET_GPROF
+-  CFLAGS  += -p
+-  LDFLAGS += -p
+-endif
+-
+ #TCFLAGS := -DCONFIG_TINY -m32 $(CFLAGS) -Os
+ #TLDFLAGS := -m32 $(LDFLAGS)
+-TCFLAGS := -DCONFIG_TINY $(CFLAGS) -Os
++TCFLAGS := -DCONFIG_TINY $(CFLAGS)
+ TLDFLAGS := $(LDFLAGS)
+ 
+-ifdef TARGET_ARCH_X86
+-  #CFLAGS+=-fomit-frame-pointer
+-  ifeq ($(GCC_MAJOR),2)
+-    CFLAGS += -m386 -malign-functions=0
+-  else
+-    CFLAGS += -march=i386 -falign-functions=0
+-  endif
+-endif
+-
+ DEFINES=-DHAVE_QE_CONFIG_H
+ 
+ ########################################################
diff --git a/app-editors/qemacs/files/qemacs-0.4.1_pre20170225-manpage.patch b/app-editors/qemacs/files/qemacs-0.4.1_pre20170225-manpage.patch
new file mode 100644
index 0000000..b73f3ee
--- /dev/null
+++ b/app-editors/qemacs/files/qemacs-0.4.1_pre20170225-manpage.patch
@@ -0,0 +1,11 @@
+--- qemacs-orig/qe.1
++++ qemacs/qe.1
+@@ -44,7 +44,7 @@
+ anti aliased font display.
+ .PP
+ For more information and a list of key bindings please see
+-/usr/share/doc/qemacs/README.gz.
++the README file in /usr/share/doc/@PF@/.
+ .SH AUTHOR
+ This manual page was written by Edmund GRIMLEY EVANS <edmundo@rano.org>,
+ for the Debian GNU/Linux system (but may be used by others).
diff --git a/app-editors/qemacs/files/qemacs-0.4.1_pre20170225-nostrip.patch b/app-editors/qemacs/files/qemacs-0.4.1_pre20170225-nostrip.patch
new file mode 100644
index 0000000..60519dc
--- /dev/null
+++ b/app-editors/qemacs/files/qemacs-0.4.1_pre20170225-nostrip.patch
@@ -0,0 +1,61 @@
+Suppress stripping.
+
+--- qemacs-orig/Makefile
++++ qemacs/Makefile
+@@ -203,7 +203,6 @@
+ qe$(EXE): qe_g$(EXE) Makefile
+ 	@rm -f $@
+ 	cp $< $@
+-	-$(STRIP) $@
+ 	@ls -l $@
+ 	@echo `size $@` `wc -c $@` qe $(OPTIONS) \
+ 		| cut -d ' ' -f 7-10,13,15-40 >> STATS
+@@ -218,7 +217,6 @@
+ xqe$(EXE): xqe_g$(EXE) Makefile
+ 	@rm -f $@
+ 	cp $< $@
+-	-$(STRIP) $@
+ 	@ls -l $@
+ 	@echo `size $@` `wc -c $@` xqe $(OPTIONS) \
+ 		| cut -d ' ' -f 7-10,13,15-40 >> STATS
+@@ -233,7 +231,6 @@
+ tqe$(EXE): tqe_g$(EXE) Makefile
+ 	@rm -f $@
+ 	cp $< $@
+-	-$(STRIP) $@
+ 	@ls -l $@
+ 	@echo `size $@` `wc -c $@` tqe $(OPTIONS) \
+ 		| cut -d ' ' -f 7-10,13,15-40 >> STATS
+@@ -245,7 +242,6 @@
+ t1qe$(EXE): t1qe_g$(EXE) Makefile
+ 	@rm -f $@
+ 	cp $< $@
+-	-$(STRIP) $@
+ 	@ls -l $@
+ 	@echo `size $@` `wc -c $@` t1qe $(OPTIONS) \
+ 		| cut -d ' ' -f 7-10,13,15-40 >> STATS
+@@ -478,12 +474,12 @@
+ 	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
+ 	$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/qe
+ ifdef CONFIG_X11
+-	$(INSTALL) -m 755 -s xqe$(EXE) $(DESTDIR)$(prefix)/bin/qemacs$(EXE)
++	$(INSTALL) -m 755 xqe$(EXE) $(DESTDIR)$(prefix)/bin/qemacs$(EXE)
+ else
+   ifdef CONFIG_TINY
+-	$(INSTALL) -m 755 -s tqe$(EXE) $(DESTDIR)$(prefix)/bin/qemacs$(EXE)
++	$(INSTALL) -m 755 tqe$(EXE) $(DESTDIR)$(prefix)/bin/qemacs$(EXE)
+   else
+-	$(INSTALL) -m 755 -s qe$(EXE) $(DESTDIR)$(prefix)/bin/qemacs$(EXE)
++	$(INSTALL) -m 755 qe$(EXE) $(DESTDIR)$(prefix)/bin/qemacs$(EXE)
+   endif
+ endif
+ 	ln -sf qemacs$(EXE) $(DESTDIR)$(prefix)/bin/qe$(EXE)
+@@ -493,7 +489,7 @@
+ 	$(INSTALL) -m 644 kmaps ligatures $(DESTDIR)$(datadir)/qe
+ 	$(INSTALL) -m 644 qe.1 $(DESTDIR)$(mandir)/man1
+ ifdef CONFIG_HTML
+-	$(INSTALL) -m 755 -s html2png$(EXE) $(DESTDIR)$(prefix)/bin
++	$(INSTALL) -m 755 html2png$(EXE) $(DESTDIR)$(prefix)/bin
+ endif
+ 
+ uninstall:
diff --git a/app-editors/qemacs/metadata.xml b/app-editors/qemacs/metadata.xml
new file mode 100644
index 0000000..a725e27
--- /dev/null
+++ b/app-editors/qemacs/metadata.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+  <email>emacs@gentoo.org</email>
+  <name>Gentoo Emacs project</name>
+</maintainer>
+<longdescription>
+  QEmacs (for Quick Emacs) is a very small but powerful text editor. It has
+  the following features:
+   * Full screen editor with an Emacs look and feel with all Emacs common
+     features: multi-buffer, multi-window, command mode, universal argument,
+     keyboard macros, config file with C like syntax, minibuffer with
+     completion and history.
+   * Can edit files of hundreds of megabytes quickly by using a highly
+     optimized internal representation and by mmaping the file.
+   * Full UTF8 support, including bidirectional editing respecting the Unicode
+     bidi algorithm. Arabic and Indic scripts handling (in progress).
+   * WYSIWYG HTML/XML/CSS2 mode graphical editing. Also supports lynx like
+     rendering on VT100 terminals. WYSIWYG DocBook mode based on XML/CSS2
+     renderer.
+   * C mode: coloring with immediate update. Emacs like auto-indent.
+   * Shell mode: colorized VT100 emulation so that your shell work exactly as
+     you expect. You can run interactive terminal apps directly in the process
+     buffer: mc, MenuConfig, or even qemacs itself! Compile mode with
+     next/prev error.
+   * Input methods for most languages, including Chinese (input methods come
+     from the Yudit editor).
+   * Hexadecimal editing mode with insertion and block commands. Unicode hexa
+     editing of UTF8 files also supported.
+   * Works on any VT100 terminals without termcap. UTF8 VT100 support included
+     with double width glyphs.
+   * X11 support. Support multiple proportionnal fonts at the same time (as
+     XEmacs).
+   * Small! Full version is about 150KB. Smaller custom versions can be built
+     by removing modules.
+</longdescription>
+</pkgmetadata>
diff --git a/app-editors/qemacs/qemacs-0.4.1_pre20170225.ebuild b/app-editors/qemacs/qemacs-0.4.1_pre20170225.ebuild
new file mode 100644
index 0000000..cc30b33
--- /dev/null
+++ b/app-editors/qemacs/qemacs-0.4.1_pre20170225.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit toolchain-funcs
+
+DESCRIPTION="QEmacs is a very small but powerful UNIX editor"
+HOMEPAGE="https://savannah.nongnu.org/projects/qemacs/"
+# snapshot of http://cvs.savannah.gnu.org/viewvc/?root=qemacs
+SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz"
+
+LICENSE="LGPL-2.1+ GPL-2+"
+SLOT="0"
+KEYWORDS="*"
+IUSE="X png unicode xv"
+RESTRICT="test"
+
+RDEPEND="
+	X? ( x11-libs/libX11
+		x11-libs/libXext
+		xv? ( x11-libs/libXv ) )
+	png? ( >=media-libs/libpng-1.2:0= )"
+
+DEPEND="${RDEPEND}
+	>=app-text/texi2html-5
+	X? ( x11-base/xorg-proto )"
+
+S="${WORKDIR}/${PN}"
+
+src_prepare() {
+	eapply "${FILESDIR}/${P}-Makefile.patch"
+	eapply "${FILESDIR}/${P}-nostrip.patch"
+	eapply_user
+
+	# Change the manpage to reference a /real/ file instead of just an
+	# approximation.  Purely cosmetic!
+	eapply "${FILESDIR}/${P}-manpage.patch"
+	sed -i -e "s:@PF@:${PF}:" qe.1 || die
+}
+
+src_configure() {
+	# Home-grown configure script, doesn't support most standard options
+	./configure \
+		--prefix=/usr \
+		--mandir=/usr/share/man \
+		--cc="$(tc-getCC)" \
+		$(use_enable X x11) \
+		$(use_enable png) \
+		$(use_enable xv) || die
+}
+
+src_install() {
+	emake install DESTDIR="${D}"
+	dodoc Changelog README TODO.org config.eg
+	docinto html
+	dodoc qe-doc.html
+
+	# Install headers so users can build their own plugins
+	insinto /usr/include/qe
+	doins *.h
+	insinto /usr/include/qe/libqhtml
+	doins libqhtml/*.h
+}
diff --git a/metadata/md5-cache/app-editors/qemacs-0.4.1_pre20170225 b/metadata/md5-cache/app-editors/qemacs-0.4.1_pre20170225
new file mode 100644
index 0000000..c0ebc93
--- /dev/null
+++ b/metadata/md5-cache/app-editors/qemacs-0.4.1_pre20170225
@@ -0,0 +1,14 @@
+DEFINED_PHASES=configure install prepare
+DEPEND=X? ( x11-libs/libX11 x11-libs/libXext xv? ( x11-libs/libXv ) ) png? ( >=media-libs/libpng-1.2:0= ) >=app-text/texi2html-5 X? ( x11-base/xorg-proto )
+DESCRIPTION=QEmacs is a very small but powerful UNIX editor
+EAPI=6
+HOMEPAGE=https://savannah.nongnu.org/projects/qemacs/
+IUSE=X png unicode xv
+KEYWORDS=*
+LICENSE=LGPL-2.1+ GPL-2+
+RDEPEND=X? ( x11-libs/libX11 x11-libs/libXext xv? ( x11-libs/libXv ) ) png? ( >=media-libs/libpng-1.2:0= )
+RESTRICT=test
+SLOT=0
+SRC_URI=https://dev.gentoo.org/~ulm/distfiles/qemacs-0.4.1_pre20170225.tar.xz
+_eclasses_=multilib	97f470f374f2e94ccab04a2fb21d811e	toolchain-funcs	1e35303c63cd707f6c3422b4493d5607
+_md5_=021f73578065af48ff0c37c39080f622