Skip to content

Consider using pacman and PKGBUILD ? #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
franciscod opened this issue Dec 21, 2015 · 28 comments
Closed

Consider using pacman and PKGBUILD ? #104

franciscod opened this issue Dec 21, 2015 · 28 comments
Labels
package request A new package was requested

Comments

@franciscod
Copy link
Contributor

There is a project similar to termux, that instead of targeting Android targets Windows.

Check its packages here: https://github.com/Alexpux/MSYS2-packages

MSYS2 uses the Arch Linux format for package building, and also uses its package manager: pacman.

Maybe pacman could serve useful to this project too :)

Any thoughts?

@franciscod
Copy link
Contributor Author

Also: PKGBUILD usually require md5 or sha1 checksums so they are a bit more secure!

This would be a great improvement :)

@jficz
Copy link

jficz commented Dec 22, 2015

Hashes aren't a "security" feature, yet I would also like to see pacman as the package manager, purely because I'm used to it :) It is simple, lightweight and secure and it's much easier for contributors to create new packages (the aforementioned PKGBUILDs) than for apt or its derivates (such as opkg). This alone could be a good reason to switch.

@fornwall
Copy link
Member

Apt starts by downloading a GPG-signed file InRelease file containing containing SHA-256 hashes for the Package files, which themselves contains hashes for listed package. So as long as the trusted GPG key ($PREFIX/etc/apt/trusted.gpg) used by apt to verify InRelease is not tampered with (which will be guaranteed once the bootstrap package is downloaded over https soon), both the integrity and security of packages are validated by apt as well!

With that said, I'm open to try out pacman (I've never used it myself)! An initial step would be in creating a pacman package in Termux, which would be a normal package that would (at least initially) live alongside apt to install packages itself. Once this is done it can be evaluated as a potential apt replacement for the main Termux repo!

@franciscod
Copy link
Contributor Author

That sounds great!

@jficz
Copy link

jficz commented Dec 23, 2015

Not making any promises but is there some kind of a "package dev/maintainer guideline"? Maybe (or maybe not) I'll have some time during holiday I can put into creating the package.

@fornwall
Copy link
Member

The README in this project is the best starting point available, as well as following what build-package.sh does.

Just ask here or create an issue if you run into any problem!

@franciscod
Copy link
Contributor Author

I'm trying to build pacman on this branch: https://github.com/franciscod/termux-packages/tree/pacman

Currently getting this:

../../lib/libalpm/.libs/libalpm.so: error: undefined reference to '__android_log_vprint'
../../lib/libalpm/.libs/libalpm.so: error: undefined reference to '__android_log_print'

Any ideas? @fornwall

@fornwall
Copy link
Member

@franciscod Yes, it's due to Termux patching <syslog.h> to redirect syslog calls (which doesn't do anything on Android) to the system logging system (as used by logcat). However, this requires that the system library liblog.so is linked in.

A fix could be either:

  1. Remove the syslog calls if it's not very important or used (by patching or using configure), or
  2. Add -llog when linking so that liblog.so is linked in.

@franciscod
Copy link
Contributor Author

great! searched for liblog and found this, which i pasted into the build.sh and worked!

export LDFLAGS="$LDFLAGS -llog" # liblog for android logging in syslog hack

now it complains about glob.h:

ini.c:21:18: fatal error: glob.h: No such file or directory
 #include <glob.h>

I thought this would be solved by installing libandroid-glob, however:

ini.o:ini.c:function _parse_ini: error: undefined reference to 'glob'
ini.o:ini.c:function _parse_ini: error: undefined reference to 'globfree'
ini.o:ini.c:function _parse_ini: error: undefined reference to 'globfree'
pacman.o:pacman.c:function main: error: undefined reference to 'ctermid'

@fornwall
Copy link
Member

Great! The export LDFLAGS="$LDFLAGS -llog" is a bit of a hack, since it will cause everything to link against liblog, not only the binaries or libraries that need them (but that is not very important at this stage).

For the glob.h file: Normally this is provided by the system libc, but the android libc does not support it. However, in Termux you may build the libandroid-glob package, which installs include/glob.h and lib/libandroid-glob.so. So to fix the problem:

  1. Build the required package with ./build-package.sh libandroid-glob.
  2. Add libandroid-glob as a dependency for the new pacman package.
  3. Add -landroid-glob in the same way you added -llog.

@franciscod
Copy link
Contributor Author

awesome! I'm starting to get all these patterns... 💃

@franciscod
Copy link
Contributor Author

now it has errors on ctermid, I see it hardcoded to "/dev/tty" in many packages... (should this be abstracted into a library? maybe libtermux?)

@fornwall
Copy link
Member

Nice to see your quick progress :)!

For ctermid, I think patching <stdio.h> to define something like

static char* ctermid(char* s) {
    if (s == 0) return "/dev/tty";
    strcpy(s, "/dev/tty");
    return s;
}

should be enough (by adding it to the stdio.h patch). Then the patching in fish and perl could also be removed.

@franciscod
Copy link
Contributor Author

okay, that should be a different issue, right? i'll try to patch stdio :)

now pacman seems to build but i have certain nesting of TERMUX_PREFIX... when i fix this I'll try to compile a basic pkgbuild :D

@franciscod
Copy link
Contributor Author

okayyyyyy:

$ makepkg
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
/data/data/com.termux/files/usr/bin/makepkg: line 2483: /dev/fd/62: No such file or directory
==> Making package: p7zip 9.38.1-4 (Thu Dec 24 01:29:49 ART 2015)
==> Checking runtime dependencies...
bionic/libc/upstream-netbsd/lib/libc/regex/regfree.c:110: regfree: assertion "preg->re_magic == MAGIC1" failed
==> ERROR: 'pacman' returned a fatal error (134): 
$ 

no clue on how to continue :D

@fornwall
Copy link
Member

@franciscod Well that looks strange. You are welcome to submit what you have as disabled-packages/pacman, so that I and others can look and try it out more easily!

@franciscod
Copy link
Contributor Author

done. hope this helps!

@franciscod franciscod changed the title Consider using pacman and PKGBUILDs? Consider using pacman and PKGBUILD ? Dec 28, 2015
@4679
Copy link
Contributor

4679 commented Jan 16, 2016

When I try to build pacman,it says "configure:3850: error: C compiler cannot create executables"

This is a part of config.log.
https://pastebin.mozilla.org/8856829

@fornwall
Copy link
Member

@4679 The errors

ld: error: cannot find -landroid-glob
ld: error: cannot find -landroid-support

means that you have to build these requirements first:

apt install libandroid-support
apt install libandroid-glob

@4679
Copy link
Contributor

4679 commented Jan 17, 2016

@fornwall Thanks,I'll try.

@fornwall
Copy link
Member

fornwall commented Mar 7, 2016

@franciscod The /dev/fd/62: No such file or directory was probably due to process substitution (using <(...)) not working in bash under Termux. This has just been fixed in version 4.3.42-7 of the bash package which is available as an update. Can you try if makepkg works better now?

@franciscod
Copy link
Contributor Author

@fornwall I'll try it!

EDIT: docker is somehow broken on my machine and I can't figure out why yet...

@Neo-Oli Neo-Oli added the package request A new package was requested label Apr 23, 2016
@bricewge
Copy link

bricewge commented Jun 13, 2016

makepkg doesn't throw the /dev/fd/62 error anymore.

EDIT: But the second error is still present:

bionic/libc/upstream-netbsd/lib/libc/regex/regfree.c:110: regfree: assertion "preg->re_magic == MAGIC1" failed
==> ERROR: 'pacman' returned a fatal error (134):

@SDRausty

This comment was marked as spam.

@ghost
Copy link

ghost commented Mar 2, 2019

For now there no plans to change package manager. But we have apk-tools (package manager from Alpine Linux) packaged, though there no repository for it: https://github.com/termux/termux-packages/tree/master/packages/apk-tools.
Abuild is available too: https://github.com/termux/termux-packages/tree/master/packages/abuild. It is similar to ArchLinux's makepkg, even syntax for APKBUILDs is similar. That's if someone want to try apk package manager. But as I wrote above - package manager won't be changed until there will be significant reason to do so.

@ghost ghost closed this as completed Mar 2, 2019
jyn514 added a commit to jyn514/oil that referenced this issue Jul 11, 2019
This is required on Android where glob is not in the standard library.
See termux/termux-packages#104.
jyn514 added a commit to jyn514/oil that referenced this issue Jul 12, 2019
This is required on Android where glob is not in the standard library.
See termux/termux-packages#104.
andychu pushed a commit to oils-for-unix/oils that referenced this issue Jul 12, 2019
* Use TMPDIR, not TMP

TMPDIR is specified by POSIX, TMP is not mentioned anywhere that I can
find, see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html

On Android, /tmp actually doesn't exist, so this is necessary on some
systems.

* Add compatibility for non-GNU expr

Leading dashes in options confuses FreeBSD expr.

* Pass user-defined LDFLAGS in build/compile.sh

This is required on Android where glob is not in the standard library.
See termux/termux-packages#104.

* Comment compatibility changes
@Maxython
Copy link
Member

Maxython commented Jun 8, 2021

Hi @franciscod. I want to tell you that it is already possible to install (compile) pacman on termux. It is still in development and is not completely set up, but there are already some successes.

@danog
Copy link
Contributor

danog commented Jun 9, 2021

Personally, I'm all for switching to pacman in termux, for the following reasons:

  • Extreme simplicity of the PKGBUILD file
  • Extreme simplicity of the package itself, consisting of a single (!) tarfile (instead of an ar archive containing a versionfile, and two tarfiles compressed with gzip).
  • Pacman packages are usually compressed with the new zstandard compression, which offers insanely high decompression speeds: 1300% decompression speed compared to xz, with the same compression ratio as xz.
  • I also noticed that pacman itself is also insanely fast compared to apt (practically no waiting time for package database parsing).

I'd love to help out in a porting/migration to pacman, possibly a bit more into July as my exams ease up ;)

@Maxython
Copy link
Member

Maxython commented Jun 9, 2021

@danog will greatly appreciate your help.

@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package request A new package was requested
Projects
None yet
Development

No branches or pull requests

9 participants