DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 14th November 2014
Oficre_josef Oficre_josef is offline
Port Guard
 
Join Date: Nov 2014
Posts: 26
Default dwm patching

Hi.
Can someone tell me, how exactly should i patch the dwm?
Is it means that i need to download source and compile/patch it manually (not from the ports), or i can do this from port?
I see patches directory in /usr/ports/x11/dwm/ but is it correct to add something in a port tree?
Reply With Quote
  #2   (View Single Post)  
Old 14th November 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,052
Default

Generally, customizations should be done starting with the port.
  • The hard work of determining dependencies and OpenBSD-specific provisioning has already been done for you. This makes it far easier for you to begin any patches of your own, or provisioning changes to how the port builds.
  • Your local customization may be useful to other OpenBSD users. If you wish to, you may contribute your customizations back to the port's $MAINTAINER as a $FLAVOR, or as an enhancement to the port.
Edited to add:

Best practice is to copy ports you are modifying from the tree into /usr/ports/mystuff.... which keeps your own developments separate from production branches. This same branch can be used for new port development.

Last edited by jggimi; 14th November 2014 at 08:38 PM. Reason: addition
Reply With Quote
  #3   (View Single Post)  
Old 14th November 2014
Oficre_josef Oficre_josef is offline
Port Guard
 
Join Date: Nov 2014
Posts: 26
Default

I got it, thank you a lot.
Reply With Quote
  #4   (View Single Post)  
Old 14th November 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 662
Default

In FreeBSD, I create the patch and then put it in /usr/ports/x11-dwm/files. I don't know how it works in OpenBSD. To get your custom config do you do something like make DWM_CONF=$HOME/dwm/config.h install clean or something like that?

In FreeBSD, the manual way to do it would be (I'm going into this detail making an assumption which is quite possibly wrong, that it's more or less similar)

Code:
make DWM_CONF=/home/scottro/config.h extract
Then, I go and patch dwm.c (or whatever file is being patched. Then, back to /usr/ports/x11-wm/dwm and make install clean.

As I tend to tweak my config.h a lot while first installing on a particular machine, what I do in practice is patch dwm.c the first time--as the patch that I like is the moveresize patch with the option to make a window being moved automatically a floating window. I now have a patch, patch-dwm.c which I put, as mentioned, under files (which is the canonical place in FreeBSD if you have a patch to a port. Canonical place? Is that a thing? I digress...)

Anyway, now I can keep tweaking my config.h, doing make deinstall make DWM_CONF=/home/scottro/dwm/config.h install clean without worrying anymore about having to manually install the patch.

Again, I don't know how it's done with OpenBSD ports but maybe this has helped.
Meh, might as well spam my own dwm page while at it, http://srobb.net/dwm.html

(And I have one for spectrwm now too, http://srobb.net/spectrwm.html
Reply With Quote
  #5   (View Single Post)  
Old 14th November 2014
Oficre_josef Oficre_josef is offline
Port Guard
 
Join Date: Nov 2014
Posts: 26
Default

Hm, maybe i misunderstood u, if i just put my patches in patches directory, will they apply automatically when i run "make install" ?
Cuz seems its not works that way

If not, maybe i should try Scottro's method..
Reply With Quote
  #6   (View Single Post)  
Old 14th November 2014
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

Quote:
Originally Posted by Oficre_josef View Post
Hm, maybe i misunderstood u, if i just put my patches in patches directory, will they apply automatically when i run "make install" ?
Cuz seems its not works that way

If not, maybe i should try Scottro's method..
Try this:
Code:
$ cd /usr/ports/x11/dwm
$ make patch
$ cd `make show=WRKDIST`
<edit whatever you want to your heart's content>
$ cd -
$ make install
Reply With Quote
  #7   (View Single Post)  
Old 15th November 2014
Oficre_josef Oficre_josef is offline
Port Guard
 
Join Date: Nov 2014
Posts: 26
Default

Quote:
Originally Posted by ibara View Post
Try this:
Code:
$ cd /usr/ports/x11/dwm
$ make patch
$ cd `make show=WRKDIST`
<edit whatever you want to your heart's content>
$ cd -
$ make install
Hmm, after "make patch" system asking me what file to patch...There is nothing about this in ports guide.

Code:
diff -r 406003e3a01f dwm.c
--- a/dwm.c     Mon Sep 27 07:53:44 2010 +0000
+++ b/dwm.c     Wed Oct 13 21:16:04 2010 +0300
@@ -36,6 +36,7 @@
 #include <X11/Xlib.h>
 #include <X11/Xproto.h>
 #include <X11/Xutil.h>
+#include <X11/XKBlib.h>
 #ifdef XINERAMA
 #include <X11/extensions/Xinerama.h>
 #endif /* XINERAMA */
@@ -93,6 +94,7 @@
        Client *snext;
        Monitor *mon;
        Window win;
+       unsigned char kbdgrp;
 };
there is one of the patches header.

I know that is possible to go in source dir and patch manually, but .. why make patch asking me something
Reply With Quote
  #8   (View Single Post)  
Old 15th November 2014
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

Quote:
Originally Posted by Oficre_josef View Post
Hmm, after "make patch" system asking me what file to patch...There is nothing about this in ports guide.
Did you forget to run `make clean`?
Your dwm port is NOT in the state you got it from CVS. That part is obvious. Don't even bother trying to walk me through undoing your steps. Just blow it away and start fresh.
Code:
$ cd /usr/ports/x11/dwm
$ make clean
$ cd ..
$ rm -r dwm
$ cvs up -Pd dwm
Then start over with my instructions.
Reply With Quote
  #9   (View Single Post)  
Old 15th November 2014
Oficre_josef Oficre_josef is offline
Port Guard
 
Join Date: Nov 2014
Posts: 26
Default

Quote:
Originally Posted by ibara View Post
Did you forget to run `make clean`?
Yes, i did it..

Quote:
Originally Posted by ibara View Post
Your dwm port is NOT in the state you got it from CVS.
Hm, its because i've added my patch files in /usr/ports/x11/dwm/patches/ directory. IS it incorrect?
Reply With Quote
Old 15th November 2014
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

Quote:
Originally Posted by Oficre_josef View Post
Hm, its because i've added my patch files in /usr/ports/x11/dwm/patches/ directory. IS it incorrect?
Don't manually add patches to patches/
If you're dead set on adding patches, you need to do it with make update-patches.
But if you don't understand what you're doing, don't do it. Just edit the files between your make patch and make install stages like I already outlined.
Reply With Quote
Old 15th November 2014
Oficre_josef Oficre_josef is offline
Port Guard
 
Join Date: Nov 2014
Posts: 26
Default

Oh, it works now!
Ty a lot for your help
Reply With Quote
Old 5th August 2015
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 662
Default

Playing around with a netbook, and not feeling like playing with ports or reading, I made the nice discovery that dwm will just build on OpenBSD. In other words, downloaded the source code, made my changes to config.h and patched with a patch I like (to resize floating windows) ran make and it built.
So, for the lazy person, that's probably the easiest way.
I only dabble with OpenBSD, and custom configuring dwm would be the only reason I'd be using ports--otherwise, just about all of their defaults are fine for my needs.
Reply With Quote
Old 7th July 2016
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 662
Default

But a year later, that no longer seems to work. :-( . Getting errors on the build (from dwm's source). Just posting this as it's one of the first hits that came up when I googled dwm and OpenBSD.


However, using Brian's method works perfectly. I can customize my config.h there, and I could patch dwm.c if I wanted. (I didn't bother because on a laptop, I don't need the dwm move resize patch very often.)

Last edited by scottro; 7th July 2016 at 01:35 PM.
Reply With Quote
Old 28th April 2022
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 662
Default

Several years later, I'm updating this because it is one of the first hits for dwm openbsd.

There is now a port for dwm-6.2, which is behind FreeBSD and most versions of Linux. I use the moveresize patch and just download a diff, called something like dwm-moveresize<date>.diff. I rename it to patch-moveresize and put in the patches directory. I then run make patch. Because (I think) the diff has things like a/config.def.h b/config.def it will ask file to patch, but it gives me the lines running up to that, so it's simple to type config.def.h and dwm.c when asked for the file name.
I then do as Brian says and
Code:
cd `make show=WRKDIST`
This lets me see the various files, including config.def.h which I can edit if I wish, or I can put in my already customized config.h.

Then (again) as Brian instructs) cd -;make install

Most people know all this stuff, but for newcomers who hit it on a web search I'll mention that if you already have a config.h you use and just want the moveresize patch for dwm.c, you can edit the diff file, remove the config.def.h stuff and also remove the a/ and b/ with the lines that have the a/dwm.c and b/dwm.c, and it then should not need to ask file to patch.

Again, this is *years* after this was last posted to, but again, I came upon it in a web search, so figured I might as well update it. I have a fairly simple page about it at https://srobb.net/dwm.html

Just search for OpenBSD on the page and it briefly goes over Brian's instructions.
Reply With Quote
Old 29th April 2022
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

I don't think there's any technical reason why we're behind, so if you'd like to send an update patch, that would be welcome.
Reply With Quote
Old 29th April 2022
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

While I'm glad this is one of the first hits for 'dwm OpenBSD' I'm less glad about my unnecessary harshness in some of those replies. I may edit them to remove that edge, but not the content, since I want the content to continue to be useful for at least another 8 years!
Reply With Quote
Old 29th April 2022
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 662
Default

Sad to say, I'm not knowledgeable enough to update the version. There is really no big difference in 6.2 and 6.3. I'm not sure what harsh replies you're referring to, they all seem fairly decent to me. Unless you feel your own words were too harsh? (It happens as we age, trust me, I know . )

Anyway, it's all good and all still working well.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Security Staunch your Heartbleed patching: FreeBSD has a nasty credentials leak J65nko News 2 12th May 2014 06:40 PM
Kernel size: Why no change after patching? Greg_Morgan OpenBSD Installation and Upgrading 6 25th July 2010 08:38 PM
patching or updating ? dennky OpenBSD Installation and Upgrading 12 14th January 2010 07:17 PM


All times are GMT. The time now is 03:24 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick