porting x11/linux app to OS X

lipbone

Registered
Hi,

I'm completely ignorant about porting, programming, compiling and anything else that involves smartness with computers. :)

That said, how hard is it to port an x11 or linux app to Cocoa or Carbon or whatever is best for native OS X execution. Assume that the code is really really old...designed to run well over 1200 baud (it's that small).

thank you in advance.

(and then, if anyone knows this, how easy is it to port said code to Palm OS?)
 
There's a lot of documentation about porting at www.apple.com/developer

Of course, your question on "how hard will it be to port it" depends mostly on what language the application is written in. Java will run Natively in MacOSX without needing X11. Objective-C would be easiest to port to Cocoa/Carbon, but C and C++ should also be relatively easy to port.

Generally, it shouldn't be too bad. You can compile directly so that the application will work through Mac OS X's integrated X11 interface, or you could try and drag the code into Xcode, and with the help of a good Cocoa or Carbon textbook, recreate the interface code.

A bit more detail on what language is used for your program would help.
 
good question. i'll tell you what i do know.

the files i've been given have .h and .c extensions. after compiling for x11 a bunch of .o files are created.

code inside one of the files looks like this:

** ---------------------------
*/
static void vigoConnect (const char *hostname, const char *portnum);
static int vigoCheckInput(void);
#if !defined(_WIN32)
static void vigoWindowInput(void);
#endif

/*
** ----------------
** Public Variables
** ----------------
*/
#if !defined(_WIN32)
Display *disp;
XrmDatabase XrmDb;
#else
HINSTANCE hInstance;
#endif
extern FILE *traceF;
extern char traceFn[];
extern bool traceVigo;
extern u8 wemode;
extern volatile bool vigoActive;
extern const char *hostName;


Any ideas what language this is? I have no clue.
 
That bit of code tells us nothing about what libraries are being used to create the GUI. That's the bit that is going to be difficult to port.

If it uses Qt, you might be in luck as most Qt apps are very portable and there is a native version of Qt for Mac. GTK apps are a little harder to port to Cocoa/Carbon since there only exists GTK for X11.

The language used is C by the way so that pretty much rules out Qt.
 
This might be the code that indicates which libraries are being called:


HOST := $(shell uname)
MACHINE := $(shell uname -m)

LIBS = -lm -lX11 -lpthread
MACHINECFLAGS =
ifeq ("$(MACHINE)","x86_64")
LDFLAGS = -g2 -L/usr/X11R6/lib64
MACHINECFLAGS = -DCPU_THREADS
else
LDFLAGS = -g2 -L/usr/X11R6/lib
endif
ifeq ("$(MACHINE:i%86=i386)","i386")
ARCHCFLAGS ?= -march=$(MACHINE)
endif
INCL = -I/usr/X11R6/include -I/usr/local/include


I appreciate you're responses guys, I'm really clueless about this stuff and want to get a handle on the possibilities of porting before spending any time or money attempting such a thing.
 
This application is going to be a major pain to port. Period.

Reason? Its making use of X11 directly. X11 does not provide much in terms of GUI functionality. It merely provides routines for drawing rectangles, drawing text, detecting mouse clicks, and other basic stuff.

The entire GUI of the app needs to be rewritten in Cocoa. Trying to make it work in Carbon is going to prove to be to much effort for too little returns.
 
this was what i was looking for.

if i was a talented programmer with tons of time, this might be an interesting project. alas, i'm not.

thanks all
 
Back
Top