summaryrefslogtreecommitdiff
path: root/app-editors/fte
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-editors/fte
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-editors/fte')
-rw-r--r--app-editors/fte/Manifest13
-rw-r--r--app-editors/fte/files/fte26
-rw-r--r--app-editors/fte/files/fte-cpp14.patch17
-rw-r--r--app-editors/fte/files/fte-gcc3438
-rw-r--r--app-editors/fte/files/fte-interix.patch38
-rw-r--r--app-editors/fte/files/fte-new_keyword.patch14
-rw-r--r--app-editors/fte/files/fte-slang.patch131
-rw-r--r--app-editors/fte/fte-20051115-r3.ebuild124
-rw-r--r--app-editors/fte/fte-20110708-r1.ebuild119
-rw-r--r--app-editors/fte/metadata.xml9
10 files changed, 529 insertions, 0 deletions
diff --git a/app-editors/fte/Manifest b/app-editors/fte/Manifest
new file mode 100644
index 000000000000..3a4695e7fd75
--- /dev/null
+++ b/app-editors/fte/Manifest
@@ -0,0 +1,13 @@
+AUX fte 604 BLAKE2B ccb21ce020421a68d33fb94185d3acc6ad26f6f8cd0c574c9ca611aa923180e5192b6271312575f7a64f329d3e25d2722b07425553cfa57e54ed55ec3668f0f1 SHA512 5f93df643282016c352db88cddd37c1b9f86d94654a7eff0089b9d349ad3f56ba4266cb2431ac3a418bd4b5aebf6d7ad04c26099061942fd3e90fc9fb938322b
+AUX fte-cpp14.patch 531 BLAKE2B 1a40bf7a6a71daab0a550d6de1fc2c653b4b5ce9108be9be12819e0b09829bdb06a961ef5e66792a51d25d1751dd0223e4b3ae3bd38aab82cea88ddf92ac921c SHA512 d6bfe5912f92e5d948d3de49085824d74ca51877b93cf8af7f2d4a6d162e6ea5ae11f96fc2b096875a9cd08476af88b07a7a1e352a97206876c15779e4bc36a5
+AUX fte-gcc34 1092 BLAKE2B f713cc9b727b2e133a55fcf01b2a22b9d27451deb7db803946160d6711bc088aba8850743a8ca93358107f8000894b92be93156cf22428cb8d7478dadd3cfe93 SHA512 390da870507786d74d67847d644c07d9c24789913117c46fcd8739f5ceb58345ac100a7cd1e2ef1183d09e76f923b73cd94fa523f5eaa3d6113a952240fd4800
+AUX fte-interix.patch 1041 BLAKE2B 55f18c0cc954181800e9efcdbf463d4ceaa63ff3ae8f9e062af824bafab5364ab079afae40361d0caba95cca7635c8d756f7317355092293bf901aac4076b031 SHA512 6f43c682b577b838675fe93c9e2b4c225e3c853d2db95f81f84d64508e78c6f957f1c8842343df2d9a6e7d01e5103a6cc2a1cd0cf414cee641b6b11c0d551b78
+AUX fte-new_keyword.patch 340 BLAKE2B a50987a59180352dfec174af7467f153c575442407dbd48b40c7a0c1d2e0260f09a42d55cab122489ea01fd98f4579722ddd39ebc0eecf50d720a464b410e25c SHA512 ab003f671919fb03429ab13adda5025554258e0799844b887cb786c2378e81025893998b0ef3b0b121d82422502d90f5dc8afa9855c1432c8d2f6597ea087c7a
+AUX fte-slang.patch 3567 BLAKE2B 3519a97a1f354ad8515df86ce8dbb8c9a66f531f8f8653c1ddc5d910a97ba794556b9840a5c0694710150e7fddd53dd6bb69e1a70fb40c2c33e0232b9719bf77 SHA512 3f9504d9b4d6de6e012f0aedf762dce51d1fbc79345f2f45f5303bc81194441396cbd7eadc9457e07814cb6d33b6db6ad1186de026b5b474f9419071e4b75d10
+DIST fte-20051115-common.zip 187849 BLAKE2B eb410c64b40650b475fb651a014c4ddf2cece6471f2144928b88644a04f9fe4886caf6f0f4b8d679a8fb506461bf7973f1e2bd3a9d8163f462e8eb03f2d85163 SHA512 18e1657a6fe1b48449dc97a357f00bfeb6626450520b48647e2751cc946d9d1bfc6d77d4b0fbdff0a980121502da870f739846b1db9569ff0b305530ee717323
+DIST fte-20051115-src.zip 549216 BLAKE2B 0ec3eeea813380cb0c2cac55dc42beaeecb10ec3c6bac02668d995b5735443cb92cdc430135973190560a8a4e9096737d9bc6b448258fa9e04c4bb1b18235609 SHA512 320c2c4f27041ff5e7417288e5acc8c776013da4aa7cfc187e6207086851642a7ed961383ca19f6ae6c1717a59453c6a9ca40a1c7eb77dae6e5b9184cd7c346a
+DIST fte-20110708-common.zip 200007 BLAKE2B ce1ac0f2bd68b2bb7ef1d96a46bd9a481cd46f5cde00607c64f752d5e87f6edefd8a92c8210e1ac7629ef8bc5720a8a2d75bd61f292f344e211b88a2462989fa SHA512 0bb59a5b6b4a5ef6c1234dadd8922cd50a13ad1f0c06d6046b74a95592ad55f720b43bbc78a42cab63dfc68c5e073d44d5179bd6ed72f346563f43f3c5c146f1
+DIST fte-20110708-src.zip 504199 BLAKE2B 42bb3cc4ae9be4b64c0b161488d91d4a260a2e6a1574fccb0fc652359e34f7b6b881f170dfd85a8954f2b2fdbe4fecaaf2fc68cd5244f185dde36fe1a694004e SHA512 2d59fadcdd988ee85b87425c343341e1b768a7e9ef838c5f8a1f22c4adc5bf2cc37d547f36354ca1740bce07b33d5ae93d14e24001b9dbd3b1b267986564a089
+EBUILD fte-20051115-r3.ebuild 2780 BLAKE2B 39ee917eca7bbf6172a1c550d900eaf9d8aef5db4cc325dc11c734560e2679cc0e2522bfeb8f5afcaae92042d3ee73505f89e7b76796dde5550932a58e5ffa2b SHA512 106f6eda464bb37d35d549e8c3a56c53a3571e259e748bf7f975d1e6fce4a4e1fa32ea85f8cc26f38ac5181cdd64af32012a8332594a74c09d4e064779a9778a
+EBUILD fte-20110708-r1.ebuild 2656 BLAKE2B f5894a82e98aaa1b9610bdf3320436de60d1a0cfa5f1d5e6f4a204082dfea885decb30f8835a83017fee9b5a34fc2156a55ba17c2d8dbbb211b85f05241b86fc SHA512 989ddf33022f0bd8b8d0e1d79bb1dcad111f8fbe3d7de329512feedbd4751a6790d5c08657ec83f110bf86547e05be5795fcfdbf2597ed172b11664a47bb38a0
+MISC metadata.xml 312 BLAKE2B 0092b7eaef6d8c1e8f1bd490c8d4e9f43909d86097fbf06692b2e92e7496332bac289bb40fc3cb9a7dc1d32a63ca19db01cc75e0a9014f1d2e8074816ed26a8b SHA512 3946924797105501c1388f172caf774488ebb480ff13664fffd75fb30ebdfba27d52c3e7d534e7dcad5204b6074ba28ee25a4724ed117748059fceeff9d23b60
diff --git a/app-editors/fte/files/fte b/app-editors/fte/files/fte
new file mode 100644
index 000000000000..2e4621b92a62
--- /dev/null
+++ b/app-editors/fte/files/fte
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# simple wrapper shell script which selects appropriate fte executable
+#
+
+if [ -n "$DISPLAY" ]; then
+ if which xfte >/dev/null; then
+ exec xfte "$@"
+ elif which sfte >/dev/null; then
+ exec sfte "$@"
+ elif which vfte >/dev/null; then
+ echo "Only Console version installed!"
+ fi
+else
+ if [ "$TERM" = linux ] && which vfte >/dev/null; then
+ exec vfte "$@"
+ elif which sfte >/dev/null; then
+ exec sfte "$@"
+ elif which xfte >/dev/null; then
+ echo "Only X-Window version installed!"
+ fi
+
+fi
+
+echo "No binary executable from the FTE family has been found!"
+echo "Please install one of them."
diff --git a/app-editors/fte/files/fte-cpp14.patch b/app-editors/fte/files/fte-cpp14.patch
new file mode 100644
index 000000000000..bea83b6a5ccd
--- /dev/null
+++ b/app-editors/fte/files/fte-cpp14.patch
@@ -0,0 +1,17 @@
+Fix C++14 compilation errors. Add casting int literals to char in config
+generator to avoid narrowing conversions.
+Gentoo bug: https://bugs.gentoo.org/show_bug.cgi?id=595048
+
+--- a/src/mkdefcfg.pl
++++ b/src/mkdefcfg.pl
+@@ -24,8 +24,8 @@
+
+ @c = split(//, $buf);
+ for ($i = 0; $i < $len; $i++) {
+- $out .= sprintf("0x%02X", ord($c[$i]));
+- if ($n++ % 10) {
++ $out .= sprintf("(char)0x%02X", ord($c[$i]));
++ if ($n++ % 5) {
+ $out .= ", ";
+ } else {
+ $out .= ",\n";
diff --git a/app-editors/fte/files/fte-gcc34 b/app-editors/fte/files/fte-gcc34
new file mode 100644
index 000000000000..51940e650657
--- /dev/null
+++ b/app-editors/fte/files/fte-gcc34
@@ -0,0 +1,38 @@
+--- fte/src/con_slang.cpp 2003-02-16 19:23:58.000000000 +0100
++++ fte-gcc34/src/con_slang.cpp 2005-01-12 16:57:38.050369064 +0100
+@@ -246,7 +246,7 @@
+ SLsmg_write_nchars(slang_dchs, sizeof(slang_dchs));
+
+ SLsmg_gotorc(0, 0);
+- SLsmg_read_raw(linebuf, sizeof(slang_dchs));
++ SLsmg_read_raw((SLsmg_Char_Type*)linebuf, sizeof(slang_dchs));
+ for (i = 0; i < sizeof(slang_dchs); i++)
+ raw_dchs[i] = (linebuf[i]) & 0xff;
+
+@@ -368,7 +368,7 @@
+ ConQueryCursorPos(&CurX, &CurY);
+ while (H > 0) {
+ SLsmg_gotorc(Y++, X);
+- SLsmg_write_raw(box, W);
++ SLsmg_write_raw((SLsmg_Char_Type*)box, W);
+ box += W;
+ H--;
+ }
+@@ -386,7 +386,7 @@
+ ConQueryCursorPos(&CurX, &CurY);
+ while (H > 0) {
+ SLsmg_gotorc(Y++, X);
+- SLsmg_read_raw(Cell, W);
++ SLsmg_read_raw((SLsmg_Char_Type*)Cell, W);
+ for (i = 0; i < W; i++)
+ if (Cell[i] & 0x8000) {
+ ch = Cell[i] & 0xff;
+@@ -409,7 +409,7 @@
+ ConQueryCursorPos(&CurX, &CurY);
+ while (H > 0) {
+ SLsmg_gotorc(Y++, X);
+- SLsmg_read_raw(box, W);
++ SLsmg_read_raw((SLsmg_Char_Type*)box, W);
+ box += W;
+ H--;
+ }
diff --git a/app-editors/fte/files/fte-interix.patch b/app-editors/fte/files/fte-interix.patch
new file mode 100644
index 000000000000..1df0a49f488a
--- /dev/null
+++ b/app-editors/fte/files/fte-interix.patch
@@ -0,0 +1,38 @@
+https://sourceforge.net/tracker/?func=detail&aid=3554646&group_id=943&atid=100943
+
+diff -ru fte.orig/src/g_unix_pipe.cpp fte/src/g_unix_pipe.cpp
+--- fte.orig/src/g_unix_pipe.cpp 2008-04-03 13:33:49 +0200
++++ fte/src/g_unix_pipe.cpp 2008-04-03 13:34:20 +0200
+@@ -4,6 +4,10 @@
+ #include <signal.h>
+ #include <sys/wait.h>
+
++#ifdef __INTERIX
++# include <sys/time.h>
++#endif
++
+ #include "sysdep.h"
+ #include "c_config.h"
+ #include "console.h"
+diff -ru fte.orig/src/sysdep.h fte/src/sysdep.h
+--- fte.orig/src/sysdep.h 2008-04-03 13:33:58 +0200
++++ fte/src/sysdep.h 2008-04-03 13:30:43 +0200
+@@ -15,7 +15,7 @@
+ #include <stdlib.h>
+ #include <stdarg.h>
+ #include <string.h>
+-#if defined(AIX) || defined(SCO) || defined(NCR)
++#if defined(AIX) || defined(SCO) || defined(NCR) || defined(__INTERIX)
+ #include <strings.h>
+ #endif
+ #include <stdio.h>
+@@ -38,7 +38,8 @@
+ !defined(IRIX) && \
+ !defined(SCO) && \
+ !defined(SUNOS) && \
+- !defined(NCR)
++ !defined(NCR) && \
++ !defined(__INTERIX)
+ # error Target not supported.
+ #endif
+
diff --git a/app-editors/fte/files/fte-new_keyword.patch b/app-editors/fte/files/fte-new_keyword.patch
new file mode 100644
index 000000000000..c7b2a2b64554
--- /dev/null
+++ b/app-editors/fte/files/fte-new_keyword.patch
@@ -0,0 +1,14 @@
+--- src/con_linux.cpp.orig 2005-01-30 22:46:54.170485296 +0300
++++ src/con_linux.cpp 2005-01-30 22:46:28.859333176 +0300
+@@ -50,7 +50,11 @@
+ #include <linux/major.h>
+ #include <linux/kdev_t.h>
+ #include <linux/kd.h>
++extern "C" {
++#define new xnew
+ #include <linux/keyboard.h>
++#undef new
++}
+ #ifdef USE_GPM
+ extern "C" {
+ #include <gpm.h>
diff --git a/app-editors/fte/files/fte-slang.patch b/app-editors/fte/files/fte-slang.patch
new file mode 100644
index 000000000000..50470bd6b7ef
--- /dev/null
+++ b/app-editors/fte/files/fte-slang.patch
@@ -0,0 +1,131 @@
+diff -Nru /tmp/wgHyQebD7F/fte-0.50.0/src/con_slang.cpp /tmp/PQJo4szkUb/fte-0.50.0/src/con_slang.cpp
+--- a/fte-0.50.0/src/con_slang.cpp 2005-12-28 16:53:24.000000000 +0100
++++ b/fte-0.50.0/src/con_slang.cpp 2006-06-05 06:02:37.000000000 +0200
+@@ -99,12 +99,14 @@
+ '+'
+ };
+
+-static char raw_dchs[sizeof(slang_dchs)];
++static SLsmg_Char_Type raw_dchs[sizeof(slang_dchs)];
+
+-static unsigned char ftesl_get_dch(char raw)
++static unsigned char ftesl_get_dch(SLsmg_Char_Type raw)
+ {
+ for (int i = 0; i < (int) sizeof(slang_dchs); i++)
+- if (raw_dchs[i] == raw)
++ if (raw_dchs[i].nchars == raw.nchars
++ && !memcmp(raw_dchs[i].wchars, raw.wchars,
++ raw.nchars * sizeof(*raw.wchars)))
+ return DCH_SLANG_C1 + i;
+ return DCH_SLANG_EOL;
+ }
+@@ -215,7 +217,6 @@
+ int ConInit(int /*XSize */ , int /*YSize */ )
+ {
+ unsigned i;
+- unsigned short linebuf[sizeof(slang_dchs)];
+
+ SLtt_get_terminfo();
+
+@@ -246,9 +247,7 @@
+ SLsmg_write_nchars(slang_dchs, sizeof(slang_dchs));
+
+ SLsmg_gotorc(0, 0);
+- SLsmg_read_raw((SLsmg_Char_Type*)linebuf, sizeof(slang_dchs));
+- for (i = 0; i < sizeof(slang_dchs); i++)
+- raw_dchs[i] = (linebuf[i]) & 0xff;
++ SLsmg_read_raw(raw_dchs, sizeof(slang_dchs));
+
+ SLsmg_set_char_set(0);
+
+@@ -361,14 +360,14 @@
+ return 0;
+ }
+
+-static int ConPutBoxRaw(int X, int Y, int W, int H, unsigned short *box)
++static int ConPutBoxRaw(int X, int Y, int W, int H, SLsmg_Char_Type *box)
+ {
+ int CurX, CurY;
+
+ ConQueryCursorPos(&CurX, &CurY);
+ while (H > 0) {
+ SLsmg_gotorc(Y++, X);
+- SLsmg_write_raw((SLsmg_Char_Type*)box, W);
++ SLsmg_write_raw(box, W);
+ box += W;
+ H--;
+ }
+@@ -381,35 +380,51 @@
+ int ConGetBox(int X, int Y, int W, int H, PCell Cell)
+ {
+ int CurX, CurY, i;
+- char ch;
++ SLsmg_Char_Type *linebuf;
++
++ linebuf = new SLsmg_Char_Type [W];
+
+ ConQueryCursorPos(&CurX, &CurY);
+ while (H > 0) {
+ SLsmg_gotorc(Y++, X);
+- SLsmg_read_raw((SLsmg_Char_Type*)Cell, W);
+- for (i = 0; i < W; i++)
+- if (Cell[i] & 0x8000) {
+- ch = Cell[i] & 0xff;
+- Cell[i] &= 0x7f00;
+- Cell[i] |= ftesl_get_dch(ch);
+- }
++ SLsmg_read_raw(linebuf, W);
++ for (i = 0; i < W; i++) {
++ if (linebuf[i].color & SLSMG_ACS_MASK)
++ Cell[i] = ftesl_get_dch(linebuf[i]);
++ else
++ /*
++ * FIXME: Handle UTF-8 -- way beyond a quick-and-dirty
++ * fix. --MV
++ */
++ Cell[i] = SLSMG_EXTRACT_CHAR(linebuf[i]);
++ /*
++ * FIXME: This preserves only 7 out of 15 bits of color.
++ * Fortunately, we're dealing with color handles rather than
++ * colors themselves -- S-Lang jumps through an extra hoop to
++ * map these to color data. As long as we use less than 127
++ * different colors, things should be OK. I think. --MV
++ */
++ Cell[i] |= (linebuf[i].color & 0x7f) << 8;
++ }
+ Cell += W;
+ H--;
+ }
+ ConSetCursorPos(CurX, CurY);
+
++ delete [] (linebuf);
++
+ return 0;
+
+ }
+
+-static int ConGetBoxRaw(int X, int Y, int W, int H, unsigned short *box)
++static int ConGetBoxRaw(int X, int Y, int W, int H, SLsmg_Char_Type *box)
+ {
+ int CurX, CurY;
+
+ ConQueryCursorPos(&CurX, &CurY);
+ while (H > 0) {
+ SLsmg_gotorc(Y++, X);
+- SLsmg_read_raw((SLsmg_Char_Type*)box, W);
++ SLsmg_read_raw(box, W);
+ box += W;
+ H--;
+ }
+@@ -451,9 +466,9 @@
+
+ int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count)
+ {
+- unsigned short *box;
++ SLsmg_Char_Type *box;
+
+- box = new unsigned short [W * H];
++ box = new SLsmg_Char_Type [W * H];
+
+ TCell fill = (((unsigned) Fill) << 8) | ' ';
+
diff --git a/app-editors/fte/fte-20051115-r3.ebuild b/app-editors/fte/fte-20051115-r3.ebuild
new file mode 100644
index 000000000000..ea155c1e9f64
--- /dev/null
+++ b/app-editors/fte/fte-20051115-r3.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=4
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Lightweight text-mode editor"
+HOMEPAGE="http://fte.sourceforge.net"
+SRC_URI="
+ mirror://sourceforge/fte/${P}-src.zip
+ mirror://sourceforge/fte/${P}-common.zip"
+
+LICENSE="|| ( GPL-2 Artistic )"
+SLOT="0"
+KEYWORDS="~alpha amd64 ppc -sparc x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="gpm slang X"
+
+S="${WORKDIR}/${PN}"
+
+RDEPEND="
+ >=sys-libs/ncurses-5.2
+ X? (
+ x11-libs/libXdmcp
+ x11-libs/libXau
+ x11-libs/libX11
+ x11-libs/libXpm
+ )
+ gpm? ( >=sys-libs/gpm-1.20 )"
+DEPEND="${RDEPEND}
+ slang? ( >=sys-libs/slang-2.1.3 )
+ app-arch/unzip"
+
+set_targets() {
+ export TARGETS=""
+ use slang && TARGETS="${TARGETS} sfte"
+ use X && TARGETS="${TARGETS} xfte"
+
+ [[ ${CHOST} == *-linux-gnu* ]] \
+ && TARGETS="${TARGETS} vfte" \
+ || TARGETS="${TARGETS} nfte"
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/fte-gcc34 \
+ "${FILESDIR}"/${PN}-new_keyword.patch \
+ "${FILESDIR}"/${PN}-slang.patch \
+ "${FILESDIR}"/${PN}-interix.patch \
+ "${FILESDIR}"/${PN}-cpp14.patch # bug #595048
+
+ [[ -e /usr/include/linux/keyboard.h ]] && \
+ sed /usr/include/linux/keyboard.h -e '/wait.h/d' > src/hacked_keyboard.h
+
+ sed \
+ -e "s:<linux/keyboard.h>:\"hacked_keyboard.h\":" \
+ -i src/con_linux.cpp || die "sed keyboard"
+ sed \
+ -e 's:^OPTIMIZE:#&:g' \
+ -e '/^LDFLAGS/s:=:+=:g' \
+ -e 's:= g++:= $(CXX):g' \
+ -i src/fte-unix.mak || die "sed CFLAGS, LDFLAGS, CC"
+ ecvs_clean
+}
+
+src_configure() {
+ set_targets
+ sed \
+ -e "s:@targets@:${TARGETS}:" \
+ -e '/^XINCDIR =/c\XINCDIR =' \
+ -e '/^XLIBDIR =/c\XLIBDIR = -lstdc++' \
+ -e '/^SINCDIR =/c\SINCDIR = -I'"${EPREFIX}"'/usr/include/slang' \
+ -i src/fte-unix.mak || die "sed targets"
+
+ if ! use gpm; then
+ sed \
+ -e "s:#define USE_GPM://#define USE_GPM:" \
+ -i src/con_linux.cpp || die "sed USE_GPM"
+ sed \
+ -e "s:-lgpm::" \
+ -i src/fte-unix.mak || die "sed -lgpm"
+ fi
+}
+
+src_compile() {
+ local os="-DLINUX" # by now the default in makefile
+ [[ ${CHOST} == *-interix* ]] && os=
+
+ DEFFLAGS="PREFIX='${EPREFIX}'/usr CONFIGDIR='${EPREFIX}'/usr/share/fte \
+ DEFAULT_FTE_CONFIG=../config/main.fte UOS=${os}"
+
+ set_targets
+ emake CXX=$(tc-getCXX) OPTIMIZE="${CXXFLAGS}" ${DEFFLAGS} TARGETS="${TARGETS}" all
+}
+
+src_install() {
+ local files
+
+ keepdir /etc/fte
+
+ into /usr
+
+ set_targets
+ files="${TARGETS} cfte"
+
+ for i in ${files}; do
+ dobin src/$i
+ done
+
+ dobin "${FILESDIR}"/fte
+
+ dodoc CHANGES BUGS HISTORY README TODO
+ dohtml doc/*
+
+ insinto /usr/share/fte
+ doins -r config/*
+}
+
+pkg_postinst() {
+ ebegin "Compiling configuration"
+ cd "${EPREFIX}"/usr/share/fte || die "missing configuration dir"
+ "${EPREFIX}"/usr/bin/cfte main.fte "${EPREFIX}"/etc/fte/system.fterc
+ eend $?
+}
diff --git a/app-editors/fte/fte-20110708-r1.ebuild b/app-editors/fte/fte-20110708-r1.ebuild
new file mode 100644
index 000000000000..e32fb0fe8861
--- /dev/null
+++ b/app-editors/fte/fte-20110708-r1.ebuild
@@ -0,0 +1,119 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Lightweight text-mode editor"
+HOMEPAGE="http://fte.sourceforge.net"
+SRC_URI="
+ mirror://sourceforge/${PN}/${P}-src.zip
+ mirror://sourceforge/${PN}/${P}-common.zip"
+
+LICENSE="|| ( GPL-2 Artistic )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ppc -sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="gpm slang X"
+
+S="${WORKDIR}/${PN}"
+
+RDEPEND="
+ sys-libs/ncurses:0=
+ X? (
+ x11-libs/libXdmcp
+ x11-libs/libXau
+ x11-libs/libX11
+ x11-libs/libXpm
+ )
+ gpm? ( >=sys-libs/gpm-1.20 )"
+DEPEND="${RDEPEND}
+ slang? ( >=sys-libs/slang-2.1.3 )
+ app-arch/unzip"
+
+HTML_DOCS=( doc/. )
+
+set_targets() {
+ export TARGETS=""
+ use slang && TARGETS="${TARGETS} s${PN}"
+ use X && TARGETS="${TARGETS} x${PN}"
+
+ [[ ${CHOST} == *-linux-gnu* ]] \
+ && TARGETS="${TARGETS} v${PN}" \
+ || TARGETS="${TARGETS} n${PN}"
+}
+
+src_prepare() {
+ default
+
+ if [[ -e "${EPREFIX}"/usr/include/linux/keyboard.h ]]; then
+ sed "${EPREFIX}"/usr/include/linux/keyboard.h \
+ -e '/wait.h/d' > src/hacked_keyboard.h || die
+ fi
+
+ sed \
+ -e "s:<linux/keyboard.h>:\"hacked_keyboard.h\":" \
+ -i src/con_linux.cpp || die "sed keyboard"
+ sed \
+ -e 's:^OPTIMIZE:#&:g' \
+ -e '/^LDFLAGS/s:=:+=:g' \
+ -e 's:= g++:= $(CXX):g' \
+ -i src/${PN}-unix.mak || die "sed CFLAGS, LDFLAGS, CC"
+ ecvs_clean
+}
+
+src_configure() {
+ set_targets
+ sed \
+ -e "s:@targets@:${TARGETS}:" \
+ -e '/^XINCDIR =/c\XINCDIR =' \
+ -e '/^XLIBDIR =/c\XLIBDIR = -lstdc++' \
+ -e '/^SINCDIR =/c\SINCDIR = -I'"${EPREFIX}"'/usr/include/slang' \
+ -i src/${PN}-unix.mak || die "sed targets"
+
+ if ! use gpm; then
+ sed \
+ -e "s:#define USE_GPM://#define USE_GPM:" \
+ -i src/con_linux.cpp || die "sed USE_GPM"
+ sed \
+ -e "s:-lgpm::" \
+ -i src/fte-unix.mak || die "sed -lgpm"
+ fi
+}
+
+src_compile() {
+ local os="-DLINUX" # by now the default in makefile
+ [[ ${CHOST} == *-interix* ]] && os=
+
+ DEFFLAGS="PREFIX='${EPREFIX}'/usr CONFIGDIR='${EPREFIX}'/usr/share/${PN} \
+ DEFAULT_FTE_CONFIG=../config/main.${PN} UOS=${os}"
+
+ set_targets
+ emake CXX="$(tc-getCXX)" OPTIMIZE="${CXXFLAGS}" "${DEFFLAGS}" TARGETS="${TARGETS}" all
+}
+
+src_install() {
+ keepdir /etc/${PN}
+ into /usr
+
+ set_targets
+
+ local i files="${TARGETS} c${PN}"
+ for i in ${files}; do
+ dobin src/${i}
+ done
+
+ dobin "${FILESDIR}/${PN}"
+
+ einstalldocs
+
+ insinto /usr/share/${PN}
+ doins -r config/.
+}
+
+pkg_postinst() {
+ ebegin "Compiling configuration"
+ cd "${EPREFIX}"/usr/share/${PN} || die "missing configuration dir"
+ "${EPREFIX}"/usr/bin/c${PN} main.${PN} "${EPREFIX}"/etc/${PN}/system.${PN}rc || die
+ eend $?
+}
diff --git a/app-editors/fte/metadata.xml b/app-editors/fte/metadata.xml
new file mode 100644
index 000000000000..c209ef776339
--- /dev/null
+++ b/app-editors/fte/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <!-- maintainer-needed -->
+ <longdescription>Lightweight text-mode editor.</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">fte</remote-id>
+ </upstream>
+</pkgmetadata>