The first case would make me do that step everytime I need to update something, I would like to automate it.
Why? you just modify the patched `config.h` to your liking and then run `makepkg` to update the package. (you still need to update the md5sum of config.h, but given that you're creating the file (and not sharing it), it is OK to just put SKIP, or just run `makepg -g`)
Or do you mean upstream changes? In that case you still need to do manual work to update the PKGBUILD.
Edit: a word
]]>I guess you can just add your already patched `config.h` to the source array (not the unpatched `config.h`) and forget about `config.def.h`. Or you can create another patch with your settings and apply it after copying the auto-generated config file. Maybe there are other ideas...
The first case would make me do that step everytime I need to update something, I would like to automate it. The second case it's the same, the new patch of my config file wouldn't see the new settings from the patches. Correct me if I'm wrong.
]]>Also, make sure to quote $srcdir. And there's no need to copy the patches from $srcdir before calling patch just do
patch -Np1 -i "$srcdir/st-no_bold_colors-$pkgver.diff"
...
Here is my current PKGBUILD file:
pkgname=st
pkgver=0.8.1
pkgrel=1
pkgdesc='A simple virtual terminal emulator for X.'
arch=('i686' 'x86_64')
license=('MIT')
depends=('libxft' 'libxext' 'xorg-fonts-misc')
makedepends=('ncurses')
url="http://st.suckless.org"
source=(http://dl.suckless.org/st/$pkgname-$pkgver.tar.gz
#config.h
https://st.suckless.org/patches/hidecursor/st-hidecursor-$pkgver.diff
#https://st.suckless.org/patches/alpha/st-alpha-$pkgver.diff
https://st.suckless.org/patches/clipboard/st-clipboard-$pkgver.diff
https://st.suckless.org/patches/solarized/st-no_bold_colors-$pkgver.diff
https://st.suckless.org/patches/solarized/st-solarized-both-$pkgver.diff
)
prepare() {
cd $srcdir/$pkgname-$pkgver
# skip terminfo which conflicts with nsurses
sed -i '/tic /d' Makefile
# Moving source patch files
#cp $srcdir/st-alpha-0.8.1.diff st-alpha-0.8.1.diff
cp $srcdir/st-hidecursor-$pkgver.diff st-hidecursor-$pkgver.diff
cp $srcdir/st-clipboard-$pkgver.diff st-clipboard-$pkgver.diff
cp $srcdir/st-no_bold_colors-$pkgver.diff st-no_bold_colors-$pkgver.diff
cp $srcdir/st-solarized-both-$pkgver.diff st-solarized-both-$pkgver.diff
# Applying patches
patch -Np1 -i st-no_bold_colors-$pkgver.diff
patch -Np1 -i st-solarized-both-$pkgver.diff
patch -Np1 -i st-clipboard-$pkgver.diff
patch -Np1 -i st-hidecursor-$pkgver.diff
#patch -Np1 -i st-alpha-0.8.1.diff
# Creating the config.h file
cp config.def.h config.h
# Here I would like to do something like:
# Mergefiles() $srcdir/config.h config.h (to merge my config.h with the one just copied)
}
build() {
cd $srcdir/$pkgname-$pkgver
make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11
}
package() {
cd $srcdir/$pkgname-$pkgver
make PREFIX=/usr DESTDIR="$pkgdir" TERMINFO="$pkgdir/usr/share/terminfo" install
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
install -Dm644 README "$pkgdir/usr/share/doc/$pkgname/README"
}
md5sums=('92135aecdba29300bb2e274a55f5b71e'
'7b6f4a1efe7987b8f5554b4ec16082f9'
'd7295edae3ff61b93e9f875f6eaaad7a'
'5f0f925b00b5c71a3ffc03edaf8591ed'
'5bcc5c2d58bb71d2c7c258b3907ecc6d')