LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-06-2007, 05:36 AM   #1
Grife
Member
 
Registered: Oct 2006
Location: Finland
Distribution: openSUSE
Posts: 89

Rep: Reputation: 15
Applying patches to programs


Okay, I'm done reading documentation so I know how to compile a program (Window Maker) from sources (yes, I'm n00b but thought learning something else than apt-get, yum or netpkg might come handy). Source package had folder with several patches, one which I want to apply (single_click.diff which enables using dock with single clicks). After brief googling on how to apply that patch I found out about patch command and read the man pages of it, but I just don't get it!
Code:
SYNOPSIS
       patch [options] [originalfile [patchfile]]

       but usually just

       patch -pnum <patchfile
I'm such a n00b, that I don't know which file I'm supposed to patch, am I supposed to patch it before or after compilation and that whole -pnum (-p0, -p1) thing was plain gibberish*. Couldn't really comprehend it. Man page didn't really have any step-by-step examples.. Could someone help me out with this one?

Thanks!


*
Code:
 If the header is that of a context diff, patch takes the old and new
          file names in the header.  A name is ignored if  it  does  not  have
          enough slashes to satisfy the -pnum or --strip=num option.  The name
          /dev/null is also ignored.
 
Old 05-06-2007, 06:32 AM   #2
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,646

Rep: Reputation: 147Reputation: 147
The patchfile knows which file to patch. Go to the source folder (WindowMaker-0.92.0 probably) and take a look at the patch file (less contrib/single_click.diff). At the top you see which file will get patched (maybe there are more if you scroll down, didn't look that far myself).
You will notice for example the line starting "+++ WPrefs.app/Expert.c". If you look in the source folder you will find a directory called "WPrefs.app" so that the path is correct if you are in the "root" of the source folder -- -p0 is right here.
If the line mentioned started for example "+++ WindowMaker-0.92.0/WPrefs.app/Expert.c" from that point you needed to strip the first part to apply the patch right (so that the relative path from where you are points to the right file, Expert.c in this case), so -p1 would be the right option.

EDIT: Fixed some maybe unclear explanation.

Last edited by titopoquito; 05-06-2007 at 06:35 AM.
 
Old 05-06-2007, 07:11 AM   #3
Grife
Member
 
Registered: Oct 2006
Location: Finland
Distribution: openSUSE
Posts: 89

Original Poster
Rep: Reputation: 15
So I should move single_click.diff to directory WindowMaker-0.92.0, and from there run command
Code:
patch -p0 <single_click.diff
Right? Then it checks that absolute path from there to WPrefs.app/Expert.c matches? And as it should match then, it will patch rest of the patchable files as well? Ok, I think I understood. Back to runlevel 3 and try it then. Thanks!
 
Old 05-06-2007, 07:17 AM   #4
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,646

Rep: Reputation: 147Reputation: 147
Leave the patch where it is and do
Code:
patch -p0 < contrib/single_click.diff
from within the Windows Maker source folder. Then patch looks if it finds the file ./WPrefs.app/Expert.c (relative path) and will apply the patch file.
 
Old 05-06-2007, 07:58 AM   #5
Grife
Member
 
Registered: Oct 2006
Location: Finland
Distribution: openSUSE
Posts: 89

Original Poster
Rep: Reputation: 15
Possibly that would have worked too, but I managed to patch it that way too (at least it told it's success). However, wmaker doesn't start. It tells "wmaker fatal error: could not open display "" ". Tried as root as well. Then wmaker --help, then checked manpage and tried to specify to use wmaker -display 0:0 (and 0:1, 0:2) but same thing. Uhh... How could I get more info than just that error or do you have any idea why it's doing that?
 
Old 05-06-2007, 08:05 AM   #6
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,646

Rep: Reputation: 147Reputation: 147
About the patch: The way you did it was totally ok, I just wanted to tell you that you can spare one step (copying the patch file).

I'm not sure on which system you want to start it. If you are doing this in Zenwalk it should be similar to the way it works in Slackware: Create a /etc/X11/xinit/xinitrc.wmaker file like this:
Code:
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f $userresources ]; then
    xrdb -merge $userresources
fi

if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi

# If the user lacks $HOME/GNUstep, install it:
if [ ! -f $HOME/GNUstep/Defaults/WindowMaker ]; then
    wmaker.inst
fi

# Test for cpp, which wmaker uses to process config files:
if [ ! -x /usr/bin/cpp ]; then
  NOCPP="--no-cpp"
fi

# Start the window manager:
exec /usr/bin/wmaker $NOCPP
Does Zenwalk have "xwmconfig" to choose the window manager? Else copy the file to your user's home directory as ".xinitrc". This way "startx" should fire up Window Maker as your gui IMHO
 
Old 05-06-2007, 09:00 AM   #7
Grife
Member
 
Registered: Oct 2006
Location: Finland
Distribution: openSUSE
Posts: 89

Original Poster
Rep: Reputation: 15
Hey it worked! After some head scratching I just changed path in your file to /usr/bin/local/wmaker

But this install of window maker is by far glitchiest I've ever seen! Window Maker preferences doesn't have pictures and text is missing from minimized apps. I'll check those xinitrc's again for some fails and such.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Applying patches. landfill Linux - Software 7 09-11-2005 05:05 PM
Applying patches in linux corbis_demon Linux - Newbie 7 08-15-2004 09:40 AM
applying patches in fluxbox corbis_demon Linux - Software 1 08-14-2004 05:31 AM
Order of applying patches Steve1445 Linux - Newbie 4 01-12-2004 10:10 AM
applying software patches yocompia Slackware 4 07-29-2003 07:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration