You are not logged in.

#1 2021-06-28 20:26:55

HotDogEnemy
Member
Registered: 2020-11-24
Posts: 72

[SOLVED] Clueless on how to patch Simple Terminal from AUR

I was trying to install Simple Terminal by cloning it from the AUR, by issuing the following commands:

$ git clone https://aur.archlinux.org/st.git    # Cloning repository
$ cd st                                         # CD'ing into cloned directory
$ makepkg --nobuild                             # Generating the config.def.h to be patched
$ vim PKGBUILD                                  # Editing the pkgbuild to include the links of the patches, and to apply the patches in the prepare() section of the PKGBUILD
$ updpkgsums                                    # Updating the checksums in the PKGBUILD
$ makepkg                                       # Installing the package

However after doing all that, makepkg gives the following:

==> Making package: st 0.8.4-1 (Tue 29 Jun 2021 01:29:31 AM IST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found st-0.8.4.tar.gz
  -> Found terminfo.patch
  -> Found README.terminfo.rst
  -> Found st-gruvbox-dark-0.8.2.diff
  -> Found st-scrollback-0.8.4.diff
==> Validating source files with sha256sums...
    st-0.8.4.tar.gz ... Passed
    terminfo.patch ... Passed
    README.terminfo.rst ... Passed
    st-gruvbox-dark-0.8.2.diff ... Passed
    st-scrollback-0.8.4.diff ... Passed
==> Extracting sources...
  -> Extracting st-0.8.4.tar.gz with bsdtar
==> Starting prepare()...
patching file Makefile
Applying patch st-gruvbox-dark-0.8.2.diff...
can't find file to patch at input line 5
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/config.def.h b/config.def.h
|index 877afab..6a1699f 100644
|--- a/config.def.h
|+++ b/config.def.h
--------------------------
File to patch: config.def.h
config.def.h: No such file or directory
Skip this patch? [y]

How do I get the PKGBUILD to patch config.def.h? Here is the edited PKGBUILD for reference:

# Maintainer: Jose Riha <jose1711 gmail com>
# Maintainer: Sebastian J. Bronner <waschtl@sbronner.com>
# Contributor: Patrick Jackson <PatrickSJackson gmail com>
# Contributor: Christoph Vigano <mail@cvigano.de>

pkgname=st
pkgver=0.8.4
pkgrel=1
pkgdesc='A simple virtual terminal emulator for X.'
arch=('i686' 'x86_64' 'armv7h')
license=('MIT')
depends=(libxft)
url=https://st.suckless.org
_patches=(https://st.suckless.org/patches/gruvbox/st-gruvbox-dark-0.8.2.diff
         https://st.suckless.org/patches/scrollback/st-scrollback-0.8.4.diff)
source=(https://dl.suckless.org/$pkgname/$pkgname-$pkgver.tar.gz
        terminfo.patch
        README.terminfo.rst
        ${_patches[@]})
sha256sums=('d42d3ceceb4d6a65e32e90a5336e3d446db612c3fbd9ebc1780bc6c9a03346a6'
            'f9deea445a5c6203a0e8e699f3c3b55e27275f17fb408562c4dd5d649edeea23'
            '0ebcbba881832adf9c98ce9fe7667c851d3cc3345077cb8ebe32702698665be2'
            '4eb3d5eda53a0a77f7438c575d09909f3f7dc462d12e0e4b9d40a7aa64e01b2e'
            '418e1c5df11105482f13a008218c89eadb974630c25b4a6ff3da763dc2560e44')
_sourcedir=$pkgname-$pkgver
_makeopts="--directory=$_sourcedir"

prepare() {
  patch --directory="$_sourcedir" --strip=0 < terminfo.patch
    
  # This package provides a mechanism to provide a custom config.h. Multiple
  # configuration states are determined by the presence of two files in
  # $BUILDDIR:
  #
  # config.h  config.def.h  state
  # ========  ============  =====
  # absent    absent        Initial state. The user receives a message on how
  #                         to configure this package.
  # absent    present       The user was previously made aware of the
  #                         configuration options and has not made any
  #                         configuration changes. The package is built using
  #                         default values.
  # present                 The user has supplied his or her configuration. The
  #                         file will be copied to $srcdir and used during
  #                         build.
  #
  # After this test, config.def.h is copied from $srcdir to $BUILDDIR to
  # provide an up to date template for the user.
  if [ -e "$BUILDDIR/config.h" ]
  then
    cp "$BUILDDIR/config.h" "$_sourcedir"
  elif [ ! -e "$BUILDDIR/config.def.h" ]
  then
    msg='This package can be configured in config.h. Copy the config.def.h '
    msg+='that was just placed into the package directory to config.h and '
    msg+='modify it to change the configuration. Or just leave it alone to '
    msg+='continue to use default values.'
    warning "$msg"
  fi
  for patch in "${_patches[@]}"; do
    echo "Applying patch $(basename $patch)..."
    patch -i "$srcdir/$(basename $patch)"
  done
  cp "$_sourcedir/config.def.h" "$BUILDDIR"
}

build() {
  make $_makeopts X11INC=/usr/include/X11 X11LIB=/usr/lib/X11
}

package() {
  local installopts='--mode 0644 -D --target-directory'
  local shrdir="$pkgdir/usr/share"
  local licdir="$shrdir/licenses/$pkgname"
  local docdir="$shrdir/doc/$pkgname"
  make $_makeopts PREFIX=/usr DESTDIR="$pkgdir" install
  install $installopts "$licdir" "$_sourcedir/LICENSE"
  install $installopts "$docdir" "$_sourcedir/README"
  install $installopts "$docdir" README.terminfo.rst
  install $installopts "$shrdir/$pkgname" "$_sourcedir/st.info"
}

Any help with this would be appreciated, I'm a beginner to patching AUR stuff.

Last edited by HotDogEnemy (2021-06-29 05:23:16)

Offline

#2 2021-06-28 20:50:28

seth
Member
Registered: 2012-09-03
Posts: 51,299

Re: [SOLVED] Clueless on how to patch Simple Terminal from AUR

"makepkg -e" on the second run

Offline

#3 2021-06-28 20:56:31

HotDogEnemy
Member
Registered: 2020-11-24
Posts: 72

Re: [SOLVED] Clueless on how to patch Simple Terminal from AUR

I ran makepkg -e, it installed successfully. However I can't seem to run st, seems like it creates the files in /home/$USER/st/usr/bin instead of /usr/bin as indicated by the following output during makepkg:

==> Making package: st 0.8.4-1 (Tue 29 Jun 2021 02:21:10 AM IST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Starting build()...
make: Entering directory '/home/shivodit/st/src/st-0.8.4'
st build options:
CFLAGS  = -I/usr/include/X11  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -DVERSION="0.8.4" -D_XOPEN_SOURCE=600  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection
LDFLAGS = -L/usr/lib/X11 -lm -lrt -lX11 -lutil -lXft  -lfontconfig -lfreetype   -lfreetype  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
CC      = c99
cp config.def.h config.h
c99 -I/usr/include/X11  `pkg-config --cflags fontconfig`  `pkg-config --cflags freetype2` -DVERSION=\"0.8.4\" -D_XOPEN_SOURCE=600  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -c st.c
c99 -I/usr/include/X11  `pkg-config --cflags fontconfig`  `pkg-config --cflags freetype2` -DVERSION=\"0.8.4\" -D_XOPEN_SOURCE=600  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -c x.c
c99 -o st st.o x.o -L/usr/lib/X11 -lm -lrt -lX11 -lutil -lXft  `pkg-config --libs fontconfig`  `pkg-config --libs freetype2` -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
make: Leaving directory '/home/shivodit/st/src/st-0.8.4'
==> Entering fakeroot environment...
==> Starting package()...
make: Entering directory '/home/shivodit/st/src/st-0.8.4'
mkdir -p /home/shivodit/st/pkg/st/usr/bin
cp -f st /home/shivodit/st/pkg/st/usr/bin
chmod 755 /home/shivodit/st/pkg/st/usr/bin/st
mkdir -p /home/shivodit/st/pkg/st/usr/share/man/man1
sed "s/VERSION/0.8.4/g" < st.1 > /home/shivodit/st/pkg/st/usr/share/man/man1/st.1
chmod 644 /home/shivodit/st/pkg/st/usr/share/man/man1/st.1
Please see the README file regarding the terminfo entry of st.
make: Leaving directory '/home/shivodit/st/src/st-0.8.4'
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "st"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: st 0.8.4-1 (Tue 29 Jun 2021 02:21:13 AM IST)

Offline

#4 2021-06-28 21:00:34

seth
Member
Registered: 2012-09-03
Posts: 51,299

Re: [SOLVED] Clueless on how to patch Simple Terminal from AUR

/home/shivodit/st/pkg/st/usr/bin - that's the build directory - you still have to install the package w/ "pacman -U" or use "makepkg -ie" to (maintain the patched files and) have makepkg call pacman for you.

Offline

#5 2021-06-28 21:09:32

HotDogEnemy
Member
Registered: 2020-11-24
Posts: 72

Re: [SOLVED] Clueless on how to patch Simple Terminal from AUR

Got it, makepkg -ie installed st. However it doesn't seem to be using the patches, I applied scrollback and gruvbox theme. Neither of them works - shift+pgup doesn't scroll up, and the theme is still like the default suckless theme.

Last edited by HotDogEnemy (2021-06-28 21:12:35)

Offline

#6 2021-06-28 22:25:36

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [SOLVED] Clueless on how to patch Simple Terminal from AUR

can't find file to patch at input line 5

You're applying the patch incorrectly, without stripping the directory first.

The following should work:

for patch in st-gruvbox-dark-0.8.2.diff st-scrollback-0.8.4.diff; do
  echo "Applying patch $patch..."
  patch --directory="$_sourcedir" --strip=1 < "$patch"
done

Tested locally.

Edit: See wiki here: https://wiki.archlinux.org/title/Patchi … ng_patches

Last edited by thiagowfx (2021-06-29 17:28:09)

Offline

#7 2021-06-29 05:21:10

HotDogEnemy
Member
Registered: 2020-11-24
Posts: 72

Re: [SOLVED] Clueless on how to patch Simple Terminal from AUR

thiagowfx wrote:
can't find file to patch at input line 5

You're applying the patch incorrectly, without stripping the directory first.

The following should work:

for patch in st-gruvbox-dark-0.8.2.diff st-scrollback-0.8.4.diff; do
  echo "Applying patch $patch..."
  patch --directory="$_sourcedir" --strip=1 < "$patch"
done

Tested locally.

This worked, both gruvbox and scollback now work properly.
Thank you everyone for the help!

Offline

#8 2021-06-29 06:39:31

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,868
Website

Re: [SOLVED] Clueless on how to patch Simple Terminal from AUR

Mod note: Moving to AUR Issues.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB