DWM using pkgng

Anyone knows if its possible to build the ports version of DWM without having to install the whole ports tree?
I use FreeBSD on a desktop laptop and only using pkgng to install applications, but since you need to compile DWM to do changes I want to build it, but I don't want the have the whole ports tree installed.

Can I somehow get the official source from the dwm homepage and add the makefile special files from ports?
 
I suggest getting the whole tree, it's not like it's a huge amount of data. DWM may depend on other ports to build correctly.
 
To build ports, you're going to need a bunch of files and directories from the /usr/ports directory, like /usr/ports/Makefile and /usr/ports/Mk. Also, any ports that are needed as build dependencies, like those listed in the port's Makefile:
Code:
USE_XORG=       x11 xau xcb xdmcp xext
Not counting distfiles, the whole ports tree probably takes less than 1G. It would likely take less time to do a full checkout than try to figure out individual requires pieces. And of course you can delete it after building what you need.
 
There are patches in the port that it probably needs to build. But if you build it from raw source, you lose the best feature of ports and packages, the ability to cleanly deinstall them.
 
Okay, thanks for helping. It just felt a bit silly to install 1GB data for the smallest window manager ever :)
I try stick with fluxbox a bit longer before I decide.
 
If I remember correctly, I did try to build it from the tarball, more or less out of curiosity, and it didn't work.

There are a lot of warnings about mixing ports and packages, however, I suspect that many do mix them without too much trouble--for example, you could try installing the dependencies by package and then the window manager itself from ports. I would test it on a VM first though. I don't want to give dangerous advice, but all I can say is that when I've bitten by mixing the two, it hasn't been a very bad bite--more of a nip, I suppose. I assume you're aware that the x11-wm/dwm port gives the option to use your own config.h. (Although I did find that when I built it on FreeBSD, it was unable to work with the move resize patch that I use on Linux.)

For single monitor setups, it's my win of choice.
 
I just tried building from the source tarball and it worked for me. I just used the config.mk patch from the port as a guide. After changing a few lines I got a binary. As far as I can tell, the port only installs two files, the binary and a man page so if installing the ports tree really isn't an option I don't think you're losing all that much in this case. Don't tell anyone though, this might be considered heresy by some.
 
DemoDoG said:
Okay, thanks for helping. It just felt a bit silly to install 1GB data for the smallest window manager ever :)
Maybe I'm misunderstanding it but the ports tree is only a couple of K. If you use ZFS you can put it on a compressed dataset, taking up even less space (it's mainly text so it compresses quite good).

As for the dependencies, yes, you can install those using packages. As long as all the dependencies are met it should build fine. Mixing packages and ports are tricky but as long as you stick to mostly the default settings, it should work. The problems begin when a port starts depending on new or different dependencies due to the options chosen.
 
jrm said:
I just tried building from the source tarball and it worked for me. I just used the config.mk patch from the port as a guide. After changing a few lines I got a binary. As far as I can tell, the port only installs two files, the binary and a man page so if installing the ports tree really isn't an option I don't think you're losing all that much in this case. Don't tell anyone though, this might be considered heresy by some.

Nice, do you mind sharing the exakt things you did? Ofcourse it has to be able to change the confiuration and rebuild it later.
 
If you want to make some local change you can do this:
Code:
cd /usr/ports/x11-wm/dwm
make extract # this extracts the source in work directory
make patch # this applies any FreeBSD specific patches
You can now edit the sources inside the port's work directory. Once done you can continue with the port build, make all, make install etc.

Looking at the port's Makefile I see you can set DWM_CONF to a custom config.h. So if you already have one you can build the port like so: make DWM_CONF=/home/me/files/my_config.h all install. That should build the port using /home/me/files/my_config.h as config.h.
 
Perhaps ports-mgmt/porteasy will work for you? From the pkg-descr:

Porteasy lets you install ports and build packages without maintaining
a full ports tree. It achieves this by scanning the ports index for
dependency information, and using CVS to update only the ports you
requested and their dependencies.

CVS is mentioned, so it sounds a bit out of date ... But you can try.

SirDice said:
DemoDoG said:
Okay, thanks for helping. It just felt a bit silly to install 1GB data for the smallest window manager ever :)
Maybe I'm misunderstanding it but the ports tree is only a couple of K. If you use ZFS you can put it on a compressed dataset, taking up even less space (it's mainly text so it compresses quite good).

I think you misunderstood something?

Compressed as a .tar.gz it's slightly less than 50M:
ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports-current

However, when extracted, it's much larger, since your filesystem (probably) has a block size of 4k (meaning a minimal file size of 4k); many of the files in the ports tree are smaller than 4k.
According to freshports, there are 24532 ports. Assuming 4 files per ports (Makefile, distinfo, pkg-desc, pkg-plist) that gives us a *minimal* of 24532 * 4 * 4 / 1024 = 383M.
Many ports contain more files, and there are also many files larger than 4k. So something like >500M would be more realistic. You can do a du -hd0 /usr/ports to confirm this & get the exact size ;)
 
DemoDoG said:
Nice, do you mind sharing the exakt things you did? Ofcourse it has to be able to change the confiuration and rebuild it later.
Code:
git clone http://git.suckless.org/dwm dwm.git
I edited config.mk to have the contents below and ran make clean; make.
You could do make install, but since there are only two files (the binary dwm and the man page dwm.1), you could also copy them to where you want, ensuring they have the appropriate permissions. I prefer using the port as described by @SirDice above.
Code:
# dwm version
VERSION = 6.1

# Customize below to fit your system

# paths
PREFIX=/usr/local
MANPREFIX = ${PREFIX}/share/man

X11INC = ${PREFIX}/include
X11LIB = ${PREFIX}/lib

# Xinerama, comment if you don't want it
XINERAMALIBS  = -L${X11LIB} -lXinerama
XINERAMAFLAGS = -DXINERAMA

# Xft
XFTINCS = -I${X11INC}/freetype2
XFTLIBS = -L${X11LIB} -lXft

# includes and libs
INCS = -I. -I/usr/include -I${X11INC} ${XFTINCS}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS} ${XFTLIBS}

# flags
CPPFLAGS = -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
CFLAGS   = -std=c99 ${INCS} ${CPPFLAGS}
LDFLAGS  = ${LIBS}

# compiler and linker
CC = cc
 
Last edited by a moderator:
Back
Top