compile a patch on macosx
Moderator: OpenTTD Developers
compile a patch on macosx
Yesterday i compiled openttd-0.6.0-beta4 on my macbook.
It works fine, but how can i apply a patch.
The patch is a diff but i can't find nowhere were i must place that diff, and what files i need to update
It works fine, but how can i apply a patch.
The patch is a diff but i can't find nowhere were i must place that diff, and what files i need to update
Re: compile a patch on macosx
What about you? Will you join me when the time comes to be a hero?
Re: compile a patch on macosx
With that wiki i compiled the binary succesfully but my problem is how can i add patches.
Re: compile a patch on macosx
Sorry, I'm running XP. Best bet will to ask someone that really knows what their really talking about 

What about you? Will you join me when the time comes to be a hero?
Re: compile a patch on macosx
Before running './configure' in your terminal, run patch -p0 < /path/to/patch-file .
Also see http://wiki.openttd.org/index.php/GNU/L ... ng_a_patch (instructions are the same as for Mac OS X).
Also see http://wiki.openttd.org/index.php/GNU/L ... ng_a_patch (instructions are the same as for Mac OS X).
Re: compile a patch on macosx
Hi all,
I'm trying to compile something on a mac.
I've read this, this and this.
Well since I have Mac Os x 10.5.2 I get a little lost at the part of getting the fink. I can't install it, ok. Then I don't need the zlib, ok. Then I need to get the svn client, ok, but how?
Then the rest it's just chinese for me.
I never developed nothing, I'm trying to compile 0.6.0 with the copy&paste patch for my OS. If I learn how to do this I can also start to help test stuff.
But I guess that with the existing information the noobs like me get kind of stuck.
I tried to search for help here but with compile+mac and compiling+mac I just get more stuff I can't comprehend.
What I've done so far:
-Got the source code and the .patch.
-Installed the Xcode from the Leopard disk.
-Then got really lost.
I don't know if I'm just missing something or if this is just meant for someone who already has some clues in developer tools.
If someone could give me a list of steps or something I would be very grateful.
If I wrote this in a confusing way just let me know and I'll try explain it.
Regards,
Júlio
I'm trying to compile something on a mac.
I've read this, this and this.
Well since I have Mac Os x 10.5.2 I get a little lost at the part of getting the fink. I can't install it, ok. Then I don't need the zlib, ok. Then I need to get the svn client, ok, but how?
Then the rest it's just chinese for me.

I never developed nothing, I'm trying to compile 0.6.0 with the copy&paste patch for my OS. If I learn how to do this I can also start to help test stuff.
But I guess that with the existing information the noobs like me get kind of stuck.
I tried to search for help here but with compile+mac and compiling+mac I just get more stuff I can't comprehend.
What I've done so far:
-Got the source code and the .patch.
-Installed the Xcode from the Leopard disk.
-Then got really lost.
I don't know if I'm just missing something or if this is just meant for someone who already has some clues in developer tools.
If someone could give me a list of steps or something I would be very grateful.
If I wrote this in a confusing way just let me know and I'll try explain it.
Regards,
Júlio
Re: compile a patch on macosx
What *exactly* did you type?
Where *exactly* did you type it?
What *exactly* was the error message?
Where *exactly* did you type it?
What *exactly* was the error message?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Re: compile a patch on macosx
Well like I said I just downloaded the stuff and Installed the Xcode.
Since it don't says nothing more than codes, I really don't know where to type it.
So I didn't type.
Cause first I don't know what is the svn client and where to get it, so I stopped there. Is it just some software for us to get the source code?
Compiling... Do I have to put the source code and patches in a specific place? Than I just type in the Xcode the codes in the pages?
For those who never used developer tools and really don't want to risk the adventure and mess anything, the How To's are a little incomplete.
Any help would be awesome.
Since it don't says nothing more than codes, I really don't know where to type it.
So I didn't type.
Cause first I don't know what is the svn client and where to get it, so I stopped there. Is it just some software for us to get the source code?
Compiling... Do I have to put the source code and patches in a specific place? Than I just type in the Xcode the codes in the pages?
For those who never used developer tools and really don't want to risk the adventure and mess anything, the How To's are a little incomplete.
Any help would be awesome.

Re: compile a patch on macosx
I got lucky now, I remembered my old webhost service at school, it had a command line interface.
Then I asked a friend of mine who knows some commands and he told me that the "$" isn't to type.
I was able to patch, configure and it's compiling right now.
I think we can make an how to not just for the people who are familiar with command line interfaces.
I was trying to guess where to put the source and patch, how to use Xcode and where to type the stuff. And I had years ago a minor contact with something with a command line interface. I only can imagine what someone who don't know what a CLI is, would go.
It would be great that people who don't have windows and that easy to patch software and don't know what a CLI is, could easily patch and compile stuff to help testing and using patches.
For Mac OS X 10.3+ users it would only be necessary to say:
-Install Xcode (from CD or site);
(skip fink, libraries and svn client)
-Download source and patches;
-Run Xcode and type "patch -p0 < [patch_name].[patch_extension]", then "cd [address_of_the_unzipped_source]", "./configure" and "make";
-"cd bin" and "./openttd"
Now I'll just have to find out if I can make an .app instead of a unix executable file.
Sorry for my bad english but if somebody is interested in this I can try explain it better.
Júlio
Then I asked a friend of mine who knows some commands and he told me that the "$" isn't to type.
I was able to patch, configure and it's compiling right now.
I think we can make an how to not just for the people who are familiar with command line interfaces.
I was trying to guess where to put the source and patch, how to use Xcode and where to type the stuff. And I had years ago a minor contact with something with a command line interface. I only can imagine what someone who don't know what a CLI is, would go.
It would be great that people who don't have windows and that easy to patch software and don't know what a CLI is, could easily patch and compile stuff to help testing and using patches.
For Mac OS X 10.3+ users it would only be necessary to say:
-Install Xcode (from CD or site);
(skip fink, libraries and svn client)
-Download source and patches;
-Run Xcode and type "patch -p0 < [patch_name].[patch_extension]", then "cd [address_of_the_unzipped_source]", "./configure" and "make";
-"cd bin" and "./openttd"
Now I'll just have to find out if I can make an .app instead of a unix executable file.
Sorry for my bad english but if somebody is interested in this I can try explain it better.
Júlio
- ~shoestring~
- Engineer
- Posts: 12
- Joined: 10 Jul 2007 21:20
Re: compile a patch on macosx
after running ./configure and make, if you also do "make bundle", i think it was, you will get the OS X OpenTTD.app package out at the end too, which is nice 

Re: compile a patch on macosx
Thanks, that's it. I tried before but it didn't work, must have done something wrong, cause now I have the .app~shoestring~ wrote:after running ./configure and make, if you also do "make bundle", i think it was, you will get the OS X OpenTTD.app package out at the end too, which is nice

Re: compile a patch on macosx
You don't run Xcode, you do everything in Mac OS X terminal (/Applications/Utilities/Terminal).
You use fink to install the svn client.
You use fink to install the svn client.
Re: compile a patch on macosx
Well I just called Xcode to X11 that is what I used. (/Applications/Utilities/X11 -> Opens xterm)flailer wrote:You don't run Xcode, you do everything in Mac OS X terminal (/Applications/Utilities/Terminal).
You use fink to install the svn client.
Wrong, how can you use something you can't even install? There is no fink for Leopard (or the wiki isn't up2date), so you can't use fink and there is no need for the svn client anyway, we can just download manually the source.
The thing is that there is no way a person who never saw a CLI could do this and it would be so easy to add the necessary steps for them. This way more people could help test patches.
- ~shoestring~
- Engineer
- Posts: 12
- Joined: 10 Jul 2007 21:20
Re: compile a patch on macosx
you don't need fink any more: svn is preinstalled on 10.5
(one needs svn to get the very latest snapshot of the code. relevant for developers)
(one needs svn to get the very latest snapshot of the code. relevant for developers)
Re: compile a patch on macosx
Actually you don't use Xcode at all. You just need to install it as it installs stuff like the gcc (the compiler itself) so that the makefile can reach it when using make.nulio wrote:-Run Xcode and type "patch -p0 < [patch_name].[patch_extension]", then "cd [address_of_the_unzipped_source]", "./configure" and "make";
-"cd bin" and "./openttd"
You open the terminal and enters the checkout (read the wiki on getting the checkout)/source dir and then you type "make". If you want to execute then you can type "make run". If you want a bundle so you can start from finder, then it's "make bundle"
You will also benefit from using libpng. Luckily (AFAIK) Apple decided on including this one as well in 10.5.~shoestring~ wrote:you don't need fink any more: svn is preinstalled on 10.5
It looks like the wiki page could do with an easier "walkthrough" of patching/compiling for people who never tried it before. People who think they can figure out how to write it should try to do so.
- ~shoestring~
- Engineer
- Posts: 12
- Joined: 10 Jul 2007 21:20
Re: compile a patch on macosx
i had to install it myself.Bjarni wrote: You will also benefit from using libpng. Luckily (AFAIK) Apple decided on including this one as well in 10.5.
not a big deal though--there's a nice binary installer that some guy has done (albeit for one version down) linked from the official libpng page.
worked for me.

Re: compile a patch on macosx
use the terminal rather than X11. While it might work with X11 (it likely will work) the support is based on using the terminal. Also X11 is a bit slower than the native drivers (read: the terminal). You should only use X11 for X11 graphical stuff and the mac port of OpenTTD will not use X11.nulio wrote:Well I just called Xcode to X11 that is what I used. (/Applications/Utilities/X11 -> Opens xterm)flailer wrote:You don't run Xcode, you do everything in Mac OS X terminal (/Applications/Utilities/Terminal).
You use fink to install the svn client.
I can't update the wiki with 10.5 info as I lack 10.5 to test on. It's as simple as that.nulio wrote:Wrong, how can you use something you can't even install? There is no fink for Leopard (or the wiki isn't up2date), so you can't use fink and there is no need for the svn client anyway, we can just download manually the source.
The thing is that there is no way a person who never saw a CLI could do this and it would be so easy to add the necessary steps for them. This way more people could help test patches.
The idea in the wiki is that people who knows how to improve what the wiki says can do so. It's not limited to core developers only.
Re: compile a patch on macosx
I was told that it was part of the OS (though the OS will only give you a dynamic lib so the makefile will fail if you link statically). There haven't been any new features in libpng fo a few years, only bug fixes and security updates (and I would be really surprised if somebody can manage to hack their way though OpenTTD due to a libpng bug).~shoestring~ wrote:i had to install it myself.Bjarni wrote: You will also benefit from using libpng. Luckily (AFAIK) Apple decided on including this one as well in 10.5.
not a big deal though--there's a nice binary installer that some guy has done (albeit for one version down) linked from the official libpng page.
worked for me.
Compiling libpng manually isn't that hard either. I think they added a makefile so it's just download, unzip, :/configure, make, sudo make install.
- ~shoestring~
- Engineer
- Posts: 12
- Joined: 10 Jul 2007 21:20
Re: compile a patch on macosx
*shrugs* possible.
make threw me an error first time without it, so i went and got it.. but then i was also p***ing about with configure options, so it could've been a typo rather than a lack-of-library problem.
sounds like nulio didn't need to install it.
make threw me an error first time without it, so i went and got it.. but then i was also p***ing about with configure options, so it could've been a typo rather than a lack-of-library problem.
sounds like nulio didn't need to install it.

Re: compile a patch on macosx
I was only waiting for feedback before volunteering to do it.
I can try making a little tutorial for those who really don't know nothing about CLI, have Leopard and want to patch something.
Roughly it would be something like this:
-Install Xcode (from CD or site);
(skip fink, libraries and svn client) (but we could add the svn stuff for the nightly builds, since someone told that 10.5 has svn, I have to try it)
-Download source and patches (unzip all and in put them all the same folder);
-Run Mac OS X Terminal (from applications/utilities/terminal)
-type "cd [address_of_the_unzipped_source]", "patch -p0 < [patch_name].[patch_extension]" to patch, "./configure" and "make" to compile and "make bundle" to get the app;
When I figure out the svn I could take some screenshots.
What do you think?
I can try making a little tutorial for those who really don't know nothing about CLI, have Leopard and want to patch something.
Roughly it would be something like this:
-Install Xcode (from CD or site);
(skip fink, libraries and svn client) (but we could add the svn stuff for the nightly builds, since someone told that 10.5 has svn, I have to try it)
-Download source and patches (unzip all and in put them all the same folder);
-Run Mac OS X Terminal (from applications/utilities/terminal)
-type "cd [address_of_the_unzipped_source]", "patch -p0 < [patch_name].[patch_extension]" to patch, "./configure" and "make" to compile and "make bundle" to get the app;
When I figure out the svn I could take some screenshots.
What do you think?
Who is online
Users browsing this forum: No registered users and 15 guests