Skip to content

Commit

Permalink
new pkgs to gpkg
Browse files Browse the repository at this point in the history
gpkg/libsqlite
gpkg/tcl
  • Loading branch information
Maxython committed Sep 13, 2023
1 parent b3a0428 commit 48be24c
Show file tree
Hide file tree
Showing 7 changed files with 193 additions and 0 deletions.
52 changes: 52 additions & 0 deletions gpkg/libsqlite/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
TERMUX_PKG_HOMEPAGE=https://www.sqlite.org
TERMUX_PKG_DESCRIPTION="A C library that implements an SQL database engine"
TERMUX_PKG_LICENSE="Public Domain"
TERMUX_PKG_MAINTAINER="@termux-pacman"
_SQLITE_SRCVER=3430100
_SQLITE_YEAR=2023
TERMUX_PKG_VERSION=3.43.1
TERMUX_PKG_SRCURL=https://www.sqlite.org/${_SQLITE_YEAR}/sqlite-src-${_SQLITE_SRCVER}.zip
TERMUX_PKG_SHA256=22e9c2ef49fe6f8a2dbc93c4d3dce09c6d6a4f563de52b0a8171ad49a8c72917
TERMUX_PKG_DEPENDS="zlib-glibc"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--disable-static
--enable-fts3
--enable-fts4
--enable-fts5
--enable-rtree
TCLLIBDIR=$TERMUX_PREFIX/lib/sqlite$TERMUX_PKG_VERSION
"

termux_step_pre_configure() {
export CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
export CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
export CPPFLAGS="$CPPFLAGS \
-DSQLITE_ENABLE_COLUMN_METADATA=1 \
-DSQLITE_ENABLE_UNLOCK_NOTIFY \
-DSQLITE_ENABLE_DBSTAT_VTAB=1 \
-DSQLITE_ENABLE_FTS3_TOKENIZER=1 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_SECURE_DELETE \
-DSQLITE_ENABLE_STMTVTAB \
-DSQLITE_MAX_VARIABLE_NUMBER=250000 \
-DSQLITE_MAX_EXPR_DEPTH=10000 \
-DSQLITE_ENABLE_MATH_FUNCTIONS"
}

termux_step_make() {
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make
make showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer
}

termux_step_post_make_install() {
install -m755 showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer lemon $TERMUX_PREFIX/bin/

install -m755 -d $TERMUX_PREFIX/share/man/man1
install -m644 $TERMUX_PKG_SRCDIR/sqlite3.1 $TERMUX_PREFIX/share/man/man1/

install -m755 -d $TERMUX_PREFIX/share/man/mann
install -m644 $TERMUX_PKG_SRCDIR/autoconf/tea/doc/sqlite3.n $TERMUX_PREFIX/share/man/mann/

install -Dm644 lempar.c $TERMUX_PREFIX/share/lemon/lempar.c
}
4 changes: 4 additions & 0 deletions gpkg/libsqlite/lemon.subpackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TERMUX_SUBPKG_INCLUDE="glibc/bin/lemon glibc/share/lemon/lempar.c glibc/share/man/mann/"
TERMUX_SUBPKG_DESCRIPTION="A parser generator"
TERMUX_SUBPKG_DEPEND_ON_PARENT="no"
TERMUX_SUBPKG_DEPENDS="glibc, gcc-glibc-libs-dev"
65 changes: 65 additions & 0 deletions gpkg/libsqlite/setdirs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
diff --git a/ext/lsm1/lsm-test/lsmtest_main.c b/ext/lsm1/lsm-test/lsmtest_main.c
index f4a3ac0..04d7447 100644
--- a/ext/lsm1/lsm-test/lsmtest_main.c
+++ b/ext/lsm1/lsm-test/lsmtest_main.c
@@ -695,7 +695,7 @@ int do_speed_test2(int nArg, char **azArg){
}

#if 0
- pLog = fopen("/tmp/speed.log", "w");
+ pLog = fopen("@TERMUX_PREFIX_CLASSICAL@/tmp/speed.log", "w");
tdb_lsm_write_hook(pDb, do_speed_write_hook2, (void *)pLog);
#endif

@@ -895,7 +895,7 @@ int do_speed_tests(int nArg, char **azArg){

pLsm = configure_lsm_db(pDb);
#if 0
- pLog = fopen("/tmp/speed.log", "w");
+ pLog = fopen("@TERMUX_PREFIX_CLASSICAL@/tmp/speed.log", "w");
tdb_lsm_write_hook(pDb, do_speed_write_hook2, (void *)pLog);
#endif

diff --git a/src/os_unix.c b/src/os_unix.c
index 59f67d1..04aa8ab 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5851,9 +5851,7 @@ static int fillInUnixFile(
static const char *azTempDirs[] = {
0,
0,
- "/var/tmp",
- "/usr/tmp",
- "/tmp",
+ "@TERMUX_PREFIX_CLASSICAL@/tmp",
"."
};

diff --git a/src/os_win.c b/src/os_win.c
index dc16c08..90b1688 100644
--- a/src/os_win.c
+++ b/src/os_win.c
@@ -4799,9 +4799,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
0, /* getenv("TMP") */
0, /* getenv("TEMP") */
0, /* getenv("USERPROFILE") */
- "/var/tmp",
- "/usr/tmp",
- "/tmp",
+ "@TERMUX_PREFIX_CLASSICAL@/tmp",
".",
0 /* List terminator */
};
diff --git a/tool/lemon.c b/tool/lemon.c
index 7804837..63f8e78 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -3551,7 +3551,7 @@ PRIVATE char *pathsearch(char *argv0, char *name, int modemask)
*cp = c;
}else{
pathlist = getenv("PATH");
- if( pathlist==0 ) pathlist = ".:/bin:/usr/bin";
+ if( pathlist==0 ) pathlist = ".:@TERMUX_PREFIX@/bin";
pathbuf = (char *) malloc( lemonStrlen(pathlist) + 1 );
path = (char *)malloc( lemonStrlen(pathlist)+lemonStrlen(name)+2 );
if( (pathbuf != 0) && (path!=0) ){
4 changes: 4 additions & 0 deletions gpkg/libsqlite/sqlite-analyzer.subpackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TERMUX_SUBPKG_INCLUDE="glibc/bin/sqlite3_analyzer"
TERMUX_SUBPKG_DESCRIPTION="An analysis program for sqlite3 database files"
TERMUX_SUBPKG_DEPEND_ON_PARENT=deps
TERMUX_SUBPKG_DEPENDS="tcl-glibc"
4 changes: 4 additions & 0 deletions gpkg/libsqlite/sqlite-tcl.subpackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TERMUX_SUBPKG_INCLUDE="glibc/lib/sqlite*"
TERMUX_SUBPKG_DESCRIPTION="Sqlite Tcl Extension Architecture (TEA)"
TERMUX_SUBPKG_DEPEND_ON_PARENT=deps
TERMUX_SUBPKG_DEPENDS="tcl-glibc"
12 changes: 12 additions & 0 deletions gpkg/libsqlite/sqlite.subpackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
TERMUX_SUBPKG_INCLUDE="
glibc/bin/showdb
glibc/bin/showjournal
glibc/bin/showstat4
glibc/bin/showwal
glibc/bin/sqldiff
glibc/bin/sqlite3
glibc/share/man/man1/
"
TERMUX_SUBPKG_DESCRIPTION="Command line shell for SQLite"
TERMUX_SUBPKG_DEPEND_ON_PARENT=deps
TERMUX_SUBPKG_DEPENDS="readline-glibc"
52 changes: 52 additions & 0 deletions gpkg/tcl/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
TERMUX_PKG_HOMEPAGE=https://www.tcl.tk/
TERMUX_PKG_DESCRIPTION="Powerful but easy to learn dynamic programming language"
TERMUX_PKG_LICENSE="custom"
TERMUX_PKG_LICENSE_FILE="../license.terms"
TERMUX_PKG_MAINTAINER="@termux-pacman"
TERMUX_PKG_VERSION=8.6.13
TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/project/tcl/Tcl/${TERMUX_PKG_VERSION}/tcl${TERMUX_PKG_VERSION}-src.tar.gz
TERMUX_PKG_SHA256=43a1fae7412f61ff11de2cfd05d28cfc3a73762f354a417c62370a54e2caf066
TERMUX_PKG_DEPENDS="zlib-glibc, gcc-glibc-libs-dev"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_NO_STATICSPLIT=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--mandir=$TERMUX_PREFIX/share/man
--enable-man-symlinks
--enable-threads
--enable-64bit
"

termux_step_pre_configure() {
rm -rf $TERMUX_PKG_SRCDIR/pkgs/sqlite3* # libsqlite-tcl is a separate package
TERMUX_PKG_SRCDIR=$TERMUX_PKG_SRCDIR/unix
}

termux_step_post_make_install() {
# expect needs private headers
make install-private-headers

ln -sf tclsh${TERMUX_PKG_VERSION%.*} $TERMUX_PREFIX/bin/tclsh
ln -sf libtcl${TERMUX_PKG_VERSION%.*}.so $TERMUX_PREFIX/lib/libtcl.so
install -Dm644 $TERMUX_PKG_SRCDIR/tcl.m4 -t $TERMUX_PREFIX/share/aclocal
chmod 644 $TERMUX_PREFIX/lib/libtclstub8.6.a

# remove buildroot traces
local _tclver=8.6
sed -e "s#$TERMUX_PKG_BUILDDIR#$TERMUX_PREFIX/lib#" \
-e "s#$TERMUX_PKG_BUILDDIR#$TERMUX_PREFIX/include#" \
-e "s#'{$TERMUX_PREFIX/lib} '#'$TERMUX_PREFIX/lib/tcl$_tclver'#" \
-i $TERMUX_PREFIX/lib/tclConfig.sh

local tdbcver=tdbc1.1.5
sed -e "s#$TERMUX_PKG_BUILDDIR/pkgs/$tdbcver#$TERMUX_PREFIX/lib/$tdbcver#" \
-e "s#$TERMUX_PKG_BUILDDIR/pkgs/$tdbcver/generic#$TERMUX_PREFIX/include#" \
-e "s#$TERMUX_PKG_BUILDDIR/pkgs/$tdbcver/library#$TERMUX_PREFIX/lib/tcl${TERMUX_PKG_VERSION%.*}#" \
-e "s#$TERMUX_PKG_BUILDDIR/pkgs/$tdbcver#$TERMUX_PREFIX/include#" \
-i $TERMUX_PREFIX/lib/$tdbcver/tdbcConfig.sh

local itclver=itcl4.2.3
sed -e "s#$TERMUX_PKG_BUILDDIR/pkgs/$itclver#$TERMUX_PREFIX/lib/$itclver#" \
-e "s#$TERMUX_PKG_BUILDDIR/pkgs/$itclver/generic#$TERMUX_PREFIX/include#" \
-e "s#$TERMUX_PKG_BUILDDIR/pkgs/$itclver#$TERMUX_PREFIX/include#" \
-i $TERMUX_PREFIX/lib/$itclver/itclConfig.sh
}

0 comments on commit 48be24c

Please sign in to comment.