Merge branch 'guide-xbps'

XBPS: Versión estable para plantilla vinculada estáticamente y versión
vinculada dinámicamente
This commit is contained in:
Tuxliban Torvalds 2022-01-15 18:21:29 -06:00
commit d6709dca4c
24 changed files with 939 additions and 41 deletions

157
Guías/XBPS-static.md Normal file
View File

@ -0,0 +1,157 @@
# **Guía para actualizar de versión al gestor de paquetes XBPS (versión estática)**
## Autores
### Telegram
* @tenshalito Tuxliban Torvalds
* @lumaro Luis
-----
## Introducción
A través del siguiente tutorial se mostrará cómo actualizar la versión de XBPS que está [incluída en Void Linux](https://github.com/void-linux/xbps) (v. 0.59.1) a la [versión 21.1](https://gitlab.com/xtraeme/xbps), distribuida y publicada recientemente por Juan Romero Pardines.
### ¿Qué es la vinculación estática?
En cualquier programa existe un enlace entre una llamada al método y la definición del método, pudiéndose realizar de forma estática o dinámica. En el enlace estático, el enlace se resuelve en el momento de la compilación, mientras que el enlace dinámico se resuelve en el tiempo de ejecución, siendo relativamente más lento. Por lo tanto, el enlace estático se traduce en un programa más rápido en comparación con el enlace dinámico y, al mismo tiempo, al contener las librerías necesarias para su funcionamiento, los ejecutables vinculados estáticamente son portátiles y a prueba de fallos frente a los cambios de ABI; por lo que se tiene la certeza de que el ejecutable seguirá funcionando en la misma arquitectura incluso con el paso de los años. Por último, los ejecutables vinculados estáticamente consumen menos memoria porque su tamaño binario es más pequeño y solo mapean las funciones de las que dependen en la memoria, caso contrario con las bibliotecas dinámicas.
### Interfaz binaria de aplicaciones (ABI)
ABI define las estructuras y los métodos que usará una aplicación compilada para acceder a la/s biblioteca/s externa/s a un nivel inferior al de una API. Una API define el orden en que pasan los argumentos a una función y qué funciones son parte de su biblioteca. La ABI define la mecánica de cómo se pasan estos argumentos (registros, pila, etc.) y cómo se almacena el código dentro del archivo de la biblioteca, de modo que cualquier programa que use la biblioteca pueda localizar la función deseada y ejecutarla. Si todo el sistema se ajusta a la misma ABI, entonces cualquier programa puede trabajar con cualquier archivo de biblioteca sin importar quién los creó. Cuando se produce un cambio de ABI, los programas que usan esa biblioteca no funcionarán a menos que se vuelvan a compilar para usar la nueva versión de la biblioteca.
### Musl libc
Antes de proceder con la construcción del paquete, cabe hacer una aclaración que la vinculación estática se hará tomando como base a la [libc Musl](https://www.musl-libc.org/faq.html) ya que esta libc evita con cuidado extraer grandes cantidades de código o datos que la aplicación no utilizará, por lo tanto, un código mínimo específico de la máquina significa menos posibilidades de rotura en arquitecturas minoritarias y un mayor éxito con el desarrollo en C "escribir una vez y ejecutarlo en todas partes".
Musl es una biblioteca estándar de C destinada a sistemas operativos Linux, desarrollada por Rich Felker con el objetivo de escribir una implementación libc limpia, eficiente y conforme a los estándares ISO C y POSIX, además de extensiones comunes, permitiendo un enlazado estático de bibliotecas eficaz y robusto.
## Modificación de plantilla
Como se mencionó anteriormente, para actualizar la versión del gestor de paquetes XBPS se usará la versión vinculada estáticamente. Para nuestro fin usaremos la plantilla distribuida por Void en la que realizaremos unos pequeños cambios que se mencionarán a continuación:
| **Versión original (github)** | **Versión actualizada** |
| :--- | :--- |
| version=0.59.1 | version=21.1 |
| revision=5 | revision=1 |
| homepage="https://github.com/void-linux/xbps" | homepage="https://gitlab.com/xtraeme/xbps/" |
| changelog="https://github.com/void-linux/xbps/blob/master/NEWS" | changelog="${homepage}-/blob/master/NEWS.md" |
| distfiles="https://github.com/void-linux/xbps/archive/${version}.tar.gz" | distfiles="${homepage}-/archive/${version}/xbps-${version}.tar.gz" |
| checksum=0cbd8d5f23a62047c75974bca21da9f004a94efffd7f37c68562a8dbc869fb2a | checksum=51a8ab75ece07bea64ea325e2c62314f9477bab06de297e8d3577f0fb4f48578 |
| vlicense LICENSE.3RDPARTY | vlicense 3RDPARTY |
Una vez modificada la plantilla guardar cambios y proceder con la construcción del paquete usando *xbps-src*
$ ./xbps-src pkg xbps-static
**Nota:** En caso de tener un sistema con la [libc Glibc](https://www.gnu.org/software/libc/), será necesario construir el paquete usando la compilación cruzada, para ello seguir con los siguiente pasos:
$ ./xbps-src -a x86_64 pkg xbps-static
Cuando el paquete termine de construirse proceder a instalarlo. Se recomienda ampliamente usar el método a través del comando *xi*
**Nota:** Si el comando *xi* no aparece en el PATH significa que no está instalado, de ser así instale el paquete `xtools`
$ xi xbps-static
Durante el proceso de desempaquetado aparece un mensaje indicando que la función `xbps-fbulk.static` es removida. Esto se debe a que para la nueva versión de XBPS en su lugar utiliza [go-xbulk](https://gitlab.com/xtraeme/go-xbulk) para la construcción en tiempo real de un árbol de dependencias.
Ahora para corroborar que ya se tiene en uso la versión más reciente basta con escribir lo siguiente en la terminal:
$ xbps-query.static -V
Al introducir lo anterior deberá devolver lo siguiente:
XBPS: 21.1 API: 20211203 GIT: UNSET https://gitlab.com/xtraeme/xbps
Hasta este punto, en arquitecturas **x86_64** XBPS ya es funcional, sin embargo, para la arquitectura de **x86_64-musl** existe un pequeño problema al querer sincronizar los repositorios que consiste en que el sistema muestra un error con la verificación del certificado de seguridad y otro más que no detecta correctamante la arquitectura del sistema:
1. Error de verificación de certificado de seguridad:
```
# xbps-install -S
[*] Updating repository 'https://repo-us.voidlinux.org/current/musl/x86_64-repodata' ...
Certificate verification failed for /C=US/O=Internet Security Research Group/CN=ISRG Root X1
SSL_connect returned 1
ERROR: [reposync] failed to fetch file 'https://repo-us.voidlinux.org/current/musl/x86_64-repodata': Operation not permitted
```
2. Error de detección incorrecta de architectura (debería de ser *x86_64-musl*)
```
# xbps-install -Sd
[DEBUG] Architecture: x86_64
```
Para poder solucionar los dos problemas previamente mencionados realizar lo siguiente:
1. Para el problema de verificación de certificado se añadirá una variable de entorno en el archivo de perfil de inicio de sesión `.profile`:
```
$ echo "SSL_CA_CERT_FILE=/etc/ssl/certs.pem" >> "$HOME"/.profile
```
2. Para el problema de la detección correcta de arquitectura también se añadirá otra variable de entorno al perfil de inicio de sesión `.profile`:
```
$ echo "XBPS_ARCH=x86_64-musl" >> "$HOME"/.profile
```
**Nota:** Si utilizan la versión libc de *Glibc* entonces la variable de entorno debe quedar como `XBPS_ARCH=x86_64`
**Nota2:** Es posible que aún con estas modificaciones persista el error, eso puede ser debido, en el caso de utilizar *doas* para el escalado de privilegios de usuario y no mantener las variables de entorno definidas en el `.profile` del shell de usuario. Para ello, podemos establecer la siguiente configuración en en fichero `/etc/doas.conf`
```
permit nopass keepenv :wheel
```
3. Si tienen instalada la versión de XBPS vinculada dinámicamente pueden eliminarla; si tenían la versión de XBPS vinculada estáticamente pueden omitir este paso.
```
# xbps-remove -R xbps
```
4. Como la mayoría de usuarios están acostubrados a utilizar la versión de XBPS vinculada dinámicamente, se les hará extraño estar llamando a las funciones de XBPS como `xbps-install.static xbps-remove.static`, etc, por lo tanto, para seguir usándolo de la manera habitual bastará con crear unos enlaces simbólicos de cada una de las funciones de XBPS e incluirlos en nuestro corresponiente PATH. Para esto, se puede optar por tres opciones posibles:
* Utilizar el PATH que el sistema utiliza para instalar binarios: `/usr/bin`
* Usar el PATH que se utiliza cuando se compila software adicional a través de *make*: `/usr/local/bin`
* Usar un PATH local que utilice el usuario: `"$HOME"/.local/bin`. En caso de no existir el directorio crearlo: `$ mkdir -p "$HOME"/.local/bin`
Una vez decidido qué PATH utilizán, proceder a crear los enlaces simbólicos. Para nuestro ejemplo tomaremos el tercer supuesto:
```
$ ln -s /usr/bin/xbps-alternatives.static "$HOME"/.local/bin/xbps-alternatives
$ ln -s /usr/bin/xbps-checkvers.static "$HOME"/.local/bin/xbps-checkvers
$ ln -s /usr/bin/xbps-create.static "$HOME"/.local/bin/xbps-create
$ ln -s /usr/bin/xbps-dgraph.static "$HOME"/.local/bin/xbps-dgraph
$ ln -s /usr/bin/xbps-digest.static "$HOME"/.local/bin/xbps-digest
$ ln -s /usr/bin/xbps-fetch.static "$HOME"/.local/bin/xbps-fetch
$ ln -s /usr/bin/xbps-install.static "$HOME"/.local/bin/xbps-install
$ ln -s /usr/bin/xbps-pkgdb.static "$HOME"/.local/bin/xbps-pkgdb
$ ln -s /usr/bin/xbps-query.static "$HOME"/.local/bin/xbps-query
$ ln -s /usr/bin/xbps-reconfigure.static "$HOME"/.local/bin/xbps-reconfigure
$ ln -s /usr/bin/xbps-remove.static "$HOME"/.local/bin/xbps-remove
$ ln -s /usr/bin/xbps-rindex.static "$HOME"/.local/bin/xbps-rindex
$ ln -s /usr/bin/xbps-uchroot.static "$HOME"/.local/bin/xbps-uchroot
$ ln -s /usr/bin/xbps-uhelper.static "$HOME"/.local/bin/xbps-uhelper
```
5. Ahora que se han realizado los cambios, lo que resta es reiniciar la sesión y *loguearse* nuevamente para que las modificaciones surtan efecto:
```
$ pkill Xorg
```
6. Ahora podrán utilizar con completa libertad la versión más reciente de XBPS y en caso de querer actualizar a otra versión liberada por xtraeme bastará con modificar las filas que corresponden a los campos `version` y `checksum` por las que correspondan.
Para finalizar, la lista de cambios que xtraeme realice en XBPS puede ser consultada [aquí](https://gitlab.com/xtraeme/xbps/-/blob/master/NEWS.md).
## Referencias
* Juan RP (s.f.) xbps. Sitio web de Github: https://github.com/void-linux/xbps
* musl libc (s.f.) Introduction to musl. Sitio web de musl-libc.org: https://www.musl-libc.org/intro.html
* xtraeme (s.f.) go-xbulk. Sitio web de Gitlab: https://gitlab.com/xtraeme/go-xbulk
* xtraeme (s.f.) xbps. Sitio web de Gitlab: https://gitlab.com/xtraeme/xbps
* Wikipedia (s.f.) https://es.wikipedia.org

View File

@ -0,0 +1,134 @@
diff --git a/dmenu.c b/dmenu.c
--- a/dmenu.c
+++ b/dmenu.c
@@ -32,6 +32,7 @@ struct item {
char *text;
struct item *left, *right;
int out;
+ int distance;
};
static char text[BUFSIZ] = "";
@@ -264,6 +265,86 @@ match(void)
calcoffsets();
}
+int
+compare_distance(const void *a, const void *b)
+{
+ struct item *da = *(struct item **) a;
+ struct item *db = *(struct item **) b;
+
+ if (!db)
+ return 1;
+ if (!da)
+ return -1;
+
+ return da->distance - db->distance;
+}
+
+void
+fuzzymatch(void)
+{
+ /* bang - we have so much memory */
+ struct item *it;
+ struct item **fuzzymatches = NULL;
+ char c;
+ int number_of_matches = 0, i, pidx, sidx, eidx;
+ int text_len = strlen(text), itext_len;
+
+ matches = matchend = NULL;
+
+ /* walk through all items */
+ for (it = items; it && it->text; it++) {
+ if (text_len) {
+ itext_len = strlen(it->text);
+ pidx = 0;
+ sidx = eidx = -1;
+ /* walk through item text */
+ for (i = 0; i < itext_len && (c = it->text[i]); i++) {
+ /* fuzzy match pattern */
+ if (text[pidx] == c) {
+ if(sidx == -1)
+ sidx = i;
+ pidx++;
+ if (pidx == text_len) {
+ eidx = i;
+ break;
+ }
+ }
+ }
+ /* build list of matches */
+ if (eidx != -1) {
+ /* compute distance */
+ /* factor in 30% of sidx and distance between eidx and total
+ * text length .. let's see how it works */
+ it->distance = eidx - sidx + (itext_len - eidx + sidx) / 3;
+ appenditem(it, &matches, &matchend);
+ number_of_matches++;
+ }
+ } else {
+ appenditem(it, &matches, &matchend);
+ }
+ }
+
+ if (number_of_matches) {
+ /* initialize array with matches */
+ if (!(fuzzymatches = realloc(fuzzymatches, number_of_matches * sizeof(struct item*))))
+ die("cannot realloc %u bytes:", number_of_matches * sizeof(struct item*));
+ for (i = 0, it = matches; it && i < number_of_matches; i++, it = it->right) {
+ fuzzymatches[i] = it;
+ }
+ /* sort matches according to distance */
+ qsort(fuzzymatches, number_of_matches, sizeof(struct item*), compare_distance);
+ /* rebuild list of matches */
+ matches = matchend = NULL;
+ for (i = 0, it = fuzzymatches[i]; i < number_of_matches && it && \
+ it->text; i++, it = fuzzymatches[i]) {
+ appenditem(it, &matches, &matchend);
+ }
+ free(fuzzymatches);
+ }
+ curr = sel = matches;
+ calcoffsets();
+}
+
static void
insert(const char *str, ssize_t n)
{
@@ -274,7 +355,7 @@ insert(const char *str, ssize_t n)
if (n > 0)
memcpy(&text[cursor], str, n);
cursor += n;
- match();
+ fuzzymatch();
}
static size_t
@@ -343,7 +424,7 @@ keypress(XKeyEvent *ev)
case XK_k: /* delete right */
text[cursor] = '\0';
- match();
+ fuzzymatch();
break;
case XK_u: /* delete left */
insert(NULL, 0 - cursor);
@@ -492,7 +573,7 @@ insert:
strncpy(text, sel->text, sizeof text - 1);
text[sizeof text - 1] = '\0';
cursor = strlen(text);
- match();
+ fuzzymatch();
break;
}
@@ -653,7 +734,7 @@ setup(void)
}
promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
inputw = MIN(inputw, mw/3);
- match();
+ fuzzymatch();
/* create menu window */
swa.override_redirect = True;

View File

@ -0,0 +1,50 @@
# Template file for 'dmenu' git version
pkgname=dmenu-git
version=5.0
revision=2
wrksrc="dmenu"
build_style=gnu-makefile
hostmakedepends="git pkg-config"
makedepends="libXinerama-devel libXft-devel freetype-devel"
short_desc="Generic menu for X"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="MIT"
homepage="https://tools.suckless.org/dmenu/"
build_options="fuzzymatch"
desc_option_fuzzymatch="Enable Fuzzymatch support"
# Obtener versión más reciente en upstream
do_fetch(){
git clone git://git.suckless.org/dmenu --depth 1
cd ${wrksrc}
git checkout master
}
post_patch() {
if [ "$build_option_fuzzymatch" ]; then
msg_normal "Applying fuzzymatch patches"
patch -slNp1 < "${FILESDIR}/fuzzymatch.patch"
fi
sed -i -e '/CFLAGS/{s/-Os//;s/=/+=/}' \
-e '/LDFLAGS/{s/-s//;s/=/+=/}' config.mk
}
do_build() {
# Si existe una configuración custom del usuario se usará
[ -e ${FILESDIR}/config.h ] && cp ${FILESDIR}/config.h config.h
sed -i -e "s|^FREETYPEINC|#FREETYPEINC|g" \
-e "s|^X11INC|#X11INC|g" \
-e "s|^X11LIB|#X11LIB|g" config.mk
x11inc=$XBPS_CROSS_BASE/usr/include/X11
x11lib=$XBPS_CROSS_BASE/usr/lib
freetypeinc=$XBPS_CROSS_BASE/usr/include/freetype2
make CC="$CC" ${makejobs} X11INC=$x11inc X11LIB=$x11lib FREETYPEINC=$freetypeinc
}
do_install() {
make PREFIX=/usr DESTDIR=${DESTDIR} install
vlicense LICENSE
}

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Encoding=UTF-8
Name=Dwm
Comment=Dynamic window manager
Exec=dwm
Icon=dwm
Type=XSession

View File

@ -0,0 +1,33 @@
# Template file for 'dwm' git version
pkgname=dwm-git
version=6.2
revision=2
wrksrc="dwm"
build_style=gnu-makefile
hostmakedepends="git pkg-config"
makedepends="libXinerama-devel libXft-devel freetype-devel"
short_desc="Dynamic window manager for X"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="MIT"
homepage="http://dwm.suckless.org"
# Obtener versión más reciente en upstream
do_fetch(){
git clone git://git.suckless.org/dwm ${wrksrc} --depth 1
cd ${wrksrc}
git checkout master
}
do_build() {
[ -e ${FILESDIR}/config.h ] && cp ${FILESDIR}/config.h config.h
sed -i "/CFLAGS/s|\${CPPFLAGS}|& $CFLAGS|g" config.mk
sed -i "/LDFLAGS/s|\-s|$LDFLAGS|g" config.mk
make CC=$CC INCS="-I. -I${XBPS_CROSS_BASE}/usr/include/freetype2" LIBS="-lX11 -lXinerama -lXft -lfontconfig"
}
do_install() {
make PREFIX=/usr DESTDIR=$DESTDIR install
vinstall README 644 usr/share/doc/$pkgname
vinstall ${FILESDIR}/dwm.desktop 644 usr/share/xsessions
vlicense LICENSE
}

View File

@ -0,0 +1,34 @@
# Template file for 'slock'
pkgname=slock-git
version=1.4
revision=2
wrksrc="slock"
build_style=gnu-makefile
hostmakedepends="git pkg-config"
makedepends="libXrandr-devel"
short_desc="Simple screen locker for X"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="MIT"
homepage="http://tools.suckless.org/slock"
# Obtener versión más reciente en upstream
do_fetch(){
git clone git://git.suckless.org/slock --depth 1
cd ${wrksrc}
git checkout master
}
do_build() {
# Si existe una configuración custom del usuario se usará
[ -e ${FILESDIR}/config.h ] && cp ${FILESDIR}/config.h config.h
sed -i 's/CPPFLAGS =/CPPFLAGS +=/g' config.mk
sed -i 's/CFLAGS =/CFLAGS +=/g' config.mk
sed -i 's/LDFLAGS =/LDFLAGS +=/g' config.mk
make CC=$CC INCS="-I." LIBS="-lX11 -lXext -lcrypt -lXrandr" ${makejobs}
}
do_install() {
make PREFIX=/usr DESTDIR=$DESTDIR install
vlicense LICENSE
}

View File

@ -0,0 +1,3 @@
Para usar slstatus, poner lo siguiente en tu archivo "$HOME"/.xinitrc (o similar):
slstatus &

View File

@ -0,0 +1,65 @@
/* See LICENSE file for copyright and license details. */
/* interval between updates (in ms) */
const unsigned int interval = 1000;
/* text to show if no value can be retrieved */
static const char unknown_str[] = "n/a";
/* maximum output string length */
#define MAXLEN 2048
/*
* function description argument (example)
*
* battery_perc battery percentage battery name (BAT0)
* NULL on OpenBSD
* battery_state battery charging state battery name (BAT0)
* NULL on OpenBSD
* battery_remaining battery remaining HH:MM battery name (BAT0)
* NULL on OpenBSD
* cpu_perc cpu usage in percent NULL
* cpu_freq cpu frequency in MHz NULL
* datetime date and time format string (%F %T)
* disk_free free disk space in GB mountpoint path (/)
* disk_perc disk usage in percent mountpoint path (/)
* disk_total total disk space in GB mountpoint path (/")
* disk_used used disk space in GB mountpoint path (/)
* entropy available entropy NULL
* gid GID of current user NULL
* hostname hostname NULL
* ipv4 IPv4 address interface name (eth0)
* ipv6 IPv6 address interface name (eth0)
* kernel_release `uname -r` NULL
* keyboard_indicators caps/num lock indicators format string (c?n?)
* see keyboard_indicators.c
* keymap layout (variant) of current NULL
* keymap
* load_avg load average NULL
* netspeed_rx receive network speed interface name (wlan0)
* netspeed_tx transfer network speed interface name (wlan0)
* num_files number of files in a directory path
* (/home/foo/Inbox/cur)
* ram_free free memory in GB NULL
* ram_perc memory usage in percent NULL
* ram_total total memory size in GB NULL
* ram_used used memory in GB NULL
* run_command custom shell command command (echo foo)
* swap_free free swap in GB NULL
* swap_perc swap usage in percent NULL
* swap_total total swap size in GB NULL
* swap_used used swap in GB NULL
* temp temperature in degree celsius sensor file
* (/sys/class/thermal/...)
* NULL on OpenBSD
* uid UID of current user NULL
* uptime system uptime NULL
* username username of current user NULL
* vol_perc OSS/ALSA volume in percent mixer file (/dev/mixer)
* wifi_perc WiFi signal in percent interface name (wlan0)
* wifi_essid WiFi ESSID interface name (wlan0)
*/
static const struct arg args[] = {
/* function format argument */
{ datetime, "%s", "%F %T" },
};

View File

@ -0,0 +1,29 @@
# Template file for 'slstatus' git version
pkgname=slstatus-git
version=20201130
revision=1
wrksrc="slstatus"
build_style=gnu-makefile
hostmakedepends="git pkg-config"
makedepends="alsa-lib-devel libX11-devel"
short_desc="Suckless status monitor for dwm"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="ISC"
homepage="https://tools.suckless.org/slstatus/"
# Obtener versión más reciente en upstream
do_fetch(){
git clone git://git.suckless.org/slstatus ${wrksrc} --depth 1
cd ${wrksrc}
git checkout master
}
pre_build() {
[ -e ${FILESDIR}/config.h ] && cp ${FILESDIR}/config.h config.h
sed -i -e 's|^CFLAGS *=|override CFLAGS +=|g' \
-e 's|^LDFLAGS *=|override LDFLAGS +=|g' config.mk
}
post_install() {
vlicense LICENSE
}

View File

@ -0,0 +1,3 @@
Una ves que se ha copiado el directorio con el contenido de la versión git de st al directorio de plantillas del repositorio de git, se tendrá que crear el siguiente enlace simbólico:
$ ln -s srcpkgs/st-terminfo_git st-terminfo

View File

@ -0,0 +1,5 @@
case "${ACTION}" in
post)
tic -sx usr/share/terminfo/s/st.terminfo
;;
esac

View File

@ -0,0 +1,11 @@
case "${ACTION}" in
pre)
rm usr/share/terminfo/s/st
rm usr/share/terminfo/s/st-bs
rm usr/share/terminfo/s/st-bs-256color
rm usr/share/terminfo/s/st-mono
rm usr/share/terminfo/s/st-meta
rm usr/share/terminfo/s/st-meta-256color
rm usr/share/terminfo/s/st-256color
;;
esac

View File

@ -0,0 +1,42 @@
# Template file for 'st' git version
pkgname=st-git
version=0.8.4
revision=4
wrksrc="st"
build_style=gnu-makefile
hostmakedepends="git pkg-config"
makedepends="fontconfig-devel libX11-devel libXft-devel"
depends="ncurses st-terminfo_git-${version}_${revision}"
short_desc="Simple terminal implementation for X"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="MIT"
homepage="https://st.suckless.org"
# Obtener versión más reciente en upstream
do_fetch(){
git clone https://git.suckless.org/st ${wrksrc} --depth 1
cd ${wrksrc}
git checkout master
}
pre_build() {
sed -i 's|Liberation Mono|Monospace|g' config.def.h
# Si existe una configuración custom del usuario se usará
[ -e ${FILESDIR}/config.h ] && cp ${FILESDIR}/config.h config.h
# We will use tic after install. See INSTALL.
vsed -i Makefile -e '/tic/d'
}
post_install() {
vinstall st.info 644 usr/share/terminfo/s st.terminfo
vdoc README
vlicense LICENSE
}
st-terminfo_git_package() {
short_desc+=" - terminfo data"
depends="ncurses"
pkg_install() {
vmove usr/share/terminfo
}
}

View File

@ -0,0 +1,194 @@
/* modifier 0 means no modifier */
static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */
static char *fulluseragent = ""; /* Or override the whole user agent string */
static char *scriptfile = "~/.surf/script.js";
static char *styledir = "~/.surf/styles/";
static char *certdir = "~/.surf/certificates/";
static char *cachedir = "~/.surf/cache/";
static char *cookiefile = "~/.surf/cookies.txt";
/* Webkit default features */
/* Highest priority value will be used.
* Default parameters are priority 0
* Per-uri parameters are priority 1
* Command parameters are priority 2
*/
static Parameter defconfig[ParameterLast] = {
/* parameter Arg value priority */
[AccessMicrophone] = { { .i = 0 }, },
[AccessWebcam] = { { .i = 0 }, },
[Certificate] = { { .i = 0 }, },
[CaretBrowsing] = { { .i = 0 }, },
[CookiePolicies] = { { .v = "@Aa" }, },
[DefaultCharset] = { { .v = "UTF-8" }, },
[DiskCache] = { { .i = 1 }, },
[DNSPrefetch] = { { .i = 0 }, },
[Ephemeral] = { { .i = 0 }, },
[FileURLsCrossAccess] = { { .i = 0 }, },
[FontSize] = { { .i = 12 }, },
[FrameFlattening] = { { .i = 0 }, },
[Geolocation] = { { .i = 0 }, },
[HideBackground] = { { .i = 0 }, },
[Inspector] = { { .i = 0 }, },
[Java] = { { .i = 1 }, },
[JavaScript] = { { .i = 1 }, },
[KioskMode] = { { .i = 0 }, },
[LoadImages] = { { .i = 1 }, },
[MediaManualPlay] = { { .i = 1 }, },
[PreferredLanguages] = { { .v = (char *[]){ NULL } }, },
[RunInFullscreen] = { { .i = 0 }, },
[ScrollBars] = { { .i = 1 }, },
[ShowIndicators] = { { .i = 1 }, },
[SiteQuirks] = { { .i = 1 }, },
[SmoothScrolling] = { { .i = 0 }, },
[SpellChecking] = { { .i = 0 }, },
[SpellLanguages] = { { .v = ((char *[]){ "en_US", NULL }) }, },
[StrictTLS] = { { .i = 1 }, },
[Style] = { { .i = 1 }, },
[WebGL] = { { .i = 0 }, },
[ZoomLevel] = { { .f = 1.0 }, },
};
static UriParameters uriparams[] = {
{ "(://|\\.)suckless\\.org(/|$)", {
[JavaScript] = { { .i = 0 }, 1 },
}, },
};
/* default window size: width, height */
static int winsize[] = { 800, 600 };
static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
WEBKIT_FIND_OPTIONS_WRAP_AROUND;
#define PROMPT_GO "Go:"
#define PROMPT_FIND "Find:"
/* SETPROP(readprop, setprop, prompt)*/
#define SETPROP(r, s, p) { \
.v = (const char *[]){ "/bin/sh", "-c", \
"prop=\"$(printf '%b' \"$(xprop -id $1 "r" " \
"| sed -e 's/^"r"(UTF8_STRING) = \"\\(.*\\)\"/\\1/' " \
" -e 's/\\\\\\(.\\)/\\1/g')\" " \
"| dmenu -p '"p"' -w $1)\" " \
"&& xprop -id $1 -f "s" 8u -set "s" \"$prop\"", \
"surf-setprop", winid, NULL \
} \
}
/* DOWNLOAD(URI, referer) */
#define DOWNLOAD(u, r) { \
.v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
"curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \
" -e \"$3\" \"$4\"; read", \
"surf-download", useragent, cookiefile, r, u, NULL \
} \
}
/* PLUMB(URI) */
/* This called when some URI which does not begin with "about:",
* "http://" or "https://" should be opened.
*/
#define PLUMB(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \
"xdg-open \"$0\"", u, NULL \
} \
}
/* VIDEOPLAY(URI) */
#define VIDEOPLAY(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \
"mpv --really-quiet \"$0\"", u, NULL \
} \
}
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
* the list.
*/
static SiteSpecific styles[] = {
/* regexp file in $styledir */
{ ".*", "default.css" },
};
/* certificates */
/*
* Provide custom certificate for urls
*/
static SiteSpecific certs[] = {
/* regexp file in $certdir */
{ "://suckless\\.org/", "suckless.org.crt" },
};
#define MODKEY GDK_CONTROL_MASK
/* hotkeys */
/*
* If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
* edit the CLEANMASK() macro.
*/
static Key keys[] = {
/* modifier keyval function arg */
{ MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_KEY_c, stop, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
{ MODKEY, GDK_KEY_r, reload, { .i = 0 } },
{ MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
{ MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
/* vertical and horizontal scrolling, in viewport percentage */
{ MODKEY, GDK_KEY_j, scrollv, { .i = +10 } },
{ MODKEY, GDK_KEY_k, scrollv, { .i = -10 } },
{ MODKEY, GDK_KEY_space, scrollv, { .i = +50 } },
{ MODKEY, GDK_KEY_b, scrollv, { .i = -50 } },
{ MODKEY, GDK_KEY_i, scrollh, { .i = +10 } },
{ MODKEY, GDK_KEY_u, scrollh, { .i = -10 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
{ MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
{ MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
{ MODKEY, GDK_KEY_p, clipboard, { .i = 1 } },
{ MODKEY, GDK_KEY_y, clipboard, { .i = 0 } },
{ MODKEY, GDK_KEY_n, find, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
{ MODKEY, GDK_KEY_t, showcert, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } },
{ 0, GDK_KEY_F11, togglefullscreen, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
};
/* button definitions */
/* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
static Button buttons[] = {
/* target event mask button function argument stop event */
{ OnLink, 0, 2, clicknewwindow, { .i = 0 }, 1 },
{ OnLink, MODKEY, 2, clicknewwindow, { .i = 1 }, 1 },
{ OnLink, MODKEY, 1, clicknewwindow, { .i = 1 }, 1 },
{ OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 },
{ OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 },
{ OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 },
};

View File

@ -0,0 +1,29 @@
# Template file for 'surf' git version
pkgname=surf-git
version=2.1
revision=2
wrksrc="surf"
build_style=gnu-makefile
hostmakedepends="git pkg-config"
makedepends="webkit2gtk-devel gcr-devel"
depends="xprop dmenu"
short_desc="Simple web browser based on WebKit/GTK+"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="MIT"
homepage="http://surf.suckless.org"
# Obtener versión más reciente en upstream
do_fetch(){
git clone git://git.suckless.org/surf --depth 1
cd ${wrksrc}
git checkout surf-webkit2
}
pre_build() {
# Si existe una configuración custom del usuario se usará
[ -e ${FILESDIR}/config.h ] && cp ${FILESDIR}/config.h config.h
}
post_install() {
vlicense LICENSE
}

View File

@ -0,0 +1,39 @@
# Template file for 'tabbed' git version
pkgname=tabbed-git
version=0.6
revision=5
wrksrc="tabbed"
build_style=gnu-makefile
make_build_args="INCS=-I. LIBS=-lX11"
hostmakedepends="git pkg-config"
makedepends="freetype-devel libX11-devel libXft-devel"
short_desc="Tab interface for application supporting Xembed"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="MIT"
homepage="http://tools.suckless.org/tabbed/"
# Obtener versión más reciente en upstream
do_fetch(){
git clone https://git.suckless.org/tabbed --depth 1
cd ${wrksrc}
git checkout master
}
pre_build() {
sed -i 's|-O0 ||g' config.mk
sed -i 's|^CPPFLAGS =|override CPPFLAGS +=|g' config.mk
sed -i 's|^CFLAGS =|override CFLAGS +=|g' config.mk
sed -i 's|^LDFLAGS =|override LDFLAGS +=|g' config.mk
# Remove BSD_SOURCE warning
sed -i 's/-D_BSD_SOURCE/-D_DEFAULT_SOURCE/g' config.mk
}
do_build() {
# Si existe una configuración custom del usuario se usará
[ -e ${FILESDIR}/config.h ] && cp ${FILESDIR}/config.h config.h
make CC=$CC INCS="-I. -I${XBPS_CROSS_BASE}/usr/include/freetype2" LIBS="-lX11 -lXft -lfontconfig"
}
post_install() {
vlicense LICENSE
}

View File

@ -0,0 +1,15 @@
case "${ACTION}" in
post)
chown root:xbuilder usr/bin/xbps-uchroot
chmod 4750 usr/bin/xbps-uchroot
if [ -d usr/sbin -a ! -L usr/sbin ]; then
for f in usr/bin/xbps-*; do
ln -sr $f usr/sbin/$(basename $f)
done
# Fix certificate verification issue
ln -s /etc/ssl/certs.pem /etc/ssl/cert.pem
fi
;;
esac

View File

@ -0,0 +1,5 @@
case "${ACTION}" in
pre)
unlink /etc/ssl/cert.pem
;;
esac

View File

@ -0,0 +1,46 @@
# Template file for 'xbps'
pkgname=xbps
version=21.1
revision=4
archs="i686 x86_64 x86_64-musl"
bootstrap=yes
build_style=configure
short_desc="XBPS package system utilities"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="BSD-2-Clause, BSD-3-Clause, ISC"
homepage="https://gitlab.com/xtraeme/xbps/"
changelog="${homepage}-/blob/master/NEWS.md"
distfiles="${homepage}-/archive/${version}/xbps-${version}.tar.gz"
checksum=51a8ab75ece07bea64ea325e2c62314f9477bab06de297e8d3577f0fb4f48578
hostmakedepends="pkgconf"
makedepends="libarchive-devel"
depends="ca-certificates xbps-triggers"
make_dirs="/etc/xbps.d 0755 root root"
do_configure() {
./configure --prefix=/usr \
--sysconfdir=/etc \
--enable-lto
}
pre_build() {
vmkdir usr/share/xbps.d
}
post_install() {
local repo="https://alpha.de.repo.voidlinux.org/current" suffix=
case "$XBPS_TARGET_MACHINE" in
*-musl) suffix="/musl";;
esac
echo "repository=${repo}${suffix}" > \
${DESTDIR}/usr/share/xbps.d/00-repository-main.conf
echo "architecture=${XBPS_TARGET_MACHINE}" > \
${DESTDIR}/usr/share/xbps.d/xbps-arch.conf
vlicense LICENSE
vlicense 3RDPARTY
}

View File

@ -2,5 +2,8 @@ case "${ACTION}" in
post)
chown root:xbuilder usr/bin/xbps-uchroot.static
chmod 4750 usr/bin/xbps-uchroot.static
# Fix certificate verification issue
ln -s /etc/ssl/certs.pem /etc/ssl/cert.pem
;;
esac

View File

@ -0,0 +1,8 @@
Since most users use the dynamically linked version, it's recommended to create a dynamic link for each XBPS function to continue using it on a regular basis. For example:
# ln -s /usr/bin/xbps-install.static /usr/local/bin/xbps-install
$ ln -s /usr/bin/xbps-install.static "$HOME"/.local/bin/xbps-install

View File

@ -0,0 +1,5 @@
case "${ACTION}" in
pre)
unlink /etc/ssl/cert.pem
;;
esac

View File

@ -1,8 +1,7 @@
# Template file for 'xbps-static'
# NOTE: keep this package synchronized with "srcpkgs/xbps"
# Template file for 'xbps-static' xtraeme version
pkgname=xbps-static
version=21.1
revision=1
revision=4
# only musl
archs="*-musl"
wrksrc="xbps-${version}"
@ -14,7 +13,7 @@ short_desc="XBPS package system utilities - static binaries"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="BSD-2-Clause, BSD-3-Clause, ISC"
homepage="https://gitlab.com/xtraeme/xbps/"
changelog="${homepage}/-/blob/master/NEWS.md"
changelog="${homepage}-/blob/master/NEWS.md"
distfiles="${homepage}-/archive/${version}/xbps-${version}.tar.gz"
checksum=51a8ab75ece07bea64ea325e2c62314f9477bab06de297e8d3577f0fb4f48578
@ -26,6 +25,15 @@ do_configure() {
do_install() {
make DESTDIR=${wrksrc}/static-install install
# Directorio para la configuración de XBPS
vmkdir usr/share/xbps.d
# Al tratarse de un binario vinculado estáticamente, no tendrá manpages,
# por lo tanto, indicaremos explícitamente que sí los incluya
vmkdir usr/share/man
mv ${wrksrc}/static-install/usr/share/man/* ${DESTDIR}/usr/share/man
vmkdir usr/bin
mv ${wrksrc}/static-install/usr/bin/*.static ${DESTDIR}/usr/bin
for _f in /var/db/xbps/keys/* ; do
@ -34,6 +42,16 @@ do_install() {
}
post_install() {
repo="https://alpha.de.repo.voidlinux.org/current"
# Arquitectura x86_64-musl
echo "architecture=${XBPS_MACHINE}" > \
${DESTDIR}/usr/share/xbps.d/xbps.conf
# Repositorio predeterminado
echo "repository=${repo}/musl" >> \
${DESTDIR}/usr/share/xbps.d/xbps.conf
vlicense LICENSE
vlicense 3RDPARTY
}

View File

@ -1,37 +0,0 @@
# Template file for 'xbps-static'
# NOTE: keep this package synchronized with "srcpkgs/xbps"
pkgname=xbps-static
version=0.59.1
revision=5
# only musl
archs="*-musl"
wrksrc="xbps-${version}"
build_style=configure
hostmakedepends="pkg-config"
makedepends="libarchive-devel"
depends="xbps-triggers"
short_desc="XBPS package system utilities - static binaries"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="BSD-2-Clause, BSD-3-Clause, ISC"
homepage="https://github.com/void-linux/xbps"
changelog="https://github.com/void-linux/xbps/blob/master/NEWS"
distfiles="https://github.com/void-linux/xbps/archive/${version}.tar.gz"
checksum=0cbd8d5f23a62047c75974bca21da9f004a94efffd7f37c68562a8dbc869fb2a
do_configure() {
./configure --prefix=/usr --sysconfdir=/etc --enable-static --enable-lto
}
do_install() {
make DESTDIR=${wrksrc}/static-install install
vmkdir usr/bin
mv ${wrksrc}/static-install/usr/bin/*.static ${DESTDIR}/usr/bin
for _f in /var/db/xbps/keys/* ; do
vinstall "$_f" 0644 var/db/xbps/keys/
done
}
post_install() {
vlicense LICENSE
vlicense LICENSE.3RDPARTY
}