From c4b0d4bc32053660476c54a7471c6d312651788a Mon Sep 17 00:00:00 2001
From: Petter
Date: Sun, 23 Apr 2017 13:46:41 +0200
Subject: [PATCH] gnu: Add cool-retro-term.
* gnu/packages/terminals.scm (cool-retro-term): New variable.
---
.../cool-retro-term-dont-check-uninit-member.patch | 33 ++
.../patches/cool-retro-term-fix-array-size.patch | 25 ++
.../patches/cool-retro-term-memory-leak-1.patch | 32 ++
.../cool-retro-term-remove-non-free-fonts.patch | 403 +++++++++++++++++++++
gnu/packages/terminals.scm | 109 ++++++
5 files changed, 602 insertions(+)
create mode 100644 gnu/packages/patches/cool-retro-term-dont-check-uninit-member.patch
create mode 100644 gnu/packages/patches/cool-retro-term-fix-array-size.patch
create mode 100644 gnu/packages/patches/cool-retro-term-memory-leak-1.patch
create mode 100644 gnu/packages/patches/cool-retro-term-remove-non-free-fonts.patch
diff --git a/gnu/packages/patches/cool-retro-term-dont-check-uninit-member.patch b/gnu/packages/patches/cool-retro-term-dont-check-uninit-member.patch
new file mode 100644
index 000000000..c6e1d2731
--- /dev/null
+++ b/gnu/packages/patches/cool-retro-term-dont-check-uninit-member.patch
@@ -0,0 +1,33 @@
+From 126a97d1f22f7d784d392b2b7d5aadf0a4e18c0d Mon Sep 17 00:00:00 2001
+From: Petter
+Date: Thu, 27 Apr 2017 20:28:02 +0200
+Subject: [PATCH] Avoid checking uninitialized member + simplify condition
+
+---
+ qmltermwidget/lib/TerminalDisplay.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/qmltermwidget/lib/TerminalDisplay.cpp b/qmltermwidget/lib/TerminalDisplay.cpp
+index 189a609..36d2cd2 100644
+--- a/qmltermwidget/lib/TerminalDisplay.cpp
++++ b/qmltermwidget/lib/TerminalDisplay.cpp
+@@ -325,6 +325,7 @@ TerminalDisplay::TerminalDisplay(QQuickItem *parent)
+ ,_terminalSizeHint(false)
+ ,_terminalSizeStartup(true)
+ ,_bidiEnabled(false)
++,_mouseMarks(false)
+ ,_actSel(0)
+ ,_wordSelectionMode(false)
+ ,_lineSelectionMode(false)
+@@ -1846,7 +1847,7 @@ void TerminalDisplay::mousePressEvent(QMouseEvent* ev)
+ }
+ else if ( ev->button() == Qt::MidButton )
+ {
+- if ( _mouseMarks || (!_mouseMarks && (ev->modifiers() & Qt::ShiftModifier)) )
++ if ( _mouseMarks || (ev->modifiers() & Qt::ShiftModifier) )
+ emitSelection(true,ev->modifiers() & Qt::ControlModifier);
+ else
+ emit mouseSignal( 1, charColumn +1, charLine +1 +_scrollBar->value() -_scrollBar->maximum() , 0);
+--
+2.12.2
+
diff --git a/gnu/packages/patches/cool-retro-term-fix-array-size.patch b/gnu/packages/patches/cool-retro-term-fix-array-size.patch
new file mode 100644
index 000000000..04a2a2797
--- /dev/null
+++ b/gnu/packages/patches/cool-retro-term-fix-array-size.patch
@@ -0,0 +1,25 @@
+From c91d7ae5dbb00c8392a9f93283dc56c3e296cccd Mon Sep 17 00:00:00 2001
+From: Petter
+Date: Thu, 27 Apr 2017 20:19:21 +0200
+Subject: [PATCH] Fix size of the array passed to memset()
+
+---
+ qmltermwidget/lib/History.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/qmltermwidget/lib/History.cpp b/qmltermwidget/lib/History.cpp
+index 0f9c13f..ab6f7be 100644
+--- a/qmltermwidget/lib/History.cpp
++++ b/qmltermwidget/lib/History.cpp
+@@ -515,7 +515,7 @@ void HistoryScrollBlockArray::addCells(const Character a[], int count)
+ // put cells in block's data
+ assert((count * sizeof(Character)) < ENTRIES);
+
+- memset(b->data, 0, ENTRIES);
++ memset(b->data, 0, sizeof(b->data));
+
+ memcpy(b->data, a, count * sizeof(Character));
+ b->size = count * sizeof(Character);
+--
+2.12.2
+
diff --git a/gnu/packages/patches/cool-retro-term-memory-leak-1.patch b/gnu/packages/patches/cool-retro-term-memory-leak-1.patch
new file mode 100644
index 000000000..f3fbac17d
--- /dev/null
+++ b/gnu/packages/patches/cool-retro-term-memory-leak-1.patch
@@ -0,0 +1,32 @@
+From 08628fda19128b75248548357e416bc373f14f91 Mon Sep 17 00:00:00 2001
+From: Yen Chi Hsuan
+Date: Sat, 18 Mar 2017 02:50:34 +0800
+Subject: [PATCH] Fix memory leak in hotspot (URLs & emails) detection
+
+---
+ qmltermwidget/lib/Filter.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/qmltermwidget/lib/Filter.cpp b/qmltermwidget/lib/Filter.cpp
+index 5ca7bee..2e8d2fb 100644
+--- a/qmltermwidget/lib/Filter.cpp
++++ b/qmltermwidget/lib/Filter.cpp
+@@ -26,6 +26,7 @@
+ // Qt
+ #include
+ #include
++#include
+ #include
+ #include
+ #include
+@@ -194,6 +195,7 @@ Filter::~Filter()
+ }
+ void Filter::reset()
+ {
++ qDeleteAll(_hotspotList);
+ _hotspots.clear();
+ _hotspotList.clear();
+ }
+--
+2.12.2
+
diff --git a/gnu/packages/patches/cool-retro-term-remove-non-free-fonts.patch b/gnu/packages/patches/cool-retro-term-remove-non-free-fonts.patch
new file mode 100644
index 000000000..2fc61f817
--- /dev/null
+++ b/gnu/packages/patches/cool-retro-term-remove-non-free-fonts.patch
@@ -0,0 +1,403 @@
+From 96ceffdfdcedd3ae33c46b11357aa2518e0a6152 Mon Sep 17 00:00:00 2001
+From: Petter
+Date: Thu, 27 Apr 2017 18:55:10 +0200
+Subject: [PATCH] Remove non-free fonts from settings menu
+
+---
+ app/qml/ApplicationSettings.qml | 28 ++++++++++++------------
+ app/qml/FontPixels.qml | 20 ++++++++---------
+ app/qml/FontScanlines.qml | 20 ++++++++---------
+ app/qml/Fonts.qml | 48 ++++++++++++++++++++---------------------
+ 4 files changed, 58 insertions(+), 58 deletions(-)
+
+diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml
+index d0f8beb..505a4e7 100644
+--- a/app/qml/ApplicationSettings.qml
++++ b/app/qml/ApplicationSettings.qml
+@@ -409,41 +409,41 @@ QtObject{
+ obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS_SCALED","fontColor":"#0ccc68","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.2,"horizontalSync":0.16,"jitter":0.18,"burnIn":0.45,"staticNoise":0.1,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+ }
+- ListElement{
++ /*ListElement{
+ text: "Default Scanlines"
+ obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"COMMODORE_PET","fontColor":"#00ff5b","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.2,"horizontalSync":0.14,"jitter":0.11,"burnIn":0.4,"staticNoise":0.05,"rasterization":1,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ text: "Default Pixelated"
+ obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0,"brightness":0.5,"flickering":0.2,"contrast":0.85,"fontName":"COMMODORE_PET","fontColor":"#ffffff","frameName":"ROUGH_BLACK_FRAME","glowingLine":0.2,"horizontalSync":0.2,"jitter":0,"burnIn":0.45,"staticNoise":0.19,"rasterization":2,"screenCurvature":0.05,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ text: "Apple ]["
+ obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.5,"brightness":0.5,"flickering":0.2,"contrast":0.85,"fontName":"APPLE_II","fontColor":"#2fff91","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.22,"horizontalSync":0.16,"jitter":0.1,"burnIn":0.65,"staticNoise":0.08,"rasterization":1,"screenCurvature":0.18,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ text: "Vintage"
+ obj_string: '{"ambientLight":0.5,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.9,"contrast":0.80,"fontName":"COMMODORE_PET","fontColor":"#00ff3e","frameName":"ROUGH_BLACK_FRAME","glowingLine":0.3,"horizontalSync":0.42,"jitter":0.4,"burnIn":0.75,"staticNoise":0.2,"rasterization":1,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ text: "IBM Dos"
+ obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.07,"contrast":0.85,"fontName":"IBM_DOS","fontColor":"#ffffff","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.13,"horizontalSync":0,"jitter":0.16,"burnIn":0.3,"staticNoise":0.03,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":1,"saturationColor":0,"rbgShift":0.35,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ text: "IBM 3278"
+ obj_string: '{"ambientLight":0.1,"backgroundColor":"#000000","bloom":0.15,"brightness":0.5,"flickering":0,"contrast":0.85,"fontName":"IBM_3278","fontColor":"#0ccc68","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0,"horizontalSync":0,"jitter":0,"burnIn":0.6,"staticNoise":0,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ text: "Transparent Green"
+ obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.45,"brightness":0.5,"flickering":0.20,"contrast":0.85,"fontName":"TERMINUS_SCALED","fontColor":"#0ccc68","frameName":"NO_FRAME","glowingLine":0.16,"horizontalSync":0.1,"jitter":0.20,"burnIn":0.25,"staticNoise":0.20,"rasterization":0,"screenCurvature":0.05,"windowOpacity":0.60,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+- }
++ }*/
+ }
+
+ function getProfileIndexByName(name) {
+diff --git a/app/qml/FontPixels.qml b/app/qml/FontPixels.qml
+index 6ff85da..6f0d0ba 100644
+--- a/app/qml/FontPixels.qml
++++ b/app/qml/FontPixels.qml
+@@ -32,7 +32,7 @@ QtObject{
+ property bool lowResolutionFont: true
+
+ property ListModel fontlist: ListModel{
+- ListElement{
++ /*ListElement{
+ name: "COMMODORE_PET"
+ text: "Commodore PET (1977)"
+ source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
+@@ -40,7 +40,7 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.8
+- }
++ }*/
+ ListElement{
+ name: "PROGGY_TINY"
+ text: "Proggy Tiny (Modern)"
+@@ -50,7 +50,7 @@ QtObject{
+ baseScaling: 4.0
+ fontWidth: 0.9
+ }
+- ListElement{
++ /*ListElement{
+ name: "TERMINUS_SCALED"
+ text: "Terminus (Modern)"
+ source: "fonts/modern-terminus/TerminusTTF-4.38.2.ttf"
+@@ -58,7 +58,7 @@ QtObject{
+ pixelSize: 12
+ baseScaling: 3.0
+ fontWidth: 1.0
+- }
++ }*/
+ ListElement{
+ name: "PRO_FONT_SCALED"
+ text: "Pro Font (Modern)"
+@@ -68,7 +68,7 @@ QtObject{
+ baseScaling: 3.0
+ fontWidth: 1.0
+ }
+- ListElement{
++ /*ListElement{
+ name: "APPLE_II"
+ text: "Apple ][ (1977)"
+ source: "fonts/1977-apple2/PrintChar21.ttf"
+@@ -76,8 +76,8 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.9
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "ATARI_400"
+ text: "Atari 400-800 (1979)"
+ source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
+@@ -85,8 +85,8 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.8
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "COMMODORE_64"
+ text: "Commodore 64 (1982)"
+ source: "fonts/1982-commodore64/C64_Pro_Mono_v1.0-STYLE.ttf"
+@@ -94,6 +94,6 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.8
+- }
++ }*/
+ }
+ }
+diff --git a/app/qml/FontScanlines.qml b/app/qml/FontScanlines.qml
+index eebf00b..410d7b6 100644
+--- a/app/qml/FontScanlines.qml
++++ b/app/qml/FontScanlines.qml
+@@ -32,7 +32,7 @@ QtObject{
+ property bool lowResolutionFont: true
+
+ property ListModel fontlist: ListModel{
+- ListElement{
++ /*ListElement{
+ name: "COMMODORE_PET"
+ text: "Commodore PET (1977)"
+ source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
+@@ -40,7 +40,7 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.7
+- }
++ }*/
+ ListElement{
+ name: "PROGGY_TINY"
+ text: "Proggy Tiny (Modern)"
+@@ -50,7 +50,7 @@ QtObject{
+ baseScaling: 4.0
+ fontWidth: 0.9
+ }
+- ListElement{
++ /*ListElement{
+ name: "TERMINUS_SCALED"
+ text: "Terminus (Modern)"
+ source: "fonts/modern-terminus/TerminusTTF-4.38.2.ttf"
+@@ -58,7 +58,7 @@ QtObject{
+ pixelSize: 12
+ baseScaling: 3.0
+ fontWidth: 1.0
+- }
++ }*/
+ ListElement{
+ name: "PRO_FONT_SCALED"
+ text: "Pro Font (Modern)"
+@@ -68,7 +68,7 @@ QtObject{
+ baseScaling: 3.0
+ fontWidth: 1.0
+ }
+- ListElement{
++ /*ListElement{
+ name: "APPLE_II"
+ text: "Apple ][ (1977)"
+ source: "fonts/1977-apple2/PrintChar21.ttf"
+@@ -76,8 +76,8 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.8
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "ATARI_400"
+ text: "Atari 400-800 (1979)"
+ source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
+@@ -85,8 +85,8 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.7
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "COMMODORE_64"
+ text: "Commodore 64 (1982)"
+ source: "fonts/1982-commodore64/C64_Pro_Mono_v1.0-STYLE.ttf"
+@@ -94,6 +94,6 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.7
+- }
++ }*/
+ }
+ }
+diff --git a/app/qml/Fonts.qml b/app/qml/Fonts.qml
+index ad20844..882808a 100644
+--- a/app/qml/Fonts.qml
++++ b/app/qml/Fonts.qml
+@@ -50,7 +50,7 @@ QtObject{
+ // Those are slower to render but are not pixelated.
+
+ property ListModel fontlist: ListModel{
+- ListElement{
++ /*ListElement{
+ name: "TERMINUS_SCALED"
+ text: "Terminus (Modern)"
+ source: "fonts/modern-terminus/TerminusTTF-4.38.2.ttf"
+@@ -59,7 +59,7 @@ QtObject{
+ baseScaling: 3.0
+ fontWidth: 1.0
+ lowResolutionFont: true
+- }
++ }*/
+ ListElement{
+ name: "PRO_FONT_SCALED"
+ text: "Pro Font (Modern)"
+@@ -70,7 +70,7 @@ QtObject{
+ fontWidth: 1.0
+ lowResolutionFont: true
+ }
+- ListElement{
++ /*ListElement{
+ name: "EXCELSIOR_SCALED"
+ text: "Fixedsys Excelsior (Modern)"
+ source: "fonts/modern-fixedsys-excelsior/FSEX301-L2.ttf"
+@@ -79,8 +79,8 @@ QtObject{
+ baseScaling: 2.4
+ fontWidth: 1.0
+ lowResolutionFont: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "COMMODORE_PET_SCALED"
+ text: "Commodore PET (1977)"
+ source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
+@@ -89,7 +89,7 @@ QtObject{
+ baseScaling: 3.5
+ fontWidth: 0.7
+ lowResolutionFont: true
+- }
++ }*/
+ ListElement{
+ name: "PROGGY_TINY_SCALED"
+ text: "Proggy Tiny (Modern)"
+@@ -100,7 +100,7 @@ QtObject{
+ fontWidth: 0.9
+ lowResolutionFont: true
+ }
+- ListElement{
++ /*ListElement{
+ name: "APPLE_II_SCALED"
+ text: "Apple ][ (1977)"
+ source: "fonts/1977-apple2/PrintChar21.ttf"
+@@ -109,8 +109,8 @@ QtObject{
+ baseScaling: 3.5
+ fontWidth: 0.8
+ lowResolutionFont: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "ATARI_400_SCALED"
+ text: "Atari 400-800 (1979)"
+ source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
+@@ -119,8 +119,8 @@ QtObject{
+ baseScaling: 3.5
+ fontWidth: 0.7
+ lowResolutionFont: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "COMMODORE_64_SCALED"
+ text: "Commodore 64 (1982)"
+ source: "fonts/1982-commodore64/C64_Pro_Mono_v1.0-STYLE.ttf"
+@@ -129,8 +129,8 @@ QtObject{
+ baseScaling: 3.5
+ fontWidth: 0.7
+ lowResolutionFont: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "ATARI_ST_SCALED"
+ text: "Atari ST (1985)"
+ source: "fonts/1985-atari-st/AtariST8x16SystemFont.ttf"
+@@ -139,8 +139,8 @@ QtObject{
+ baseScaling: 2.0
+ fontWidth: 1.0
+ lowResolutionFont: true
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "IBM_DOS"
+ text: "IBM DOS (1985)"
+ source: "fonts/1985-ibm-pc-vga/Perfect DOS VGA 437 Win.ttf"
+@@ -149,7 +149,7 @@ QtObject{
+ baseScaling: 2.0
+ fontWidth: 1.0
+ lowResolutionFont: true
+- }
++ }*/
+ ListElement{
+ name: "HERMIT"
+ text: "HD: Hermit (Modern)"
+@@ -159,7 +159,7 @@ QtObject{
+ fontWidth: 1.0
+ lowResolutionFont: false
+ }
+- ListElement{
++ /*ListElement{
+ name: "TERMINUS"
+ text: "HD: Terminus (Modern)"
+ source: "fonts/modern-terminus/TerminusTTF-4.38.2.ttf"
+@@ -167,7 +167,7 @@ QtObject{
+ pixelSize: 35
+ fontWidth: 1.0
+ lowResolutionFont: false
+- }
++ }*/
+ ListElement{
+ name: "PRO_FONT"
+ text: "HD: Pro Font (Modern)"
+@@ -177,7 +177,7 @@ QtObject{
+ fontWidth: 1.0
+ lowResolutionFont: false
+ }
+- ListElement{
++ /*ListElement{
+ name: "MONACO"
+ text: "HD: Monaco (Modern)"
+ source: "fonts/modern-monaco/monaco.ttf"
+@@ -185,8 +185,8 @@ QtObject{
+ pixelSize: 30
+ fontWidth: 1.0
+ lowResolutionFont: false
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "INCONSOLATA"
+ text: "HD: Inconsolata (Modern)"
+ source: "fonts/modern-inconsolata/Inconsolata.otf"
+@@ -194,8 +194,8 @@ QtObject{
+ pixelSize: 35
+ fontWidth: 1.0
+ lowResolutionFont: false
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "IBM_3278"
+ text: "HD: IBM 3278 (1971)"
+ source: "fonts/1971-ibm-3278/3270Medium.ttf"
+@@ -203,6 +203,6 @@ QtObject{
+ pixelSize: 32
+ fontWidth: 1.0
+ lowResolutionFont: false
+- }
++ }*/
+ }
+ }
+--
+2.12.2
+
diff --git a/gnu/packages/terminals.scm b/gnu/packages/terminals.scm
index 979278a53..ea6777e54 100644
--- a/gnu/packages/terminals.scm
+++ b/gnu/packages/terminals.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2016, 2017 José Miguel Sánchez GarcÃa
;;; Copyright © 2017 Tobias Geerinckx-Rice
;;; Copyright © 2017 Ricardo Wurmus
+;;; Copyright © 2017 Petter
;;;
;;; This file is part of GNU Guix.
;;;
@@ -31,6 +32,7 @@
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix packages)
+ #:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages freedesktop)
#:use-module (gnu packages gettext)
@@ -49,6 +51,7 @@
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages xml)
#:use-module (gnu packages docbook)
+ #:use-module (gnu packages qt)
#:use-module (srfi srfi-26))
(define-public tilda
@@ -433,3 +436,109 @@ its embedding program should provide it to draw on its behalf. It avoids
calling @code{malloc} during normal running state, allowing it to be used in
embedded kernel situations.")
(license license:expat)))
+
+(define-public cool-retro-term
+ (let ((commit "e48719fa44e5307df71dbd0fad234f8a6a53f863")
+ (revision "1"))
+ (package
+ (name "cool-retro-term")
+ (version (string-append "1.0.0-" revision "." (string-take commit 7)))
+ (source (origin
+ (method git-fetch)
+ (file-name (string-append name "-" version "-checkout"))
+ (uri (git-reference
+ (url (string-append "https://github.com/Swordfish90/" name))
+ (commit commit)
+ (recursive? #t)))
+ (sha256
+ (base32 "1sgqbirninkvgwchr35zgn5vzqvsmrf3cp7lqady1xgrawb8lsz3"))
+ (patches
+ (search-patches "cool-retro-term-remove-non-free-fonts.patch"
+ "cool-retro-term-fix-array-size.patch"
+ "cool-retro-term-dont-check-uninit-member.patch"
+ "cool-retro-term-memory-leak-1.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ '(for-each (lambda (font)
+ (delete-file-recursively
+ (string-append "app/qml/fonts/" font))
+ (substitute* '("app/qml/resources.qrc")
+ (((string-append "fonts/" font ".*"))
+ "")))
+ '("1971-ibm-3278" ; ?
+ "1977-apple2" ; Probably non-free
+ "1977-commodore-pet" ; Non-Free
+ "1979-atari-400-800" ; Probably non-free
+ "1982-commodore64" ; Non-Free
+ "1985-atari-st" ; ?
+ "1985-ibm-pc-vga" ; Probably non-free
+ "modern-fixedsys-excelsior" ; ?
+ ;"modern-hermit" ; FREE
+ "modern-inconsolata" ; ?
+ "modern-monaco" ; ?
+ ;"modern-pro-font-win-tweaked" ; FREE
+ ;"modern-proggy-tiny" ; FREE
+ "modern-terminus"))))) ; ?
+ (build-system gnu-build-system)
+ (inputs
+ `(("qtbase" ,qtbase)
+ ("qtdeclarative" ,qtdeclarative)
+ ("qtgraphicaleffects" ,qtgraphicaleffects)
+ ("qtquickcontrols" ,qtquickcontrols)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (share (string-append out "/share")))
+ (substitute* '("qmltermwidget/qmltermwidget.pro")
+ (("INSTALL_DIR = \\$\\$\\[QT_INSTALL_QML\\]")
+ (string-append "INSTALL_DIR = " out "/qml")))
+ (substitute* '("app/app.pro")
+ (("target.path \\+= /usr")
+ (string-append "target.path += " out))
+ (("icon32.path = /usr/share")
+ (string-append "icon32.path = " share))
+ (("icon64.path = /usr/share")
+ (string-append "icon64.path = " share))
+ (("icon128.path = /usr/share")
+ (string-append "icon128.path = " share))
+ (("icon256.path = /usr/share")
+ (string-append "icon256.path = " share)))
+ (zero? (system* "qmake")))))
+ (add-before 'install 'fix-Makefiles
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ (substitute* '("Makefile")
+ (("\\$\\(INSTALL_ROOT\\)/usr") out)))))
+ (add-after 'install 'wrap-executable
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (qml "/qml"))
+ (wrap-program (string-append out "/bin/cool-retro-term")
+ `("QML2_IMPORT_PATH" ":" prefix
+ (,(string-append
+ (assoc-ref %build-inputs "qtdeclarative") qml)
+ ,(string-append
+ (assoc-ref %build-inputs "qtgraphicaleffects") qml)
+ ,(string-append
+ (assoc-ref %build-inputs "qtquickcontrols") qml)))))))
+ (add-after 'install 'add-alternate-name
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((bin (string-append (assoc-ref outputs "out") "/bin")))
+ (symlink (string-append bin "/cool-retro-term")
+ (string-append bin "/crt"))))))))
+
+ (synopsis "Terminal emulator")
+ (description
+ "Cool-retro-term (crt) is a terminal emulator which mimics the look and
+feel of the old cathode ray tube (CRT) screens. It has been designed to be
+eye-candy, customizable, and reasonably lightweight.")
+ (home-page "https://github.com/Swordfish90/cool-retro-term")
+ (license (list
+ license:gpl2+ ; qmltermwidget
+ license:gpl3+ ; cool-retro-term
+ ;; Fonts
+ license:silofl1.1
+ license:x11)))))
--
2.12.2