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: 7,118
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: 606
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
QEX author
 
Join Date: Jan 2014
Posts: 751
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
QEX author
 
Join Date: Jan 2014
Posts: 751
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
QEX author
 
Join Date: Jan 2014
Posts: 751
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: 606
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: 606
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
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 06:57 AM.


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