Bug 426083 - "Changes needed to build standalone XULRunner on BeOS ( branch 1.8 )" [p=mattmadia@gmail.com (mmadia) r=mfinkle a1.9=damons]
authorreed@reedloden.com
Tue, 08 Apr 2008 23:49:41 -0700
changeset 14132 2571937da8fac3e6434766c692be1917cc549a3f
parent 14131 16199434648775c07764cde7e88fadcabb6e0169
child 14133 9d71e756008af1ab8b197810238740c6d61c4067
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs426083
milestone1.9pre
Bug 426083 - "Changes needed to build standalone XULRunner on BeOS ( branch 1.8 )" [p=mattmadia@gmail.com (mmadia) r=mfinkle a1.9=damons]
xulrunner/app/Makefile.in
xulrunner/stub/nsXULStub.cpp
--- a/xulrunner/app/Makefile.in
+++ b/xulrunner/app/Makefile.in
@@ -52,18 +52,23 @@ DIRS		= profile
 PREF_JS_EXPORTS = $(srcdir)/xulrunner.js
 GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/,xulrunner.js)
 
 DEFINES += -DAB_CD=$(AB_CD)
 
 ifeq ($(USE_SHORT_LIBNAME), 1)
 PROGRAM = xulrunner$(BIN_SUFFIX)
 else
+ifeq ($(OS_ARCH), BeOS)
+PROGRAM = xulrunner$(BIN_SUFFIX)
+else
 PROGRAM = xulrunner-bin$(BIN_SUFFIX)
 endif
+endif
+
 DEFINES += -DXULRUNNER_PROGNAME=\"xulrunner\"
 
 ifdef MOZ_JAVAXPCOM
 DEFINES += -DMOZ_JAVAXPCOM
 endif
 
 ifdef TARGET_XPCOM_ABI
 DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
@@ -192,17 +197,17 @@ ifeq ($(OS_ARCH),WINNT)
 #
 # Set it to 256k.  See bug 127069.
 #
 ifndef GNU_CC
 LDFLAGS += /HEAP:0x40000
 endif
 endif
 
-ifneq (,$(filter-out OS2 WINNT Darwin,$(OS_ARCH)))
+ifneq (,$(filter-out OS2 WINNT Darwin BeOS,$(OS_ARCH)))
 
 xulrunner:: mozilla.in Makefile.in Makefile $(DEPTH)/config/autoconf.mk
 	cat $< | sed -e "s|%MOZAPPDIR%|$(mozappdir)|" \
                 -e "s|%MOZ_USER_DIR%|.mozilla/xulrunner|" \
 		-e "s|%MREDIR%|$(mredir)|" > $@
 	chmod +x $@
 
 libs:: xulrunner
--- a/xulrunner/stub/nsXULStub.cpp
+++ b/xulrunner/stub/nsXULStub.cpp
@@ -70,16 +70,21 @@
 #include <sys/stat.h>
 #define PATH_SEPARATOR_CHAR '/'
 #endif
 
 #ifdef XP_WIN
 #include "nsWindowsWMain.cpp"
 #endif
 
+#ifdef XP_BEOS
+#include <Entry.h>
+#include <Path.h>
+#endif
+
 #define VERSION_MAXLEN 128
 
 static void Output(PRBool isError, const char *fmt, ... )
 {
   va_list ap;
   va_start(ap, fmt);
 
 #if defined(XP_WIN) && !MOZ_WINCONSOLE
@@ -176,16 +181,27 @@ main(int argc, char **argv)
 
 #elif defined(XP_OS2)
    PPIB ppib;
    PTIB ptib;
 
    DosGetInfoBlocks(&ptib, &ppib);
    DosQueryModuleName(ppib->pib_hmte, sizeof(iniPath), iniPath);
 
+#elif defined(XP_BEOS)
+   BEntry e((const char *)argv[0], true); // traverse symlink
+   BPath p;
+   status_t err;
+   err = e.GetPath(&p);
+   NS_ASSERTION(err == B_OK, "realpath failed");
+
+   if (err == B_OK)
+     // p.Path returns a pointer, so use strcpy to store path in iniPath
+     strcpy(iniPath, p.Path());
+
 #else
   // on unix, there is no official way to get the path of the current binary.
   // instead of using the MOZILLA_FIVE_HOME hack, which doesn't scale to
   // multiple applications, we will try a series of techniques:
   //
   // 1) use realpath() on argv[0], which works unless we're loaded from the
   //    PATH
   // 2) manually walk through the PATH and look for ourself