Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building on FreeBSD #171

Open
GoogleCodeExporter opened this issue Sep 2, 2015 · 5 comments
Open

Support building on FreeBSD #171

GoogleCodeExporter opened this issue Sep 2, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

Google Gears user "freedom <koansin.tan>" was able to build on FreeBSD 
after applying the changes below.


Sure, actually, it's quite trivial.
The steps I used to build it:

1). build Gecko SDK from MOZILLA_1_8_BRANCH
2). install GNU Make and GNU m4
3). add configurations for FreeBSD to tools/config.mk, change tools
rules.mk to use gmake and gm4)
4). comment out #include <malloc.h>
5). cast argument passing to wcslen() to (wchar_t*)
6). gmake

--------------------------------------------svn diff begin
------------------------------------------------

Index: tools/rules.mk
===================================================================
--- tools/rules.mk      (revision 147)
+++ tools/rules.mk      (working copy)
@@ -141,16 +141,16 @@
 default::
 ifneq "$(BROWSER)" ""
 # build for just the selected browser
-       make prereqs BROWSER=$(BROWSER)
-       make genheaders BROWSER=$(BROWSER)
-       make modules BROWSER=$(BROWSER)
-       make installer BROWSER=$(BROWSER)
+       ${MAKE} prereqs BROWSER=$(BROWSER)
+       ${MAKE} genheaders BROWSER=$(BROWSER)
+       ${MAKE} modules BROWSER=$(BROWSER)
+       ${MAKE} installer BROWSER=$(BROWSER)
 else
    # build for all browsers valid on this OS
 ifneq ($(OS),osx)
-       make prereqs BROWSER=FF
-       make genheaders BROWSER=FF
-       make modules BROWSER=FF
+       ${MAKE} prereqs BROWSER=FF
+       ${MAKE} genheaders BROWSER=FF
+       ${MAKE} modules BROWSER=FF
 else
        # OSX needs to build for each supported architecture
       make prereqs BROWSER=FF ARCH=i386
@@ -160,7 +160,7 @@
       make modules BROWSER=FF ARCH=i386
       make modules BROWSER=FF ARCH=ppc
 endif
-       make installer BROWSER=FF
+       ${MAKE} installer BROWSER=FF
 ifeq ($(OS),win32)
       make prereqs BROWSER=IE
       make genheaders BROWSER=IE
@@ -212,13 +212,13 @@
 # M4 (GENERIC PREPROCESSOR) TARGETS

 $(COMMON_OUTDIR)/genfiles/%: %.m4
-       m4 $(M4FLAGS) $< > $@
+       gm4 $(M4FLAGS) $< > $@

 $(FF_OUTDIR)/genfiles/%: %.m4
-       m4 $(M4FLAGS) $< > $@
+       gm4 $(M4FLAGS) $< > $@

 $(IE_OUTDIR)/genfiles/%: %.m4
-       m4 $(M4FLAGS) $< > $@
+       gm4 $(M4FLAGS) $< > $@

 # IDL TARGETS
 # Need /base/common in the include path to derive from
GearsBaseClassInterface
Index: tools/config.mk
===================================================================
--- tools/config.mk     (revision 147)
+++ tools/config.mk     (working copy)
@@ -29,12 +29,16 @@
 ifeq ($(shell uname),Linux)
 OS = linux
 else
+ifeq ($(shell uname),FreeBSD)
+OS = freebsd
+else
 ifeq ($(shell uname),Darwin)
 OS = osx
 else
 OS = win32
 endif
 endif
+endif

 # Set default OS architecture
 #   OSX builds will override this.
@@ -111,6 +115,38 @@
 endif


######################################################################
+# OS == freebsd
+######################################################################
+ifeq ($(OS),freebsd)
+GECKO_SDK = third_party/gecko_sdk/1.8/freebsd
+
+OBJ_SUFFIX = .o
+CC = gcc
+CXX = g++
+MKDEP = gcc -M -MF $(@D)/$*.pp -MT $@ $(CPPFLAGS) $(FF_CPPFLAGS) $<
+
+CPPFLAGS += -DLINUX
+SQLITE_CFLAGS += -Wno-uninitialized
+
+COMPILE_FLAGS_dbg = -g -O0
+COMPILE_FLAGS_opt = -O2
+COMPILE_FLAGS = -c -o $@ -fPIC -Wall -Werror $(COMPILE_FLAGS_$(MODE))
+
+# NS_LITERAL_STRING does not work properly without this compiler
option
+COMPILE_FLAGS += -fshort-wchar
+
+CFLAGS = $(COMPILE_FLAGS)
+CXXFLAGS = $(COMPILE_FLAGS) -fno-exceptions -fno-rtti -Wno-non-
virtual-dtor -Wno-ctor-dtor-privacy -funsigned-char
+
+DLL_PREFIX = lib
+DLL_SUFFIX = .so
+MKSHLIB = g++
+SHLIBFLAGS = -o $@ -shared -fPIC -Bsymbolic -Wl,--version-script -
Wl,tools/xpcom-ld-script
+
+FF_LIBS = -L $(GECKO_SDK)/bin -L $(GECKO_SDK)/lib -lxpcom -
lxpcomglue_s -lnspr4
+endif
+
+######################################################################
 # OS == osx

######################################################################
 ifeq ($(OS),osx)
Index: third_party/sqlite_google/ext/fts1/fts1_porter.c
===================================================================
--- third_party/sqlite_google/ext/fts1/fts1_porter.c    (revision 147)
+++ third_party/sqlite_google/ext/fts1/fts1_porter.c    (working copy)
@@ -26,7 +26,7 @@


 #include <assert.h>
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 #include <malloc.h>
 #else
 #include <stdlib.h>
Index: third_party/sqlite_google/ext/fts1/fts1_tokenizer1.c
===================================================================
--- third_party/sqlite_google/ext/fts1/fts1_tokenizer1.c        (revision
147)
+++ third_party/sqlite_google/ext/fts1/fts1_tokenizer1.c        (working
copy)
@@ -18,7 +18,7 @@


 #include <assert.h>
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 #include <malloc.h>
 #else
 #include <stdlib.h>
Index: third_party/sqlite_google/ext/fts1/fts1.c
===================================================================
--- third_party/sqlite_google/ext/fts1/fts1.c   (revision 147)
+++ third_party/sqlite_google/ext/fts1/fts1.c   (working copy)
@@ -19,7 +19,7 @@
 #endif

 #include <assert.h>
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 #include <malloc.h>
 #else
 #include <stdlib.h>
Index: third_party/sqlite_google/ext/fts2/fts2.c
===================================================================
--- third_party/sqlite_google/ext/fts2/fts2.c   (revision 147)
+++ third_party/sqlite_google/ext/fts2/fts2.c   (working copy)
@@ -269,7 +269,7 @@
 #endif

 #include <assert.h>
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 #include <malloc.h>
 #endif
 #include <stdlib.h>
Index: third_party/sqlite_google/ext/fts2/fts2_porter.c
===================================================================
--- third_party/sqlite_google/ext/fts2/fts2_porter.c    (revision 147)
+++ third_party/sqlite_google/ext/fts2/fts2_porter.c    (working copy)
@@ -26,7 +26,7 @@


 #include <assert.h>
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 #include <malloc.h>
 #else
 #include <stdlib.h>
Index: third_party/sqlite_google/ext/fts2/fts2_tokenizer1.c
===================================================================
--- third_party/sqlite_google/ext/fts2/fts2_tokenizer1.c        (revision
147)
+++ third_party/sqlite_google/ext/fts2/fts2_tokenizer1.c        (working
copy)
@@ -18,7 +18,7 @@


 #include <assert.h>
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 #include <malloc.h>
 #else
 #include <stdlib.h>
Index: base/common/js_runner_ff_marshaling.cc
===================================================================
--- base/common/js_runner_ff_marshaling.cc      (revision 147)
+++ base/common/js_runner_ff_marshaling.cc      (working copy)
@@ -303,7 +303,7 @@
  JSBool js_ok;
  js_ok = JS_DefineUCProperty(cx_, global_obj_,
                              reinterpret_cast<const jschar
*>(instance_name),
-                              wcslen(instance_name),
+                              wcslen((wchar_t *)instance_name),
                              OBJECT_TO_JSVAL(instance_obj),
                              NULL, NULL, // getter, setter
                              0 |     // these flags are optional
Index: base/common/js_runner_ff.cc
===================================================================
--- base/common/js_runner_ff.cc (revision 147)
+++ base/common/js_runner_ff.cc (working copy)
@@ -323,7 +323,7 @@
  js_script_ = JS_CompileUCScript(
                       js_engine_context_, global_obj_,
                       reinterpret_cast<const jschar *>(full_script),
-                       wcslen(full_script),
+                       wcslen((wchar_t *)full_script),
                       "script", line_number_start);
  if (!js_script_) { return false; }

@@ -363,7 +363,7 @@
                       js_engine_context_,
                       object,
                       reinterpret_cast<const jschar *>(script),
-                       wcslen(script),
+                       wcslen((wchar_t *)script),
                       "script", line_number_start,
                       &rval);
  if (!js_ok) { return false; }

-----------------------------------------------svn diff end

Original issue reported on code.google.com by [email protected] on 19 Jul 2007 at 10:14

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 5 Sep 2007 at 12:00

  • Added labels: Milestone-M4
  • Removed labels: Milestone-M3

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 5 Sep 2007 at 4:45

  • Added labels: Version-unscheduled
  • Removed labels: Milestone-M4

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 21 Jan 2008 at 6:19

  • Changed title: Support building on FreeBSD
  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Any updates on this?

Original comment by [email protected] on 28 Jan 2009 at 11:23

@GoogleCodeExporter
Copy link
Author

It is already been nearly a year since my last comment. Any idea on when this 
might
be scheduled? 

Original comment by [email protected] on 20 Dec 2009 at 9:31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant