From 4397da959f70ed83a90466d7d7951e83689e3bfd Mon Sep 17 00:00:00 2001 From: Leonid Plyushch Date: Thu, 7 May 2020 15:03:23 +0300 Subject: [PATCH] shc: fix tmpdir and compiler command --- packages/shc/build.sh | 2 +- packages/shc/src-shc.c.patch | 55 ++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 packages/shc/src-shc.c.patch diff --git a/packages/shc/build.sh b/packages/shc/build.sh index c0e146345..b20dacd28 100644 --- a/packages/shc/build.sh +++ b/packages/shc/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Shell script compiler" TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="Krishna Kanhaiya @kcubeterm" TERMUX_PKG_VERSION=4.0.3 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 TERMUX_PKG_SRCURL=https://github.com/neurobin/shc/archive/${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=7d7fa6a9f5f53d607ab851d739ae3d3b99ca86e2cb1425a6cab9299f673aee16 TERMUX_PKG_DEPENDS="clang" diff --git a/packages/shc/src-shc.c.patch b/packages/shc/src-shc.c.patch new file mode 100644 index 000000000..b391053f5 --- /dev/null +++ b/packages/shc/src-shc.c.patch @@ -0,0 +1,55 @@ +diff -uNr shc-4.0.3/src/shc.c shc-4.0.3.mod/src/shc.c +--- shc-4.0.3/src/shc.c 2019-07-01 19:37:08.000000000 +0300 ++++ shc-4.0.3.mod/src/shc.c 2020-05-07 15:01:57.944329115 +0300 +@@ -153,7 +153,7 @@ + "\" * Copyright 2019 - Intika \",", + "\" * Replace ******** with secret read from fd 21\",", + "\" * Also change arguments location of sub commands (sh script commands)\",", +-"\" * gcc -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",", ++"\" * clang -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",", + "\" */\",", + "\"\",", + "\"#define _GNU_SOURCE /* needed to get RTLD_NEXT defined in dlfcn.h */\",", +@@ -365,7 +365,7 @@ + " FILE *fp;", + " int line = 0;", + "", +-" if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}", ++" if ((fp = fopen(\"@TERMUX_PREFIX@/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}", + " for (line = 0; shc_x[line]; line++) fprintf(fp, \"%s\\n\", shc_x[line]);", + " fflush(fp);fclose(fp);", + "}", +@@ -375,11 +375,11 @@ + " char cmd[4096];", + "", + " cc = getenv(\"CC\");", +-" if (!cc) cc = \"cc\";", ++" if (!cc) cc = \"clang\";", + "", +-" sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");", +-" if (system(cmd)) {remove(\"/tmp/shc_x.c\"); return -1;}", +-" remove(\"/tmp/shc_x.c\"); return 0;", ++" sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"@TERMUX_PREFIX@/tmp/shc_x.so\", \"@TERMUX_PREFIX@/tmp/shc_x.c -ldl\");", ++" if (system(cmd)) {remove(\"@TERMUX_PREFIX@/tmp/shc_x.c\"); return -1;}", ++" remove(\"@TERMUX_PREFIX@/tmp/shc_x.c\"); return 0;", + "}", + "", + "void arc4_hardrun(void * str, int len) {", +@@ -396,7 +396,7 @@ + " shc_x_file();", + " if (make()) {exit(1);}", + "", +-" setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);", ++" setenv(\"LD_PRELOAD\",\"@TERMUX_PREFIX@/tmp/shc_x.so\",1);", + "", + " if(pid==0) {", + "", +@@ -429,7 +429,7 @@ + " memcpy(tmp2, str, lentmp);", + "", + " //Clean temp", +-" remove(\"/tmp/shc_x.so\");", ++" remove(\"@TERMUX_PREFIX@/tmp/shc_x.so\");", + "", + " //Sinal to detach ptrace", + " ptrace(PTRACE_DETACH, 0, 0, 0);",