libbsd and mg a small emacs clone

This commit is contained in:
its-pointless 2018-10-16 14:59:57 +11:00 committed by Fredrik Fornwall
parent 890b5c2298
commit 6b6336d6a0
8 changed files with 121 additions and 0 deletions

6
packages/libbsd/build.sh Normal file
View File

@ -0,0 +1,6 @@
TERMUX_PKG_HOMEPAGE=https://libbsd.freedesktop.org
TERMUX_PKG_DESCRIPTION="utility functions from BSD systems"
TERMUX_PKG_VERSION=0.9.1
TERMUX_PKG_SRCURL=https://libbsd.freedesktop.org/releases/libbsd-$TERMUX_PKG_VERSION.tar.xz
TERMUX_PKG_SHA256=56d835742327d69faccd16955a60b6dcf30684a8da518c4eca0ac713b9e0a7a4
TERMUX_PKG_BUILD_IN_SRC=yes

View File

@ -0,0 +1,17 @@
--- ../cache/libbsd-0.9.1/include/bsd/sys/endian.h 2017-06-06 02:21:05.000000000 +0000
+++ ./include/bsd/sys/endian.h 2018-10-16 02:59:14.582440259 +0000
@@ -25,12 +25,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
+#if !defined(__ANDROID__)
#ifdef LIBBSD_OVERLAY
#include_next <endian.h>
#else
#include <endian.h>
#endif
+#endif
#ifndef LIBBSD_SYS_ENDIAN_H
#define LIBBSD_SYS_ENDIAN_H

View File

@ -0,0 +1,15 @@
--- ../cache/libbsd-0.9.1/src/fpurge.c 2017-06-06 02:06:45.000000000 +0000
+++ ./src/fpurge.c 2018-10-16 02:56:49.159805187 +0000
@@ -41,6 +41,12 @@
return 0;
}
+#elif defined(__BIONIC__)
+void
+__fpurge(FILE *fp) {
+ fpurge(fp);
+ return ;
+}
#else
#error "Function fpurge() needs to be ported."
#endif

View File

@ -0,0 +1,11 @@
--- ../cache/libbsd-0.9.1/src/funopen.c 2018-04-21 21:30:22.000000000 +0000
+++ ./src/funopen.c 2018-10-16 02:22:46.623852072 +0000
@@ -137,7 +137,7 @@
return fopencookie(cookiewrap, mode, funcswrap);
}
-#elif defined(__MUSL__)
+#elif defined(__MUSL__) || defined(__BIONIC__)
/*
* This is unimplementable on musl based systems, and upstream has stated
* they will not add the needed support to implement it. Just ignore this

View File

@ -0,0 +1,24 @@
--- ../cache/libbsd-0.9.1/src/local-elf.h 2018-04-21 21:30:22.000000000 +0000
+++ ./src/local-elf.h 2018-10-16 03:40:41.756419536 +0000
@@ -240,8 +240,10 @@
#endif
#if ELF_TARG_CLASS == ELFCLASS32
+#if !defined(__ANDROID__)
#define ELF_ST_BIND ELF32_ST_BIND
#define ELF_ST_TYPE ELF32_ST_TYPE
+#endif
#define Elf_Word Elf32_Word
#define Elf_Sword Elf32_Sword
#define Elf_Sym Elf32_Sym
@@ -249,8 +251,10 @@
#define Elf_Shdr Elf32_Shdr
#define Elf_Ehdr Elf32_Ehdr
#elif ELF_TARG_CLASS == ELFCLASS64
+#if !defined(__ANDROID__)
#define ELF_ST_BIND ELF64_ST_BIND
#define ELF_ST_TYPE ELF64_ST_TYPE
+#endif
#define Elf_Word Elf64_Word
#define Elf_Sword Elf64_Sword
#define Elf_Sym Elf64_Sym

View File

@ -0,0 +1,15 @@
--- ../cache/libbsd-0.9.1/src/nlist.c 2018-05-14 22:54:12.000000000 +0000
+++ ./src/nlist.c 2018-10-16 03:17:23.141271836 +0000
@@ -39,8 +39,11 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#if !defined(__ANDROID__)
#include <nlist.h>
-
+#else
+#include "../include/bsd/nlist.h"
+#endif
#include "local-elf.h"
#define SIZE_T_MAX 0xffffffffU

View File

@ -0,0 +1,20 @@
--- ../cache/libbsd-0.9.1/src/vis.c 2018-05-22 14:07:42.000000000 +0000
+++ ./src/vis.c 2018-10-16 03:14:02.997723611 +0000
@@ -305,7 +305,7 @@
/* See comment in istrsenvisx() output loop, below. */
wmsk = 0;
for (i = sizeof(wmsk) - 1; i >= 0; i--) {
- shft = i * NBBY;
+ shft = i * CHAR_BIT;
bmsk = (uint64_t)0xffLL << shft;
wmsk |= bmsk;
if ((c & wmsk) || i == 0)
@@ -536,7 +536,7 @@
clen = 0;
wmsk = 0;
for (i = sizeof(wmsk) - 1; i >= 0; i--) {
- shft = i * NBBY;
+ shft = i * CHAR_BIT;
bmsk = (uint64_t)0xffLL << shft;
wmsk |= bmsk;
if ((*dst & wmsk) || i == 0)

13
packages/mg/build.sh Normal file
View File

@ -0,0 +1,13 @@
TERMUX_PKG_HOMEPAGE=https://github.com/hboetes/mg
TERMUX_PKG_DESCRIPTION="microscopic GNU Emacs-style editor"
TERMUX_PKG_VERSION=20180927
TERMUX_PKG_SRCURL=https://github.com/hboetes/mg/archive/$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=fbb09729ea00fe42dcdbc96ac7fc1d2b89eac651dec49e4e7af52fad4f5788f6
TERMUX_PKG_DEPENDS="libbsd, ncurses"
TERMUX_PKG_BUILD_IN_SRC=yes
termux_step_pre_configure() {
CFLAGS+=" $CPPFLAGS"
}
termux_step_make_install() {
make prefix=$PREFIX install
}