new package: lsof + libtirpc as dependency

This commit is contained in:
Leonid Pliushch 2020-06-07 03:32:48 +03:00
parent f7177b9638
commit 72811d08d2
10 changed files with 275 additions and 0 deletions

View File

@ -0,0 +1,7 @@
TERMUX_PKG_HOMEPAGE="http://git.linux-nfs.org/?p=steved/libtirpc.git"
TERMUX_PKG_DESCRIPTION="Transport Independent RPC library"
TERMUX_PKG_LICENSE="BSD"
TERMUX_PKG_VERSION=1.2.6
TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/sourceforge/libtirpc/libtirpc-${TERMUX_PKG_VERSION}.tar.bz2
TERMUX_PKG_SHA256=4278e9a5181d5af9cd7885322fdecebc444f9a3da87c526e7d47f7a12a37d1cc
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-gssapi"

View File

@ -0,0 +1,12 @@
diff -uNr libtirpc-1.2.6/src/rpc_dtablesize.c libtirpc-1.2.6.mod/src/rpc_dtablesize.c
--- libtirpc-1.2.6/src/rpc_dtablesize.c 2020-04-07 16:24:34.000000000 +0300
+++ libtirpc-1.2.6.mod/src/rpc_dtablesize.c 2020-06-07 03:04:05.440005050 +0300
@@ -41,7 +41,7 @@
static int size;
if (size == 0) {
- size = getdtablesize();
+ size = sysconf(_SC_OPEN_MAX);
}
return (size);
}

View File

@ -0,0 +1,33 @@
diff -uNr libtirpc-1.2.6/src/svc.c libtirpc-1.2.6.mod/src/svc.c
--- libtirpc-1.2.6/src/svc.c 2020-04-07 16:24:34.000000000 +0300
+++ libtirpc-1.2.6.mod/src/svc.c 2020-06-07 03:10:30.231611990 +0300
@@ -630,6 +630,29 @@
svc_getreqset (&readfds);
}
+#ifdef __ANDROID__
+static int ffsl(int i)
+{
+ static const unsigned char table[] =
+ {
+ 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
+ };
+ unsigned int a;
+ unsigned int x = i & -i;
+
+ a = x <= 0xffff ? (x <= 0xff ? 0 : 8) : (x <= 0xffffff ? 16 : 24);
+
+ return table[x >> a] + a;
+}
+#endif
+
void
svc_getreqset (readfds)
fd_set *readfds;

View File

@ -0,0 +1,14 @@
diff -uNr libtirpc-1.2.6/src/rpcdname.c libtirpc-1.2.6.mod/src/rpcdname.c
--- libtirpc-1.2.6/src/rpcdname.c 2020-04-07 16:24:34.000000000 +0300
+++ libtirpc-1.2.6.mod/src/rpcdname.c 2020-06-07 03:06:34.961407640 +0300
@@ -44,8 +44,10 @@
if (default_domain)
return (default_domain);
+#ifndef __ANDROID__
if (getdomainname(temp, sizeof(temp)) < 0)
return (0);
+#endif
if ((int) strlen(temp) > 0) {
default_domain = (char *)malloc((strlen(temp)+(unsigned)1));
if (default_domain == 0)

View File

@ -0,0 +1,21 @@
diff -uNr libtirpc-1.2.6/libtirpc.pc.in libtirpc-1.2.6.mod/libtirpc.pc.in
--- libtirpc-1.2.6/libtirpc.pc.in 2020-04-07 16:24:34.000000000 +0300
+++ libtirpc-1.2.6.mod/libtirpc.pc.in 2020-06-07 03:05:00.752524088 +0300
@@ -8,5 +8,4 @@
Requires:
Version: @PACKAGE_VERSION@
Libs: -L@libdir@ -ltirpc
-Libs.private: -lpthread
Cflags: -I@includedir@/tirpc
diff -uNr libtirpc-1.2.6/src/Makefile.am libtirpc-1.2.6.mod/src/Makefile.am
--- libtirpc-1.2.6/src/Makefile.am 2020-04-07 16:24:34.000000000 +0300
+++ libtirpc-1.2.6.mod/src/Makefile.am 2020-06-07 03:05:13.632644922 +0300
@@ -12,7 +12,7 @@
lib_LTLIBRARIES = libtirpc.la
-libtirpc_la_LDFLAGS = @LDFLAG_NOUNDEFINED@ -no-undefined -lpthread
+libtirpc_la_LDFLAGS = @LDFLAG_NOUNDEFINED@ -no-undefined
libtirpc_la_LDFLAGS += -version-info @LT_VERSION_INFO@
libtirpc_la_SOURCES = auth_none.c auth_unix.c authunix_prot.c \

View File

@ -0,0 +1,44 @@
diff -uNr libtirpc-1.2.6/src/xdr.c libtirpc-1.2.6.mod/src/xdr.c
--- libtirpc-1.2.6/src/xdr.c 2020-04-07 16:24:34.000000000 +0300
+++ libtirpc-1.2.6.mod/src/xdr.c 2020-06-07 03:00:29.561976680 +0300
@@ -47,8 +47,8 @@
#include <rpc/xdr.h>
#include <rpc/rpc_com.h>
-typedef quad_t longlong_t; /* ANSI long long type */
-typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */
+typedef int64_t longlong_t; /* ANSI long long type */
+typedef uint64_t u_longlong_t; /* ANSI unsigned long long type */
/*
* constants specific to the xdr "protocol"
diff -uNr libtirpc-1.2.6/tirpc/rpc/types.h libtirpc-1.2.6.mod/tirpc/rpc/types.h
--- libtirpc-1.2.6/tirpc/rpc/types.h 2020-04-07 16:24:34.000000000 +0300
+++ libtirpc-1.2.6.mod/tirpc/rpc/types.h 2020-06-07 03:02:32.399131413 +0300
@@ -76,8 +76,6 @@
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
-typedef __quad_t quad_t;
-typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;
# define __u_char_defined
#endif
diff -uNr libtirpc-1.2.6/tirpc/rpc/xdr.h libtirpc-1.2.6.mod/tirpc/rpc/xdr.h
--- libtirpc-1.2.6/tirpc/rpc/xdr.h 2020-04-07 16:24:34.000000000 +0300
+++ libtirpc-1.2.6.mod/tirpc/rpc/xdr.h 2020-06-07 03:01:52.134753083 +0300
@@ -323,10 +323,10 @@
extern bool_t xdr_pointer(XDR *, char **, u_int, xdrproc_t);
extern bool_t xdr_wrapstring(XDR *, char **);
extern void xdr_free(xdrproc_t, void *);
-extern bool_t xdr_hyper(XDR *, quad_t *);
-extern bool_t xdr_u_hyper(XDR *, u_quad_t *);
-extern bool_t xdr_longlong_t(XDR *, quad_t *);
-extern bool_t xdr_u_longlong_t(XDR *, u_quad_t *);
+extern bool_t xdr_hyper(XDR *, int64_t *);
+extern bool_t xdr_u_hyper(XDR *, uint64_t *);
+extern bool_t xdr_longlong_t(XDR *, int64_t *);
+extern bool_t xdr_u_longlong_t(XDR *, uint64_t *);
extern u_long xdr_sizeof(xdrproc_t, void *);
#ifdef __cplusplus
}

View File

@ -0,0 +1,80 @@
diff -uNr lsof-4.93.2/Configure lsof-4.93.2.mod/Configure
--- lsof-4.93.2/Configure 2019-05-08 10:32:25.000000000 +0300
+++ lsof-4.93.2.mod/Configure 2020-06-07 03:20:36.117487707 +0300
@@ -2976,27 +2976,6 @@
fi #}
fi # }
- # Test for SELinux support.
-
- LSOF_TMP1=0
- if test "X$LINUX_HASSELINUX" = "X" # {
- then
- if test -r ${LSOF_INCLUDE}/selinux/selinux.h # {
- then
- LSOF_TMP1=1
- fi # }
- else
- if test "X$LINUX_HASSELINUX" = "XY" -o "X$LINUX_HASSELINUX" = "Xy" # {
- then
- LSOF_TMP1=1
- fi # }
- fi # }
- if test $LSOF_TMP1 -eq 1 # {
- then
- LSOF_CFGF="$LSOF_CFGF -DHASSELINUX"
- LSOF_CFGL="$LSOF_CFGL -lselinux"
- fi # }
-
# Test for UNIX socket endpoint support.
if test -r ${LSOF_INCLUDE}/linux/sock_diag.h -a -r ${LSOF_INCLUDE}/linux/unix_diag.h # {
@@ -5617,7 +5596,7 @@
if test "X$LSOF_LIB_NO" = "X" # {
then
echo "" >> $LSOF_MKFC
- echo "CFGL= $LSOF_FCFGL -L./$LSOF_LIB -llsof $LSOF_CFGL" >> $LSOF_MKFC
+ echo "CFGL= $LSOF_FCFGL -Wl,-rpath=@TERMUX_PREFIX@/lib,--enable-new-dtags -L./$LSOF_LIB -llsof -L@TERMUX_PREFIX@/lib -ltirpc -landroid-support $LSOF_CFGL" >> $LSOF_MKFC
fi # }
echo "" >> $LSOF_MKFC
if test "X$LSOF_DEBUG" = "X" # {
diff -uNr lsof-4.93.2/OLD/Configure lsof-4.93.2.mod/OLD/Configure
--- lsof-4.93.2/OLD/Configure 2019-05-08 10:32:25.000000000 +0300
+++ lsof-4.93.2.mod/OLD/Configure 2020-06-07 03:20:49.621626530 +0300
@@ -2961,27 +2961,6 @@
fi #}
fi # }
- # Test for SELinux support.
-
- LSOF_TMP1=0
- if test "X$LINUX_HASSELINUX" = "X" # {
- then
- if test -r ${LSOF_INCLUDE}/selinux/selinux.h # {
- then
- LSOF_TMP1=1
- fi # }
- else
- if test "X$LINUX_HASSELINUX" = "XY" -o "X$LINUX_HASSELINUX" = "Xy" # {
- then
- LSOF_TMP1=1
- fi # }
- fi # }
- if test $LSOF_TMP1 -eq 1 # {
- then
- LSOF_CFGF="$LSOF_CFGF -DHASSELINUX"
- LSOF_CFGL="$LSOF_CFGL -lselinux"
- fi # }
-
# Test for UNIX socket endpoint support.
if test -r ${LSOF_INCLUDE}/linux/sock_diag.h -a -r ${LSOF_INCLUDE}/linux/unix_diag.h # {
@@ -5591,7 +5570,7 @@
if test "X$LSOF_LIB_NO" = "X" # {
then
echo "" >> $LSOF_MKFC
- echo "CFGL= $LSOF_FCFGL -L./$LSOF_LIB -llsof $LSOF_CFGL" >> $LSOF_MKFC
+ echo "CFGL= $LSOF_FCFGL -Wl,-rpath=@TERMUX_PREFIX@/lib,--enable-new-dtags -L./$LSOF_LIB -llsof -L@TERMUX_PREFIX@/lib -ltirpc -landroid-support $LSOF_CFGL" >> $LSOF_MKFC
fi # }
echo "" >> $LSOF_MKFC
if test "X$LSOF_DEBUG" = "X" # {

25
packages/lsof/build.sh Normal file
View File

@ -0,0 +1,25 @@
TERMUX_PKG_HOMEPAGE=https://github.com/lsof-org/lsof
TERMUX_PKG_DESCRIPTION="Lists open files for running Unix processes"
TERMUX_PKG_LICENSE="custom"
TERMUX_PKG_VERSION=4.93.2
TERMUX_PKG_SRCURL=https://github.com/lsof-org/lsof/archive/${TERMUX_PKG_VERSION}/lsof-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=3df912bd966fc24dc73ddea3e36a61d79270b21b085936a4caabca56e5b486a2
TERMUX_PKG_DEPENDS="libandroid-support, libtirpc"
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_configure() {
./Configure -n linux
}
termux_step_make() {
make CC="$CC $CFLAGS $CPPFLAGS -I$TERMUX_PREFIX/include/tirpc"
}
termux_step_make_install() {
install -Dm700 -t $TERMUX_PREFIX/bin/ lsof
install -Dm600 Lsof.8 $TERMUX_PREFIX/share/man/man8/lsof.8
}
termux_step_install_license() {
install -Dm600 -t $TERMUX_PREFIX/share/doc/lsof $TERMUX_PKG_BUILDER_DIR/license.txt
}

27
packages/lsof/license.txt Normal file
View File

@ -0,0 +1,27 @@
Copyright 2002 Purdue Research Foundation, West Lafayette,
Indiana 47907. All rights reserved.
Written by Victor A. Abell
This software is not subject to any license of the American
Telephone and Telegraph Company or the Regents of the
University of California.
Permission is granted to anyone to use this software for
any purpose on any computer system, and to alter it and
redistribute it freely, subject to the following
restrictions:
1. Neither the authors nor Purdue University are responsible
for any consequences of the use of this software.
2. The origin of this software must not be misrepresented,
either by explicit claim or by omission. Credit to the
authors and Purdue University must appear in documentation
and sources.
3. Altered versions must be plainly marked as such, and must
not be misrepresented as being the original software.
4. This notice may not be removed or altered.

View File

@ -0,0 +1,12 @@
diff -uNr lsof-4.93.2/main.c lsof-4.93.2.mod/main.c
--- lsof-4.93.2/main.c 2019-05-08 10:32:25.000000000 +0300
+++ lsof-4.93.2.mod/main.c 2020-06-07 03:19:19.392693278 +0300
@@ -121,7 +121,7 @@
* Make sure umask allows lsof to define its own file permissions.
*/
- if ((MaxFd = (int) GET_MAX_FD()) < 53)
+ if ((MaxFd = (int) sysconf(_SC_OPEN_MAX)) < 53)
MaxFd = 53;
#if defined(HAS_CLOSEFROM)