new package: libjansi

This commit is contained in:
Tee KOBAYASHI 2022-01-05 01:59:10 +09:00 committed by Leonid Pliushch
parent 0686a0b769
commit 3adddff5f8
3 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,14 @@
all: libjansi.so
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
libjansi.so: jansi.o jansi_isatty.o jansi_structs.o jansi_ttyname.o
$(CC) $^ -shared -o $@ $(LDFLAGS) $(LIBS)
install: libjansi.so
install -Dm700 -t $(PREFIX)/lib $^
clean:
$(RM) *.o *.so

View File

@ -0,0 +1,15 @@
TERMUX_PKG_HOMEPAGE=https://fusesource.github.io/jansi/
TERMUX_PKG_DESCRIPTION="A small java library that allows you to use ANSI escape codes to format your console output"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=2.4.0
TERMUX_PKG_SRCURL=https://github.com/fusesource/jansi.git
TERMUX_PKG_GIT_BRANCH=jansi-${TERMUX_PKG_VERSION}
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_MAKE_ARGS="-C src/main/native PREFIX=$TERMUX_PREFIX"
termux_step_pre_configure() {
cp $TERMUX_PKG_BUILDER_DIR/Makefile $TERMUX_PKG_SRCDIR/src/main/native/
CFLAGS+=" -fPIC"
}

View File

@ -0,0 +1,43 @@
--- a/src/main/native/jansi_structs.c
+++ b/src/main/native/jansi_structs.c
@@ -34,8 +34,10 @@ void cacheTermiosFields(JNIEnv *env, job
TermiosFc.c_cflag = (*env)->GetFieldID(env, TermiosFc.clazz, "c_cflag", "J");
TermiosFc.c_lflag = (*env)->GetFieldID(env, TermiosFc.clazz, "c_lflag", "J");
TermiosFc.c_cc = (*env)->GetFieldID(env, TermiosFc.clazz, "c_cc", "[B");
+#ifndef __ANDROID__
TermiosFc.c_ispeed = (*env)->GetFieldID(env, TermiosFc.clazz, "c_ispeed", "J");
TermiosFc.c_ospeed = (*env)->GetFieldID(env, TermiosFc.clazz, "c_ospeed", "J");
+#endif
hawtjni_w_barrier();
TermiosFc.cached = 1;
}
@@ -61,12 +63,14 @@ struct termios *getTermiosFields(JNIEnv
(*env)->GetByteArrayRegion(env, lpObject1, 0, sizeof(lpStruct->c_cc), (jbyte *)lpStruct->c_cc);
}
#endif
+#ifndef __ANDROID__
#if defined(HAVE_IOCTL)
lpStruct->c_ispeed = (*env)->GetLongField(env, lpObject, TermiosFc.c_ispeed);
#endif
#if defined(HAVE_IOCTL)
lpStruct->c_ospeed = (*env)->GetLongField(env, lpObject, TermiosFc.c_ospeed);
#endif
+#endif
return lpStruct;
}
@@ -91,12 +95,14 @@ void setTermiosFields(JNIEnv *env, jobje
(*env)->SetByteArrayRegion(env, lpObject1, 0, sizeof(lpStruct->c_cc), (jbyte *)lpStruct->c_cc);
}
#endif
+#ifndef __ANDROID__
#if defined(HAVE_IOCTL)
(*env)->SetLongField(env, lpObject, TermiosFc.c_ispeed, (jlong)lpStruct->c_ispeed);
#endif
#if defined(HAVE_IOCTL)
(*env)->SetLongField(env, lpObject, TermiosFc.c_ospeed, (jlong)lpStruct->c_ospeed);
#endif
+#endif
}
#endif