compile a patch on macosx

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Horse
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 10 Sep 2004 20:25

compile a patch on macosx

Post by Horse »

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
tb2571989
Director
Director
Posts: 544
Joined: 04 May 2006 10:54
Location: Bristol, UK
Contact:

Re: compile a patch on macosx

Post by tb2571989 »

What about you? Will you join me when the time comes to be a hero?
Horse
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 10 Sep 2004 20:25

Re: compile a patch on macosx

Post by Horse »

With that wiki i compiled the binary succesfully but my problem is how can i add patches.
tb2571989
Director
Director
Posts: 544
Joined: 04 May 2006 10:54
Location: Bristol, UK
Contact:

Re: compile a patch on macosx

Post by tb2571989 »

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?
oVRoM
Engineer
Engineer
Posts: 37
Joined: 11 Jan 2003 10:40
Location: Utah

Re: compile a patch on macosx

Post by oVRoM »

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).
User avatar
nulio
Traffic Manager
Traffic Manager
Posts: 157
Joined: 23 Aug 2007 21:20
Location: Portugal

Re: compile a patch on macosx

Post by nulio »

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. :cry:

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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: compile a patch on macosx

Post by DaleStan »

What *exactly* did you type?
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
User avatar
nulio
Traffic Manager
Traffic Manager
Posts: 157
Joined: 23 Aug 2007 21:20
Location: Portugal

Re: compile a patch on macosx

Post by nulio »

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. :D
User avatar
nulio
Traffic Manager
Traffic Manager
Posts: 157
Joined: 23 Aug 2007 21:20
Location: Portugal

Re: compile a patch on macosx

Post by nulio »

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
User avatar
~shoestring~
Engineer
Engineer
Posts: 12
Joined: 10 Jul 2007 21:20

Re: compile a patch on macosx

Post by ~shoestring~ »

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 :)
User avatar
nulio
Traffic Manager
Traffic Manager
Posts: 157
Joined: 23 Aug 2007 21:20
Location: Portugal

Re: compile a patch on macosx

Post by nulio »

~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 :)
Thanks, that's it. I tried before but it didn't work, must have done something wrong, cause now I have the .app :D
flailer
Engineer
Engineer
Posts: 7
Joined: 02 Sep 2007 16:00

Re: compile a patch on macosx

Post by flailer »

You don't run Xcode, you do everything in Mac OS X terminal (/Applications/Utilities/Terminal).

You use fink to install the svn client.
User avatar
nulio
Traffic Manager
Traffic Manager
Posts: 157
Joined: 23 Aug 2007 21:20
Location: Portugal

Re: compile a patch on macosx

Post by nulio »

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.
Well I just called Xcode to X11 that is what I used. (/Applications/Utilities/X11 -> Opens xterm)

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.
User avatar
~shoestring~
Engineer
Engineer
Posts: 12
Joined: 10 Jul 2007 21:20

Re: compile a patch on macosx

Post by ~shoestring~ »

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)
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Re: compile a patch on macosx

Post by Bjarni »

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"
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.

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"

~shoestring~ wrote:you don't need fink any more: svn is preinstalled on 10.5
You will also benefit from using libpng. Luckily (AFAIK) Apple decided on including this one as well in 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.
User avatar
~shoestring~
Engineer
Engineer
Posts: 12
Joined: 10 Jul 2007 21:20

Re: compile a patch on macosx

Post by ~shoestring~ »

Bjarni wrote: You will also benefit from using libpng. Luckily (AFAIK) Apple decided on including this one as well in 10.5.
i had to install it myself.
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. :mrgreen:
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Re: compile a patch on macosx

Post by Bjarni »

nulio wrote:
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.
Well I just called Xcode to X11 that is what I used. (/Applications/Utilities/X11 -> Opens xterm)
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: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.
I can't update the wiki with 10.5 info as I lack 10.5 to test on. It's as simple as that.
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.
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Re: compile a patch on macosx

Post by Bjarni »

~shoestring~ wrote:
Bjarni wrote: You will also benefit from using libpng. Luckily (AFAIK) Apple decided on including this one as well in 10.5.
i had to install it myself.
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. :mrgreen:
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).
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.
User avatar
~shoestring~
Engineer
Engineer
Posts: 12
Joined: 10 Jul 2007 21:20

Re: compile a patch on macosx

Post by ~shoestring~ »

*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. :))
User avatar
nulio
Traffic Manager
Traffic Manager
Posts: 157
Joined: 23 Aug 2007 21:20
Location: Portugal

Re: compile a patch on macosx

Post by nulio »

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?
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 28 guests