Browse Source

Add newsbeuter (#298)

* Add build description for json-c

* Add build description for stfl library

* Add build description for newsbeuter

* Add patch fixing single-feed cache cleanup
android-5
Balázs Kutil 8 years ago
committed by Fredrik Fornwall
parent
commit
b3a91ddd58
  1. 16
      packages/json-c/001-unused-var.patch
  2. 11
      packages/json-c/build.sh
  3. 14
      packages/newsbeuter/001_drop_ncurses_check.patch
  4. 90
      packages/newsbeuter/002_langinfo.patch
  5. 22
      packages/newsbeuter/003_lockf.patch
  6. 46
      packages/newsbeuter/004_wordexp-stub.patch
  7. 75
      packages/newsbeuter/005_getpass.patch
  8. 30
      packages/newsbeuter/006_makefile.patch
  9. 41
      packages/newsbeuter/007_translit.patch
  10. 37
      packages/newsbeuter/008_cleanup-cache.patch
  11. 22
      packages/newsbeuter/build.sh
  12. 49
      packages/stfl/001-makefile.patch
  13. 18
      packages/stfl/build.sh

16
packages/json-c/001-unused-var.patch

@ -0,0 +1,16 @@
diff -Naur json-c-0.12.orig/json_tokener.c json-c-0.12/json_tokener.c
--- json-c-0.12.orig/json_tokener.c 2014-04-11 02:41:08.000000000 +0200
+++ json-c-0.12/json_tokener.c 2016-05-29 21:06:19.949897169 +0200
@@ -352,12 +352,10 @@
case json_tokener_state_inf: /* aka starts with 'i' */
{
- int size;
int size_inf;
int is_negative = 0;
printbuf_memappend_fast(tok->pb, &c, 1);
- size = json_min(tok->st_pos+1, json_null_str_len);
size_inf = json_min(tok->st_pos+1, json_inf_str_len);
char *infbuf = tok->pb->buf;
if (*infbuf == '-')

11
packages/json-c/build.sh

@ -0,0 +1,11 @@
TERMUX_PKG_HOMEPAGE=https://github.com/json-c/json-c/wiki
TERMUX_PKG_DESCRIPTION="A JSON implementation in C"
TERMUX_PKG_VERSION=0.12
TERMUX_PKG_MAINTAINER="Balazs Kutil @balazs_kutil"
TERMUX_PKG_SRCURL=https://s3.amazonaws.com/json-c_releases/releases/json-c-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_FOLDERNAME=json-c-${TERMUX_PKG_VERSION}
termux_step_make () {
make \
LDFLAGS="$LDFLAGS -llog"
}

14
packages/newsbeuter/001_drop_ncurses_check.patch

@ -0,0 +1,14 @@
diff -Naur newsbeuter.orig/config.sh newsbeuter/config.sh
--- newsbeuter.orig/config.sh 2016-11-13 11:12:30.735183059 +0100
+++ newsbeuter/config.sh 2016-11-13 11:20:14.820017266 +0100
@@ -107,10 +107,5 @@
check_pkg "stfl" || fail "stfl"
( check_pkg "json" "" 0.11 || check_pkg "json-c" "" 0.11 ) || fail "json-c"
-if [ `uname -s` = "Darwin" ]; then
- check_custom "ncurses5.4" "ncurses5.4-config" || fail "ncurses5.4"
-elif [ `uname -s` != "OpenBSD" ]; then
- check_custom "ncursesw5" "ncursesw5-config" || fail "ncursesw"
-fi
check_ssl_implementation
all_aboard_the_fail_boat

90
packages/newsbeuter/002_langinfo.patch

@ -0,0 +1,90 @@
diff -Naur newsbeuter-2.9.orig/src/controller.cpp newsbeuter-2.9/src/controller.cpp
--- newsbeuter-2.9.orig/src/controller.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/controller.cpp 2016-05-30 07:22:44.205246118 +0200
@@ -35,7 +35,11 @@
#include <signal.h>
#include <unistd.h>
#include <sys/utsname.h>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
#include <libgen.h>
#include <sys/types.h>
diff -Naur newsbeuter-2.9.orig/src/feedlist_formaction.cpp newsbeuter-2.9/src/feedlist_formaction.cpp
--- newsbeuter-2.9.orig/src/feedlist_formaction.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/feedlist_formaction.cpp 2016-05-30 07:23:49.126683313 +0200
@@ -16,7 +16,11 @@
#include <cstring>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
#define FILTER_UNREAD_FEEDS "unread_count != \"0\""
diff -Naur newsbeuter-2.9.orig/src/itemlist_formaction.cpp newsbeuter-2.9/src/itemlist_formaction.cpp
--- newsbeuter-2.9.orig/src/itemlist_formaction.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/itemlist_formaction.cpp 2016-05-30 07:24:48.211991329 +0200
@@ -11,7 +11,11 @@
#include <cassert>
#include <sstream>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
#define FILTER_UNREAD_ITEMS "unread != \"no\""
diff -Naur newsbeuter-2.9.orig/src/rss.cpp newsbeuter-2.9/src/rss.cpp
--- newsbeuter-2.9.orig/src/rss.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/rss.cpp 2016-05-30 07:25:47.473303219 +0200
@@ -14,7 +14,11 @@
#include <sys/utsname.h>
#include <htmlrenderer.h>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
#include <cerrno>
diff -Naur newsbeuter-2.9.orig/src/stflpp.cpp newsbeuter-2.9/src/stflpp.cpp
--- newsbeuter-2.9.orig/src/stflpp.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/stflpp.cpp 2016-05-30 07:23:16.721965956 +0200
@@ -3,7 +3,11 @@
#include <exception.h>
#include <cerrno>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
namespace newsbeuter {
diff -Naur newsbeuter-2.9.orig/src/utils.cpp newsbeuter-2.9/src/utils.cpp
--- newsbeuter-2.9.orig/src/utils.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/utils.cpp 2016-05-30 07:26:15.429922120 +0200
@@ -21,7 +21,11 @@
#include <curl/curl.h>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
#include <stfl.h>
#include <libxml/uri.h>

22
packages/newsbeuter/003_lockf.patch

@ -0,0 +1,22 @@
diff -Naur newsbeuter-2.9.orig/src/utils.cpp newsbeuter-2.9/src/utils.cpp
--- newsbeuter-2.9.orig/src/utils.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/utils.cpp 2016-05-30 22:48:05.751627034 +0200
@@ -37,6 +47,18 @@
#include <openssl/crypto.h>
#endif
+#ifdef __ANDROID__
+
+# define F_ULOCK 0 /* Unlock a previously locked region. */
+# define F_LOCK 1 /* Lock a region for exclusive use. */
+# define F_TLOCK 2 /* Test and lock a region for exclusive use. */
+# define F_TEST 3 /* Test a region for other processes locks. */
+
+inline int lockf(int fd, int cmd, off_t ignored_len) {
+ return flock(fd, cmd);
+}
+#endif
+
namespace newsbeuter {
std::vector<std::string> utils::tokenize_quoted(const std::string& str, std::string delimiters) {

46
packages/newsbeuter/004_wordexp-stub.patch

@ -0,0 +1,46 @@
diff -Naur newsbeuter-2.9.orig/include/wordexp.h newsbeuter-2.9/include/wordexp.h
--- newsbeuter-2.9.orig/include/wordexp.h 1970-01-01 01:00:00.000000000 +0100
+++ newsbeuter-2.9/include/wordexp.h 2016-05-30 20:37:10.370577949 +0200
@@ -0,0 +1,42 @@
+/*
+ *
+ * Copied from BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 1991-2013 Free Software Foundation, Inc.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#ifndef _WORDEXP_H_
+#define _WORDEXP_H_
+#define WRDE_NOCMD 0
+
+typedef struct {
+ size_t we_wordc;
+ char **we_wordv;
+ size_t we_offs;
+} wordexp_t;
+
+static inline int wordexp(const char *c, wordexp_t *w, int _i)
+{
+ return -1;
+}
+
+static inline void wordfree(wordexp_t *__wordexp)
+{
+
+}
+#endif

75
packages/newsbeuter/005_getpass.patch

@ -0,0 +1,75 @@
diff -Naur newsbeuter-2.9.orig/src/feedhq_api.cpp newsbeuter-2.9/src/feedhq_api.cpp
--- newsbeuter-2.9.orig/src/feedhq_api.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/feedhq_api.cpp 2016-05-30 20:56:34.814136288 +0200
@@ -23,6 +23,21 @@
#define FEEDHQ_API_EDIT_TAG_URL FEEDHQ_API_PREFIX "edit-tag"
#define FEEDHQ_API_TOKEN_URL FEEDHQ_API_PREFIX "token"
+#ifdef __ANDROID__
+static char* getpass(const char* prompt) {
+ static char chars[128];
+ int len = 0;
+ while (1) {
+ char c = fgetc(stdin);
+ if (c == '\r' || c == '\n' || c == 0) break;
+ chars[len++] = c;
+ if (len == sizeof(chars)-1) break;
+ }
+ chars[len] = 0;
+ return chars;
+}
+#endif
+
namespace newsbeuter {
feedhq_api::feedhq_api(configcontainer * c) : remote_api(c) {
diff -Naur newsbeuter-2.9.orig/src/oldreader_api.cpp newsbeuter-2.9/src/oldreader_api.cpp
--- newsbeuter-2.9.orig/src/oldreader_api.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/oldreader_api.cpp 2016-05-30 20:52:47.955828120 +0200
@@ -25,6 +25,21 @@
// for reference, see https://github.com/theoldreader/api
+#ifdef __ANDROID__
+static char* getpass(const char* prompt) {
+ static char chars[128];
+ int len = 0;
+ while (1) {
+ char c = fgetc(stdin);
+ if (c == '\r' || c == '\n' || c == 0) break;
+ chars[len++] = c;
+ if (len == sizeof(chars)-1) break;
+ }
+ chars[len] = 0;
+ return chars;
+}
+#endif
+
namespace newsbeuter {
oldreader_api::oldreader_api(configcontainer * c) : remote_api(c) {
diff -Naur newsbeuter-2.9.orig/src/ttrss_api.cpp newsbeuter-2.9/src/ttrss_api.cpp
--- newsbeuter-2.9.orig/src/ttrss_api.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/ttrss_api.cpp 2016-05-30 20:46:00.368865179 +0200
@@ -10,6 +10,21 @@
#include <markreadthread.h>
+#ifdef __ANDROID__
+static char* getpass(const char* prompt) {
+ static char chars[128];
+ int len = 0;
+ while (1) {
+ char c = fgetc(stdin);
+ if (c == '\r' || c == '\n' || c == 0) break;
+ chars[len++] = c;
+ if (len == sizeof(chars)-1) break;
+ }
+ chars[len] = 0;
+ return chars;
+}
+#endif
+
namespace newsbeuter {
ttrss_api::ttrss_api(configcontainer * c) : remote_api(c) {

30
packages/newsbeuter/006_makefile.patch

@ -0,0 +1,30 @@
diff -Naur newsbeuter-2.9.orig/Makefile newsbeuter-2.9/Makefile
--- newsbeuter-2.9.orig/Makefile 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/Makefile 2016-05-30 22:19:09.524310908 +0200
@@ -35,7 +35,7 @@
NEWSBEUTER=newsbeuter
NEWSBEUTER_SOURCES:=$(shell cat mk/newsbeuter.deps)
NEWSBEUTER_OBJS:=$(patsubst %.cpp,%.o,$(NEWSBEUTER_SOURCES))
-NEWSBEUTER_LIBS=-lbeuter -lfilter -lpthread -lrsspp
+NEWSBEUTER_LIBS=-lbeuter -lfilter -lrsspp -lncursesw
RSSPPLIB_SOURCES=$(wildcard rss/*.cpp)
RSSPPLIB_OBJS=$(patsubst rss/%.cpp,rss/%.o,$(RSSPPLIB_SOURCES))
@@ -45,7 +45,7 @@
PODBEUTER=podbeuter
PODBEUTER_SOURCES:=$(shell cat mk/podbeuter.deps)
PODBEUTER_OBJS:=$(patsubst %.cpp,%.o,$(PODBEUTER_SOURCES))
-PODBEUTER_LIBS=-lbeuter -lpthread
+PODBEUTER_LIBS=-lbeuter
ifeq (, $(filter Linux GNU GNU/%, $(shell uname -s)))
NEWSBEUTER_LIBS+=-liconv -lintl
@@ -57,8 +57,6 @@
INSTALL=install
A2X=a2x
MSGFMT=msgfmt
-RANLIB=ranlib
-AR=ar
STFLHDRS:=$(patsubst %.stfl,%.h,$(wildcard stfl/*.stfl))
POFILES:=$(wildcard po/*.po)

41
packages/newsbeuter/007_translit.patch

@ -0,0 +1,41 @@
diff -Naur newsbeuter-2.9.orig/src/stflpp.cpp newsbeuter-2.9/src/stflpp.cpp
--- newsbeuter-2.9.orig/src/stflpp.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/stflpp.cpp 2016-06-02 23:38:15.880195527 +0200
@@ -16,7 +20,7 @@
*/
stfl::form::form(const std::string& text) : f(0) {
- ipool = stfl_ipool_create((std::string(nl_langinfo(CODESET)) + "//TRANSLIT").c_str());
+ ipool = stfl_ipool_create(std::string(nl_langinfo(CODESET)).c_str());
if (!ipool) {
throw exception(errno);
}
@@ -82,7 +86,7 @@
std::string stfl::quote(const std::string& text) {
std::lock_guard<std::mutex> lock(quote_mtx);
- stfl_ipool * ipool = stfl_ipool_create((std::string(nl_langinfo(CODESET)) + "//TRANSLIT").c_str());
+ stfl_ipool * ipool = stfl_ipool_create(std::string(nl_langinfo(CODESET)).c_str());
std::string retval = stfl_ipool_fromwc(ipool,stfl_quote(stfl_ipool_towc(ipool,text.c_str())));
stfl_ipool_destroy(ipool);
return retval;
diff -Naur newsbeuter-2.9.orig/src/utils.cpp newsbeuter-2.9/src/utils.cpp
--- newsbeuter-2.9.orig/src/utils.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/utils.cpp 2016-06-02 23:38:38.648892251 +0200
@@ -262,7 +272,7 @@
if (strcasecmp(tocode.c_str(), fromcode.c_str())==0)
return text;
- iconv_t cd = ::iconv_open((tocode + "//TRANSLIT").c_str(), fromcode.c_str());
+ iconv_t cd = ::iconv_open(tocode.c_str(), fromcode.c_str());
if (cd == reinterpret_cast<iconv_t>(-1))
return result;
@@ -498,7 +508,6 @@
std::string utils::wstr2str(const std::wstring& wstr) {
std::string codeset = nl_langinfo(CODESET);
- codeset.append("//TRANSLIT");
struct stfl_ipool * ipool = stfl_ipool_create(codeset.c_str());
std::string result = stfl_ipool_fromwc(ipool, wstr.c_str());
stfl_ipool_destroy(ipool);

37
packages/newsbeuter/008_cleanup-cache.patch

@ -0,0 +1,37 @@
From 931e9aec73f94b5c6e70bcb9f0c857827650ec30 Mon Sep 17 00:00:00 2001
From: Simon Nagl <simonnagl@aim.com>
Date: Thu, 7 May 2015 22:06:00 +0200
Subject: [PATCH 1/1] Bugfix: #180 Fixed cleanup_cache for one line config file
Fixed the generation of the string list.
First with only one url in file urls list looked like this:
('www.feed.com/rss''') which does not lead to a working SQL statement.
Now, lists do always end with ', '')
---
src/cache.cpp | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/cache.cpp b/src/cache.cpp
index ae2c98f..4376d10 100644
--- a/src/cache.cpp
+++ b/src/cache.cpp
@@ -555,15 +555,11 @@ void cache::cleanup_cache(std::vector<std::shared_ptr<rss_feed>>& feeds) {
LOG(LOG_DEBUG,"cache::cleanup_cache: cleaning up cache...");
std::string list = "(";
int rc;
- unsigned int i = 0;
- unsigned int feed_size = feeds.size();
for (auto feed : feeds) {
std::string name = prepare_query("'%q'",feed->rssurl().c_str());
list.append(name);
- if (i < feed_size-1) {
- list.append(", ");
- }
+ list.append(", ");
}
list.append("'')");
--
2.7.4 (Apple Git-66)

22
packages/newsbeuter/build.sh

@ -0,0 +1,22 @@
TERMUX_PKG_HOMEPAGE=http://www.newsbeuter.org
TERMUX_PKG_DESCRIPTION="An open-source RSS/Atom feed reader for text terminals"
TERMUX_PKG_VERSION=2.9
TERMUX_PKG_SRCURL=http://www.newsbeuter.org/downloads/newsbeuter-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_FOLDERNAME=newsbeuter-${TERMUX_PKG_VERSION}
TERMUX_PKG_DEPENDS="libandroid-support, json-c, libsqlite, libcurl, libxml2, stfl, ncurses, openssl"
TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_RM_AFTER_INSTALL="share/locale"
termux_step_pre_configure () {
# Put a temporary link for libtinfo.so
ln -s -f $TERMUX_PREFIX/lib/libncursesw.so $TERMUX_PREFIX/lib/libtinfo.so
}
termux_step_configure () {
# nwesbeuter doesn't contain configure script
return
}
termux_step_post_make_install () {
rm $TERMUX_PREFIX/lib/libtinfo.so
}

49
packages/stfl/001-makefile.patch

@ -0,0 +1,49 @@
diff -Naur stfl-0.24.orig/Makefile stfl-0.24/Makefile
--- stfl-0.24.orig/Makefile 2015-02-12 14:14:33.000000000 +0100
+++ stfl-0.24/Makefile 2016-05-31 21:26:11.162048447 +0200
@@ -20,10 +20,6 @@
include Makefile.cfg
-export CC = gcc -pthread
-export CFLAGS += -I. -Wall -Os -ggdb -D_GNU_SOURCE -fPIC
-export LDLIBS += -lncursesw
-
SONAME := libstfl.so.0
VERSION := 0.24
@@ -34,12 +30,12 @@
libstfl.a: public.o base.o parser.o dump.o style.o binding.o iconv.o \
$(patsubst %.c,%.o,$(wildcard widgets/*.c))
rm -f $@
- ar qc $@ $^
- ranlib $@
+ $(AR) qc $@ $^
+ $(RANLIB) $@
libstfl.so.$(VERSION): public.o base.o parser.o dump.o style.o binding.o iconv.o \
$(patsubst %.c,%.o,$(wildcard widgets/*.c))
- $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $(LDLIBS) $^
+ $(CC) $(LDFLAGS) -shared -Wl,-soname,$(SONAME) -o $@ $(LDLIBS) $^
clean:
rm -f libstfl.a example core core.* *.o Makefile.deps
@@ -65,6 +61,7 @@
install -m 644 stfl.pc $(DESTDIR)$(prefix)/$(libdir)/pkgconfig/
install -m 644 libstfl.so.$(VERSION) $(DESTDIR)$(prefix)/$(libdir)
ln -fs libstfl.so.$(VERSION) $(DESTDIR)$(prefix)/$(libdir)/libstfl.so
+ ln -fs libstfl.so.$(VERSION) $(DESTDIR)$(prefix)/$(libdir)/libstfl.so.0
stfl.pc: stfl.pc.in
sed 's,@VERSION@,$(VERSION),g' < $< | sed 's,@PREFIX@,$(prefix),g' > $@
diff -Naur stfl-0.24.orig/Makefile.cfg stfl-0.24/Makefile.cfg
--- stfl-0.24.orig/Makefile.cfg 2009-05-31 20:20:39.000000000 +0200
+++ stfl-0.24/Makefile.cfg 2016-05-30 05:50:59.051375377 +0200
@@ -20,7 +20,6 @@
export libdir ?= lib
export prefix ?= /usr/local
-export DESTDIR ?= /
ifneq ($(shell spl-config --cflags 2>/dev/null),)
FOUND_SPL = 1

18
packages/stfl/build.sh

@ -0,0 +1,18 @@
TERMUX_PKG_HOMEPAGE=http://www.clifford.at/stfl
TERMUX_PKG_DESCRIPTION="Structured Terminal Forms Language/Library"
TERMUX_PKG_VERSION=0.24
TERMUX_PKG_SRCURL=http://www.clifford.at/stfl/stfl-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_FOLDERNAME=stfl-${TERMUX_PKG_VERSION}
TERMUX_PKG_DEPENDS="libandroid-support, ncurses"
TERMUX_PKG_BUILD_IN_SRC=yes
termux_step_configure () {
# stfl doesn't contain configure script
return
}
termux_step_make () {
export CFLAGS="-I. -fPIC -Wall -Os -ggdb"
export LDFLAGS="-L${TERMUX_PREFIX}/lib -lncursesw -liconv"
make
}
Loading…
Cancel
Save