You are not logged in.
Hi, I have two basic questions about compiling dwm.
I downloaded the package from the AUR using auracle
auracle download dwm This creates the directory ~/dwm, which contains the files config.h, dwm.desktop, dwm.install, and PKGBUILD.
I then built the package
makepkg -fi and then booted into my dwm system.
I'm now trying to incorporate a few patches and make edits to the config.h file, but I have a few questions:
(1) Which config.h should I be editing, as there are multiple in the ~/dwm directory?
In both ~/dwm and ~/dwm/src/dwm-6.1/, there are config.h files. In ~/dwm/src/dwm-6.1/ there's also the config.def.h (along with dwm.c and other source files).
If I edit ~/dwm/config.h (to change a keybinding for example), and recompile, then the changes are incorporated when I reboot dwm.
makepkg -g >> PKGBUILD
makepkg -fiHowever, when I try to incorporate a patch (for example, dwm-bottomstack-6.1.diff), I'm required to go to ~/dwm/src/dwm-6.1/ and run the following
[10:45:03] [dwm-6.1] : patch -p1 < ../../patches/dwm-bottomstack-6.1.diff
patching file config.def.h
patching file dwm.c
[10:49:17] [dwm-6.1] : cp config.def.h ../../config.h
[10:49:17] [dwm-6.1] : cd ../../
[10:49:34] [dwm] : makepkg -g >> PKGBUILD
==> Retrieving sources...
-> Found dwm-6.1.tar.gz
-> Found config.h
-> Found dwm.desktop
==> Generating checksums for source files...
[10:49:39] [dwm] : makepkg-fi
bash: makepkg-fi: command not found
[10:49:44] [dwm] : makepkg -fi
==> Making package: dwm 6.1-3 (Mon 24 Dec 2018 10:49:47 AM GMT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found dwm-6.1.tar.gz
-> Found config.h
-> Found dwm.desktop
==> Validating source files with md5sums...
dwm-6.1.tar.gz ... Passed
config.h ... Passed
dwm.desktop ... Passed
==> Extracting sources...
-> Extracting dwm-6.1.tar.gz with bsdtar
==> Starting prepare()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
dwm build options:
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/include/X11 -I/usr/include/freetype2 -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION="6.1" -DXINERAMA
LDFLAGS = -s -L/usr/lib/X11 -lX11 -lXinerama -lfontconfig -lXft
CC = cc
CC drw.c
In file included from /usr/include/bits/libc-header-start.h:33,
from /usr/include/stdio.h:27,
from drw.c:2:
/usr/include/features.h:184:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
^~~~~~~
CC dwm.c
In file included from /usr/include/errno.h:25,
from dwm.c:23:
/usr/include/features.h:184:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
^~~~~~~
In file included from dwm.c:271:
config.h:42:16: error: ‘bstack’ undeclared here (not in a function); did you mean ‘restack’?
{ "TTT", bstack },
^~~~~~
restack
config.h:43:16: error: ‘bstackhoriz’ undeclared here (not in a function)
{ "===", bstackhoriz },
^~~~~~~~~~~
make: *** [Makefile:19: dwm.o] Error 1
==> ERROR: A failure occurred in build().
Aborting...
[10:49:47] [dwm] : (2) Most patches seem to edit the original dwm.c and config.def.h files. So when I run subsequent patches, the line numbering might be off. If I want to manually incorporate patches, should I edit the files in ~/dwm/src/dwm-6.1?
I tried manually incorporating a patch, and I edited ~/dwm/src/dwm-6.1/dwm.c and ~/dwm/config.h, but when ran makepkg it gave me errors: it reported that the functions in config.h were undeclared, just like in the error messages above. For some reason the changes I manually did to dwm.c were removed during the build process. I think this issue is the exact same as above, I think I'm editing the wrong files.
Thanks very much, and I hope this is clear. Please let me know if you need any clarification.
EDIT: I should say that I have read the wiki and searched previous posts on this forum, but these just say to edit "config.h" without clarifying which directory they are referring to. I'm sure I'm making a silly oversight here, which is why the wiki and other posts don't even bother clarifying. It probably also depends on how people download dwm, as some others seem to use git clone.
Also, here is my PKGBUILD in ~/dwm
[10:52:39] [dwm] : cat PKGBUILD
# $Id$
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Dag Odenhall <dag.odenhall@gmail.com>
# Contributor: Grigorios Bouzakis <grbzks@gmail.com>
pkgname=dwm
pkgver=6.1
pkgrel=3
pkgdesc="A dynamic window manager for X"
url="http://dwm.suckless.org"
arch=('i686' 'x86_64')
license=('MIT')
options=(zipman)
depends=('libx11' 'libxinerama' 'libxft' 'freetype2' 'st' 'dmenu')
install=dwm.install
source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
config.h
dwm.desktop)
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'80c4ef2a3eca0fe2d14e2203e3833200'
'939f403a71b6e85261d09fc3412269ee')
prepare() {
cd $srcdir/$pkgname-$pkgver
cp $srcdir/config.h config.h
}
build() {
cd $srcdir/$pkgname-$pkgver
make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11 FREETYPEINC=/usr/include/freetype2
}
package() {
cd $srcdir/$pkgname-$pkgver
make PREFIX=/usr DESTDIR=$pkgdir install
install -m644 -D LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
install -m644 -D README $pkgdir/usr/share/doc/$pkgname/README
install -m644 -D $srcdir/dwm.desktop $pkgdir/usr/share/xsessions/dwm.desktop
}
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'8310c4f4b09c0cec070d901548c69d7c'
'939f403a71b6e85261d09fc3412269ee')
[10:52:42] [dwm] : Last edited by roisoleil (2018-12-28 04:58:17)
Offline
When you used makepkg -fi, you overwrote the patches you manually did.
If you are going to edit the extracted sources, you need to do it like this:
makepkg --nobuild
# edit sources by hand
makepkg --noextract(Or modify the PKGBUILD to apply your patches in a repeatable way. I believe most dwm users will fork the PKGBUILD in order to package their specific modifications -- this is what happens with software that is "supposed" to be customized differently by every user even before building the source code.)
I cannot say more as I've never used dwm.
Last edited by eschwartz (2018-12-24 18:07:16)
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
I have no idea why there are "multiple" config.h in your directory: there should be config.def.h and config.h (which should be identical).
If you are using a PKGBUILD, use the patch function in prepare().
Offline
To expand on eschwartz's answer, your suspicions are correct: the source files you're editing are being overwritten. Check out the prepare() step in your PKGBUILD -- that's where it's happening. The -e or -noextract option just skips that step, building with whatever is already there.
If you want your changes to be referenced later or contributed back, it's a good idea to either edit the existing patch or create a new one and apply it in the prepare() step. (Note that in this PKGBUILD they're just using cp instead of patch.)
Offline
Thanks so much for the quick responses. I really appreciate it.
I have no idea why there are "multiple" config.h in your directory: there should be config.def.h and config.h (which should be identical).
I simply downloaded dwm from the AUR, and then did makepkg -fi
After this initial installation, I end up with ~/dwm/config.h, ~/dwm/src/dwm-6.1/config.h, ~/dwm/src/dwm-6.1/config.def.h. This is before I patched or edited any files, just a clean install. I am not sure how I am supposed to have done this differently. These are the steps suggested in the wiki: (1) download dwm from AUR and (2) build/install the package.
At this point, the PKGBUILD is located in ~/dwm, so I can't build the package using makepkg while in the directory ~/dwm/src/dwm-6.1.
If you are using a PKGBUILD, use the patch function in prepare()
(Or modify the PKGBUILD to apply your patches in a repeatable way. I believe most dwm users will fork the PKGBUILD in order to package their specific modifications -- this is what happens with software that is "supposed" to be customized differently by every user even before building the source code.)
If you want your changes to be referenced later or contributed back, it's a good idea to either edit the existing patch or create a new one and apply it in the prepare() step. (Note that in this PKGBUILD they're just using cp instead of patch.)
So, for example, if I'd like to install four patches, would I include them as follows in the PKGBUILD? The patches all edit ~/dwm/src/dwm-6.1/config.h.def and ~/dwm/src/dwm-6.1/dwm.c. Do I then need to copy the config.h.def file to ~/dwm/src/dwm-6.1/config.h and ~/dwm/config.h (or just one of them)?
[10:52:39] [dwm] : cat PKGBUILD
# $Id$
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Dag Odenhall <dag.odenhall@gmail.com>
# Contributor: Grigorios Bouzakis <grbzks@gmail.com>
pkgname=dwm
pkgver=6.1
pkgrel=3
pkgdesc="A dynamic window manager for X"
url="http://dwm.suckless.org"
arch=('i686' 'x86_64')
license=('MIT')
options=(zipman)
depends=('libx11' 'libxinerama' 'libxft' 'freetype2' 'st' 'dmenu')
install=dwm.install
source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
config.h
dwm.desktop)
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'80c4ef2a3eca0fe2d14e2203e3833200'
'939f403a71b6e85261d09fc3412269ee')
prepare() {
patch -p1 < /patches/dwm-bottomstack-6.1.diff
patch -p1 < /patches/dwm-6.1-systray.diff
patch -p1 < /patches/dwm-fancybar-6.1.diff
patch -p1 < /patches/dwm-uselessgap-6.1.diff
cd $srcdir/$pkgname-$pkgver
cp $srcdir/config.h config.h
}
build() {
cd $srcdir/$pkgname-$pkgver
make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11 FREETYPEINC=/usr/include/freetype2
}
package() {
cd $srcdir/$pkgname-$pkgver
make PREFIX=/usr DESTDIR=$pkgdir install
install -m644 -D LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
install -m644 -D README $pkgdir/usr/share/doc/$pkgname/README
install -m644 -D $srcdir/dwm.desktop $pkgdir/usr/share/xsessions/dwm.desktop
}
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'8310c4f4b09c0cec070d901548c69d7c'
'939f403a71b6e85261d09fc3412269ee')I'm a little confused about this step in the prepare: cp $srcdir/config.h config.h. It seems like the patches will edit config.h.def, so I would think that I'd need to copy this file over to config.h? I still don't have it clear how I will keep version control if I also, for instance, need to make some manual edits to the keybindings.
Last edited by roisoleil (2018-12-24 19:15:37)
Offline
I would guess you'd need to both add the patch(es) and modify your config.h to correspond to the patches you are adding.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
From looking at the .diff patch files, they all seem to edit both the config.h.def and dwm.c files. So if I understand correctly, I shouldn't have to manually edit the config.h.def file when incorporating these patches. Instead, I would just need to edit the config file if I wanted to manually change something like a keybinding, or the behavior of a particular window, etc. (i.e., not related to the patches)
Would one solution be to delete the lines in the patches that relate to config.h.def and just leave the ones that edit dwm.c, and then manually change the config file? That seems like the simplest solution to keep version control. I don't want to have to keep copying over the default file with new lines from patches, since that would mean I would have to reintroduce any changes I made manually unless I'm missing something?
Finally, if I do include the patches in the prepare() of the PKGBUILD, do I still then run the following commands?
makepkg -g >> PKGBUILD
makepkg -fiI am still a bit confused about the two config.h files and the config.h.def. Once the patches change the .h.def file, do I need to copy it over to the config.h in ~/dwm or ~/dwm/src/dwm-6.1? And if I did manually edit something, then the -fi would reverse my changes wouldn't it (as described above)?
In short, I'm confused about the work flow to incorporate patches and/or edit config.h and to recompile in a logical manner.
Last edited by roisoleil (2018-12-24 19:24:25)
Offline
A lot of your questions would be addressed with a better understanding of the makepkg workflow, which is pretty well summarized here[1]. The idea is that the files in your repository (PKGBUILD, .SRCINFO, any patches) are all you need to package and install the software. One of the first steps is downloading the tarred source from a trusted host (the suckless.org url in your PKGBUILD) and extracting it. So if you make changes to the source code, they'll be overwritten when this step is performed again.
Offline
There are many ways to skin the cat. You seem to be doing a variety of methods and that flow won't work.
1. Use makepkg without editing pkgbuild (eschwartz)
makepkg --nobuild
# edit sources by hand
makepkg --noextract
2. Use makepkg with an edited pkgbuild (jasonwryan)
add patch filename to the source()
then add patch commands to prepare()
3. Make it yourself in a live codebase
Grab all content in your src/dwm-6.1
This is the core files to build your dwm
now you can manually patch the code or patch diffs into them
then make && sudo make clean install
Hope this adds clarity
Offline
suckless tools conditionally "build" config.h from config.def.h during the make.
Your (modified as well) PKGBUILD spoils this with the
cd $srcdir/$pkgname-$pkgver
cp $srcdir/config.h config.hinstructions in the prepare() step - incorporating the config.h shipped w/ the package.
So either bring your patches and drop that copy XOR copy your own static config.h instead (overriding the default config.def.h and replacing the config.h provided by the package)
Offline
I second crmullins point: your confusion stems from not knowing how makepkg works.
The config.h that ships with dwm is an example file. When you run makepkg, that directory is not referenced by make, which is why in the prepare() function it has to be copied to $pkgname-$pkgver.
It is the files in that directory (dwm.c and config.h) that dwm is built from. So, you want to switch to that directory and then apply any patches in prepare() - including any changes to config.h not included in the respective patches.
Offline
I read the arch page on PKGBUILD and then followed the patching instructions from the Arch wiki exactly: https://wiki.archlinux.org/index.php/Patching_packages
I tried to incorporate the patches into the PKGBUILD in four steps: (1) added entries for three patches to the source array; (2) updated the md5sums array (updpkgsums); (3) added the patch commands to the prepare() function; the first line is still the cd to the $srcdir/$pkgname-$pkgver directory; and (4) ran makepkg -fi.
Here is my PKGBUILD
# $Id$
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Dag Odenhall <dag.odenhall@gmail.com>
# Contributor: Grigorios Bouzakis <grbzks@gmail.com>
pkgname=dwm
pkgver=6.1
pkgrel=3
pkgdesc="A dynamic window manager for X"
url="http://dwm.suckless.org"
arch=('i686' 'x86_64')
license=('MIT')
options=(zipman)
depends=('libx11' 'libxinerama' 'libxft' 'freetype2' 'st' 'dmenu')
install=dwm.install
source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
https://dwm.suckless.org/patches/bottomstack/dwm-bottomstack-$pkgver.diff
https://dwm.suckless.org/patches/systray/dwm-$pkgver-systray.diff
https://dwm.suckless.org/patches/uselessgap/dwm-uselessgap-$pkgver.diff
config.h
dwm.desktop)
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'14b03ce4f39b4d5f2d52302c172b3617'
'd1dfe1d57e2a3c338bba13c079156999'
'4f0b57c6b9331b0a90c97d9c14944609'
'80c4ef2a3eca0fe2d14e2203e3833200'
'939f403a71b6e85261d09fc3412269ee')
prepare() {
cd $srcdir/$pkgname-$pkgver
cp $srcdir/config.h config.h
patch -Np1 -i "${srcdir}/dwm-$pkgver-systray.diff"
patch -Np1 -i "${srcdir}/dwm-bottomstack-$pkgver.diff"
patch -Np1 -i "${srcdir}/dwm-uselessgap-$pkgver.diff"
}
build() {
cd $srcdir/$pkgname-$pkgver
make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11 FREETYPEINC=/usr/include/freetype2
}
package() {
cd $srcdir/$pkgname-$pkgver
make PREFIX=/usr DESTDIR=$pkgdir install
install -m644 -D LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
install -m644 -D README $pkgdir/usr/share/doc/$pkgname/README
install -m644 -D $srcdir/dwm.desktop $pkgdir/usr/share/xsessions/dwm.desktop
}
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'14b03ce4f39b4d5f2d52302c172b3617'
'd1dfe1d57e2a3c338bba13c079156999'
'4f0b57c6b9331b0a90c97d9c14944609'
'80c4ef2a3eca0fe2d14e2203e3833200'
'939f403a71b6e85261d09fc3412269ee')
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'14b03ce4f39b4d5f2d52302c172b3617'
'd1dfe1d57e2a3c338bba13c079156999'
'4f0b57c6b9331b0a90c97d9c14944609'
'80c4ef2a3eca0fe2d14e2203e3833200'
'939f403a71b6e85261d09fc3412269ee')The patches seem to be applied correctly but the build function fails:
[11:49:32] [dwm] : makepkg -g >> PKGBUILD
==> Retrieving sources...
-> Found dwm-6.1.tar.gz
-> Found dwm-bottomstack-6.1.diff
-> Found dwm-6.1-systray.diff
-> Found dwm-uselessgap-6.1.diff
-> Found config.h
-> Found dwm.desktop
==> Generating checksums for source files...
[11:49:38] [dwm] : makepkg -fi
==> Making package: dwm 6.1-3 (Wed 26 Dec 2018 11:49:40 PM GMT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found dwm-6.1.tar.gz
-> Found dwm-bottomstack-6.1.diff
-> Found dwm-6.1-systray.diff
-> Found dwm-uselessgap-6.1.diff
-> Found config.h
-> Found dwm.desktop
==> Validating source files with md5sums...
dwm-6.1.tar.gz ... Passed
dwm-bottomstack-6.1.diff ... Passed
dwm-6.1-systray.diff ... Passed
dwm-uselessgap-6.1.diff ... Passed
config.h ... Passed
dwm.desktop ... Passed
==> Extracting sources...
-> Extracting dwm-6.1.tar.gz with bsdtar
==> Starting prepare()...
patching file config.def.h
patching file dwm.c
patching file config.def.h
Hunk #1 succeeded at 43 (offset 4 lines).
Hunk #2 succeeded at 80 (offset 4 lines).
patching file dwm.c
Hunk #1 succeeded at 267 with fuzz 1 (offset 34 lines).
Hunk #2 succeeded at 2478 (offset 337 lines).
patching file dwm.c
Hunk #2 succeeded at 1443 (offset 150 lines).
==> Removing existing $pkgdir/ directory...
==> Starting build()...
dwm build options:
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/include/X11 -I/usr/include/freetype2 -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION="6.1" -DXINERAMA
LDFLAGS = -s -L/usr/lib/X11 -lX11 -lXinerama -lfontconfig -lXft
CC = cc
CC drw.c
In file included from /usr/include/bits/libc-header-start.h:33,
from /usr/include/stdio.h:27,
from drw.c:2:
/usr/include/features.h:184:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
^~~~~~~
CC dwm.c
In file included from /usr/include/errno.h:25,
from dwm.c:23:
/usr/include/features.h:184:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
^~~~~~~
dwm.c: In function ‘applysizehints’:
dwm.c:55:57: error: ‘gappx’ undeclared (first use in this function)
#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
^~~~~
dwm.c:363:14: note: in expansion of macro ‘WIDTH’
*x = sw - WIDTH(c);
^~~~~
dwm.c:55:57: note: each undeclared identifier is reported only once for each function it appears in
#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
^~~~~
dwm.c:363:14: note: in expansion of macro ‘WIDTH’
*x = sw - WIDTH(c);
^~~~~
dwm.c: In function ‘cleanup’:
dwm.c:521:6: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (showsystray) {
^~~~~~~~~~~
systray
dwm.c: In function ‘clientmessage’:
dwm.c:576:6: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (showsystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) {
^~~~~~~~~~~
systray
dwm.c: In function ‘configurerequest’:
dwm.c:55:57: error: ‘gappx’ undeclared (first use in this function)
#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
^~~~~
dwm.c:701:33: note: in expansion of macro ‘WIDTH’
c->x = m->mx + (m->mw / 2 - WIDTH(c) / 2); /* center in x direction */
^~~~~
dwm.c: In function ‘drawbar’:
dwm.c:825:7: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (showsystray && m == systraytomon(m)) {
^~~~~~~~~~~
systray
dwm.c: In function ‘getsystraywidth’:
dwm.c:1023:6: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (showsystray)
^~~~~~~~~~~
systray
dwm.c:1024:43: error: ‘systrayspacing’ undeclared (first use in this function); did you mean ‘systraytomon’?
for (i = systray->icons; i; w += i->w + systrayspacing, i = i->next);
^~~~~~~~~~~~~~
systraytomon
dwm.c:1024:57: warning: left-hand operand of comma expression has no effect [-Wunused-value]
for (i = systray->icons; i; w += i->w + systrayspacing, i = i->next);
^
dwm.c: In function ‘manage’:
dwm.c:55:57: error: ‘gappx’ undeclared (first use in this function)
#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
^~~~~
dwm.c:1169:13: note: in expansion of macro ‘WIDTH’
if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
^~~~~
dwm.c: In function ‘movemouse’:
dwm.c:55:57: error: ‘gappx’ undeclared (first use in this function)
#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
^~~~~
dwm.c:1308:52: note: in expansion of macro ‘WIDTH’
else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap)
^~~~~
dwm.c: In function ‘removesystrayicon’:
dwm.c:1418:7: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (!showsystray || !i)
^~~~~~~~~~~
systray
dwm.c: In function ‘resizebarwin’:
dwm.c:1437:6: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (showsystray && m == systraytomon(m))
^~~~~~~~~~~
systray
dwm.c: In function ‘resizeclient’:
dwm.c:1466:16: error: ‘gappx’ undeclared (first use in this function)
gapoffset = gappx;
^~~~~
dwm.c: In function ‘showhide’:
dwm.c:55:57: error: ‘gappx’ undeclared (first use in this function)
#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
^~~~~
dwm.c:1824:28: note: in expansion of macro ‘WIDTH’
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
^~~~~
dwm.c: In function ‘systraytomon’:
dwm.c:1856:7: error: ‘systraypinning’ undeclared (first use in this function); did you mean ‘systraytomon’?
if (!systraypinning) {
^~~~~~~~~~~~~~
systraytomon
dwm.c:1863:6: error: ‘systraypinningfailfirst’ undeclared (first use in this function)
if (systraypinningfailfirst && n < systraypinning)
^~~~~~~~~~~~~~~~~~~~~~~
dwm.c: In function ‘tile’:
dwm.c:56:57: error: ‘gappx’ undeclared (first use in this function)
#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx)
^~~~~
dwm.c:1904:10: note: in expansion of macro ‘HEIGHT’
my += HEIGHT(c);
^~~~~~
dwm.c: In function ‘togglebar’:
dwm.c:1918:6: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (showsystray) {
^~~~~~~~~~~
systray
dwm.c: In function ‘updatebars’:
dwm.c:2045:7: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (showsystray && m == systraytomon(m))
^~~~~~~~~~~
systray
dwm.c: In function ‘updatesystrayiconstate’:
dwm.c:2269:7: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (!showsystray || !i || ev->atom != xatom[XembedInfo] ||
^~~~~~~~~~~
systray
dwm.c: In function ‘updatesystray’:
dwm.c:2300:7: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (!showsystray)
^~~~~~~~~~~
systray
dwm.c:2332:8: error: ‘systrayspacing’ undeclared (first use in this function); did you mean ‘systraytomon’?
w += systrayspacing;
^~~~~~~~~~~~~~
systraytomon
dwm.c: In function ‘wintosystrayicon’:
dwm.c:2430:7: error: ‘showsystray’ undeclared (first use in this function); did you mean ‘systray’?
if (!showsystray || !w)
^~~~~~~~~~~
systray
dwm.c: In function ‘bstack’:
dwm.c:55:57: error: ‘gappx’ undeclared (first use in this function)
#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
^~~~~
dwm.c:2528:10: note: in expansion of macro ‘WIDTH’
mx += WIDTH(c);
^~~~~
dwm.c: In function ‘bstackhoriz’:
dwm.c:55:57: error: ‘gappx’ undeclared (first use in this function)
#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
^~~~~
dwm.c:2559:10: note: in expansion of macro ‘WIDTH’
mx += WIDTH(c);
^~~~~
At top level:
dwm.c:2539:1: warning: ‘bstackhoriz’ defined but not used [-Wunused-function]
bstackhoriz(Monitor *m) {
^~~~~~~~~~~
dwm.c:2507:1: warning: ‘bstack’ defined but not used [-Wunused-function]
bstack(Monitor *m) {
^~~~~~
make: *** [Makefile:19: dwm.o] Error 1
==> ERROR: A failure occurred in build().
Aborting...I'm a bit at a loss for what's happening now. I believe it may have something to do with what seth said below about the cp line (which echos an earlier comment by crmullins). I tried changing the cp line in the prepare() function to "cp $srcdir/$pkgname-$pkgver/config.def.h config.h" and dropping the line altogether (to stick with current config.h), but neither approach worked.
suckless tools conditionally "build" config.h from config.def.h during the make.
Your (modified as well) PKGBUILD spoils this with thecd $srcdir/$pkgname-$pkgver cp $srcdir/config.h config.hinstructions in the prepare() step - incorporating the config.h shipped w/ the package.
So either bring your patches and drop that copy XOR copy your own static config.h instead (overriding the default config.def.h and replacing the config.h provided by the package)
(Note that in this PKGBUILD they're just using cp instead of patch.)
Could someone please point me in the right direction as to why this is failing?
Note: edited for typos.
Last edited by roisoleil (2018-12-27 05:14:14)
Offline
It's like the error says: you have defined bstack and bstackhoriz but not used them. Post the bstack patch and your patched config.h.
Offline
Here's the bstack patch (downloaded from suckless site)
diff --git a/config.def.h b/config.def.h
index 7054c06..554f1db 100644
--- a/config.def.h
+++ b/config.def.h
@@ -39,6 +39,8 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "TTT", bstack },
+ { "===", bstackhoriz },
};
/* key definitions */
@@ -74,6 +76,8 @@ static Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_u, setlayout, {.v = &layouts[3]} },
+ { MODKEY, XK_o, setlayout, {.v = &layouts[4]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index 0362114..c313b5e 100644
--- a/dwm.c
+++ b/dwm.c
@@ -233,6 +233,8 @@ static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg);
+static void bstack(Monitor *m);
+static void bstackhoriz(Monitor *m);
/* variables */
static const char broken[] = "broken";
@@ -2139,3 +2141,65 @@ main(int argc, char *argv[])
XCloseDisplay(dpy);
return EXIT_SUCCESS;
}
+
+static void
+bstack(Monitor *m) {
+ int w, h, mh, mx, tx, ty, tw;
+ unsigned int i, n;
+ Client *c;
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if (n == 0)
+ return;
+ if (n > m->nmaster) {
+ mh = m->nmaster ? m->mfact * m->wh : 0;
+ tw = m->ww / (n - m->nmaster);
+ ty = m->wy + mh;
+ } else {
+ mh = m->wh;
+ tw = m->ww;
+ ty = m->wy;
+ }
+ for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
+ if (i < m->nmaster) {
+ w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
+ resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
+ mx += WIDTH(c);
+ } else {
+ h = m->wh - mh;
+ resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->bw), 0);
+ if (tw != m->ww)
+ tx += WIDTH(c);
+ }
+ }
+}
+
+static void
+bstackhoriz(Monitor *m) {
+ int w, mh, mx, tx, ty, th;
+ unsigned int i, n;
+ Client *c;
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if (n == 0)
+ return;
+ if (n > m->nmaster) {
+ mh = m->nmaster ? m->mfact * m->wh : 0;
+ th = (m->wh - mh) / (n - m->nmaster);
+ ty = m->wy + mh;
+ } else {
+ th = mh = m->wh;
+ ty = m->wy;
+ }
+ for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
+ if (i < m->nmaster) {
+ w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
+ resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
+ mx += WIDTH(c);
+ } else {
+ resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0);
+ if (th != m->wh)
+ ty += HEIGHT(c);
+ }
+ }
+}The patch adds the layouts and corresponding keybindings to the config.def.h (the other patches also edit config.def.h), which I why I thought copying the .def.h file to the config.h in the top directory might resolve the issue.
This points to the same question raised in some of my earlier posts which I still don't have entirely clear to me even after reading your comments and the wiki. How to do I keep the changes to the config.h (including any manual edits to keybindings) if the patches edit the original default config file? Am I better off removing the config.h.def edits in the patches and just manually making those changes to the config.h in the top directory (and then removing the cp line in the PKGBUILD)?
Offline
You can just copy the edited config.def.h somewhere and reuse as needed. A separate git branch makes that simple.
Was the bstack patch correctly applied to dwm.c?
FWIW, applying three patches at once is asking for trouble. Add them one at a time to determine what is failing...
Offline
Thanks for the continued input, Jason.
To incorporate the patches one by one, do i simply do makepkg -efi after the first patch has been added to avoid redownloading the original source code?
Do I need to do anything with this line in the PKGBUILD: cp $srcdir/config.h config.h? I want to make sure that any edits to the config.h in the ~/dwm directory are being picked up -- not $srcdir/$pkgname-$pkgver.
You can just copy the edited config.def.h somewhere and reuse as needed. A separate git branch makes that simple.
What do you mean exactly by a separate git branch here? I suspect it has something to do with what an earlier user referred to as "forking" the PKGBUILD. Sorry I don't have so much expertise with computers and programming, so I'm actually not sure what this means and a quick Google/wiki search didn't yield anything.
Last edited by roisoleil (2018-12-27 06:35:14)
Offline
The bstack patch affects config.def.h but that's not used as long as you copy some other config.h.
The other errors are not caused by the patch but some follow-up thing, yet may have the same cause (eg. gappx being added to config.def.h but not available because the other config.h is copied in place)
Paste your current PKGBUILD (w/o copying config.h, all patches and the build output)
Also make sure that if you're operating in an existing build tree, that there's no stale config.h from a former build in $srcdir/$pkgname-$pkgver before running makepkg.
Offline
The bstack patch affects config.def.h but that's not used as long as you copy some other config.h.
Yea, that makes sense. This is why I tried changing the cp line in the prepare() function to "cp $srcdir/$pkgname-$pkgver/config.def.h config.h" without any success. I'm probably still not entirely understanding the prepare/build process, even after reading the wiki.
Paste your current PKGBUILD (w/o copying config.h, all patches and the build output).
Here's the PKGBUILD as it currently stands.
# $Id$
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Dag Odenhall <dag.odenhall@gmail.com>
# Contributor: Grigorios Bouzakis <grbzks@gmail.com>
pkgname=dwm
pkgver=6.1
pkgrel=3
pkgdesc="A dynamic window manager for X"
url="http://dwm.suckless.org"
arch=('i686' 'x86_64')
license=('MIT')
options=(zipman)
depends=('libx11' 'libxinerama' 'libxft' 'freetype2' 'st' 'dmenu')
install=dwm.install
source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
https://dwm.suckless.org/patches/bottomstack/dwm-bottomstack-$pkgver.diff
https://dwm.suckless.org/patches/systray/dwm-$pkgver-systray.diff
https://dwm.suckless.org/patches/uselessgap/dwm-uselessgap-$pkgver.diff
config.h
dwm.desktop)
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'14b03ce4f39b4d5f2d52302c172b3617'
'd1dfe1d57e2a3c338bba13c079156999'
'4f0b57c6b9331b0a90c97d9c14944609'
'80c4ef2a3eca0fe2d14e2203e3833200'
'939f403a71b6e85261d09fc3412269ee')
prepare() {
cd $srcdir/$pkgname-$pkgver
patch -Np1 -i "${srcdir}/dwm-$pkgver-systray.diff"
patch -Np1 -i "${srcdir}/dwm-bottomstack-$pkgver.diff"
patch -Np1 -i "${srcdir}/dwm-uselessgap-$pkgver.diff"
cp $srcdir/$pkgname-$pkgver/config.def.h config.h
}
build() {
cd $srcdir/$pkgname-$pkgver
make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11 FREETYPEINC=/usr/include/freetype2
}
package() {
cd $srcdir/$pkgname-$pkgver
make PREFIX=/usr DESTDIR=$pkgdir install
install -m644 -D LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
install -m644 -D README $pkgdir/usr/share/doc/$pkgname/README
install -m644 -D $srcdir/dwm.desktop $pkgdir/usr/share/xsessions/dwm.desktop
}Also make sure that if you're operating in an existing build tree, that there's no stale config.h from a former build in $srcdir/$pkgname-$pkgver before running makepkg.
There are 3 config.h files in the dwm folders, as shown below. One in ~/dwm (It's actually ~/AUR/dwm, but just writing ~/dwm for simplicity sake), one in ~/dwm/src (which links to the config.h in ~/dwm), and one in ~/dwm/src/dwm-6.1 (where the config.h.def is also located). If I understood Jason correctly, only the one in ~/dwm matters. The config.h in /src/dwm-6.1 is just the example file that comes with fresh install. However, the patches edit the .def.h file as noted above.
Should I just delete the one in ~/dwm/src/dwm-6.1 since it's the template one and all the edits should be made to the ~/dwm/config.h file? Again, this is one my recurring confusions - why there are so many config.h files. And if patches make changes to the config.def.h file, then how would I incorporate those into an already edited config.h file unless I make the changes manually (which I'm fine doing)?
[12:10:01] [dwm] : tree
.
├── config.h
├── dwm-6.1-3-x86_64.pkg.tar.xz
├── dwm-6.1-systray.diff
├── dwm-6.1.tar.gz
├── dwm-bottomstack-6.1.diff
├── dwm.desktop
├── dwm.install
├── dwm-uselessgap-6.1.diff
├── pkg [error opening dir]
├── PKGBUILD
└── src
├── config.h -> /home/roisoleil/AUR/dwm/config.h
├── dwm-6.1
│ ├── BUGS
│ ├── config.def.h
│ ├── config.def.h.orig
│ ├── config.h
│ ├── config.mk
│ ├── drw.c
│ ├── drw.h
│ ├── drw.o
│ ├── dwm.1
│ ├── dwm.c
│ ├── dwm.c.orig
│ ├── dwm.png
│ ├── LICENSE
│ ├── Makefile
│ ├── README
│ ├── TODO
│ ├── transient.c
│ ├── util.c
│ └── util.h
├── dwm-6.1-systray.diff -> /home/roisoleil/AUR/dwm/dwm-6.1-systray.diff
├── dwm-6.1.tar.gz -> /home/roisoleil/AUR/dwm/dwm-6.1.tar.gz
├── dwm-bottomstack-6.1.diff -> /home/roisoleil/AUR/dwm/dwm-bottomstack-6.1.diff
├── dwm.desktop -> /home/roisoleil/AUR/dwm/dwm.desktop
└── dwm-uselessgap-6.1.diff -> /home/roisoleil/AUR/dwm/dwm-uselessgap-6.1.diff
3 directories, 34 filesEdit: Typos and clarifications
Last edited by roisoleil (2018-12-27 17:25:33)
Offline
No, you misunderstood. The config.def.h in src/dwm-6.1 is the file that make references for the build, thats why it is failing: you are copying the unpatched file into the builddir after the patches are applied, overwriting the good config.
Offline
Ok, so I tried the following PKGBUILD (with a single patch - bstack), in which I copy the config to the build directory prior to the patches being applied. It doesn't generate any errors.
# $Id$
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Dag Odenhall <dag.odenhall@gmail.com>
# Contributor: Grigorios Bouzakis <grbzks@gmail.com>
pkgname=dwm
pkgver=6.1
pkgrel=3
pkgdesc="A dynamic window manager for X"
url="http://dwm.suckless.org"
arch=('i686' 'x86_64')
license=('MIT')
options=(zipman)
depends=('libx11' 'libxinerama' 'libxft' 'freetype2' 'st' 'dmenu')
install=dwm.install
source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
https://dwm.suckless.org/patches/bottomstack/dwm-bottomstack-$pkgver.diff
config.h
dwm.desktop)
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'14b03ce4f39b4d5f2d52302c172b3617'
'80c4ef2a3eca0fe2d14e2203e3833200'
'939f403a71b6e85261d09fc3412269ee')
prepare() {
cd $srcdir/$pkgname-$pkgver
cp $srcdir/$pkgname-$pkgver/config.def.h config.h
patch -Np1 -i "${srcdir}/dwm-bottomstack-$pkgver.diff"
}
build() {
cd $srcdir/$pkgname-$pkgver
make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11 FREETYPEINC=/usr/include/freetype2
}
package() {
cd $srcdir/$pkgname-$pkgver
make PREFIX=/usr DESTDIR=$pkgdir install
install -m644 -D LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
install -m644 -D README $pkgdir/usr/share/doc/$pkgname/README
install -m644 -D $srcdir/dwm.desktop $pkgdir/usr/share/xsessions/dwm.desktop
}
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'14b03ce4f39b4d5f2d52302c172b3617'
'80c4ef2a3eca0fe2d14e2203e3833200'
'939f403a71b6e85261d09fc3412269ee')
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'14b03ce4f39b4d5f2d52302c172b3617'
'80c4ef2a3eca0fe2d14e2203e3833200'
'939f403a71b6e85261d09fc3412269ee')
md5sums=('f0b6b1093b7207f89c2a90b848c008ec'
'14b03ce4f39b4d5f2d52302c172b3617'
'80c4ef2a3eca0fe2d14e2203e3833200'
'939f403a71b6e85261d09fc3412269ee')However, after this compile, the edits to the config file can only be found in src/dwm-6.1/config.def.h, not in the config.h in the ~/dwm directory, which prevents me from using the new layouts. I also tried cp $srcdir/config.h config.h instead of the line above, but with the same outcome.
I'm obviously not understanding the cp line correctly: if I copy the config.def.h from the src/dwm-6.1 to the build directory and rename the file config.h, then why are the patches not found there?
Thanks for your patience with all these stupid questions.
Last edited by roisoleil (2018-12-27 18:07:28)
Offline
After the build, dwm is a binary: you don't care about the file in ~/dwm - it is merely a reference.
Offline
So do I then just copy the patched config.def.h somewhere (for example src/dwm-6.1/config.h) and edit manually? This is what you seemed to indicate in your comment #15 above.
Edit: In which case I still don't think I understand the point of this line: cp $srcdir/$pkgname-$pkgver/config.def.h config.h.
Indeed, Seth earlier indicated that I should be copying a static file, which I take to mean a config.h file in which I'm accumulating my manual edits.
suckless tools conditionally "build" config.h from config.def.h during the make.
Your (modified as well) PKGBUILD spoils this with thecd $srcdir/$pkgname-$pkgver
cp $srcdir/config.h config.hinstructions in the prepare() step - incorporating the config.h shipped w/ the package.
So either bring your patches and drop that copy XOR copy your own static config.h instead (overriding the default config.def.h and replacing the config.h provided by the package)
Last edited by roisoleil (2018-12-27 18:43:16)
Offline
If you are adding additional changes to the config (above and beyond what the patches include), you edit those manually prior to patching. Otherwise, just use the patched version.
Offline
Understood, so if I manually want to change keybindings, for instance, I will make those changes to the respective lines of config.h prior to patching.
Yet how come the bstack changes to the config.def.h file (new lines for the bstack layouts) are not found in the config.h if the config.def.h in src/dwm-6.1 is the file that make references for the build? The patch correctly changed the dwm.c and config.def.h files, but I'm not able to use the new layouts currently. (Note: I'm running (1) makepkg -g >> PKGBUILD and (2) makepkg-fi at the moment - I think this is correct?)
I also have three follow-up questions:
1) Once I get the bstack layout working, it will introduce new keybindings for me to switch to the bottom stack layouts (by default alt+o and alt+u). What if I want to change those keybindings to something different? Is the best option to change the patch diff file before even implementing the patch, or to manually make edits to the config.h afterwards? Or does it make no difference?
2) Let's say that once I've patched dwm with bstack, I want to introduce a new patch (useless gaps, for example). Do I just change the PKGBUILD to the new .diff file in the relevant places, run makpkg -g >> PKGBUILD, and and then makepkg -efi (with no extract option to avoid pulling the original source code and overwriting the bstack patch)?
3) Finally, when a new version of dwm comes out in which the source code might change a bit, how do you easily incorporate your existing patches and modifications into a new version?
Last edited by roisoleil (2018-12-27 19:14:19)
Offline
1. You make any manual changes after patching.
2. Eventually, you want to run makepkg once: the PKGBUILD is just a script to automate the build. For incremental patching, you'll need to alter the PKGBUILD between builds so as not to reapply already added patches.
3. dwm is pretty stable now: there hasn't been a release in three years. Keeping your changes in version control is the best way to manage releases when they happen.
Offline