Skip to content

Instantly share code, notes, and snippets.

@yonas
Forked from shkhln/commands.txt
Created June 3, 2016 03:17
Show Gist options
  • Save yonas/a13ee2f2c15ba3520b736b3d81e221bd to your computer and use it in GitHub Desktop.
Save yonas/a13ee2f2c15ba3520b736b3d81e221bd to your computer and use it in GitHub Desktop.
libchromiumcontent bulding notes (FreeBSD 9.3 / amd64)
cd $BUILDROOT
git clone https://github.com/gliaskos/freebsd-chromium.git
cd freebsd-chromium/www/chromium/
git checkout 418e996e3a
sudo make fetch
make extract
make patch
cd $BUILDROOT
ln -s `realpath freebsd-chromium/www/chromium/work/chromium-42.0.2311.135` chromium
git clone https://github.com/atom/libchromiumcontent.git
cd libchromiumcontent/
git checkout v42.0.2311.107-atom
cd vendor/python-patch/
git submodule update --init --recursive
cd $BUILDROOT/libchromiumcontent
ln -s `realpath ../chromium` vendor/chromium/src
rm vendor/chromium/src/base/process/launch.cc.orig # patch conflict
script/apply-patches
cp -R chromiumcontent/ vendor/chromium/src/chromiumcontent
cd vendor/chromium/src/
setenv CC gcc48
setenv CXX g++48
setenv CFLAGS "-isystem/usr/local/include/ -fno-omit-frame-pointer -fno-stack-protector"
# found in script/update
setenv GYP_GENERATORS ninja
setenv GYP_DEFINES "disable_nacl=1 component=shared_library target_arch=x64"
setenv GYP_GENERATOR_FLAGS output_dir=out_component
# borrowed from the chromium port makefile
setenv GYP_DEFINES "$GYP_DEFINES clang_use_chrome_plugins=0"
setenv GYP_DEFINES "$GYP_DEFINES linux_breakpad=0"
setenv GYP_DEFINES "$GYP_DEFINES linux_use_heapchecker=0"
setenv GYP_DEFINES "$GYP_DEFINES linux_strip_binary=1"
setenv GYP_DEFINES "$GYP_DEFINES test_isolation_mode=noop"
setenv GYP_DEFINES "$GYP_DEFINES disable_nacl=1"
setenv GYP_DEFINES "$GYP_DEFINES enable_extensions=1"
setenv GYP_DEFINES "$GYP_DEFINES enable_one_click_signin=1"
setenv GYP_DEFINES "$GYP_DEFINES enable_openmax=1"
setenv GYP_DEFINES "$GYP_DEFINES enable_webrtc=1"
setenv GYP_DEFINES "$GYP_DEFINES werror="
setenv GYP_DEFINES "$GYP_DEFINES no_gc_sections=1"
setenv GYP_DEFINES "$GYP_DEFINES os_ver=9.3"
setenv GYP_DEFINES "$GYP_DEFINES prefix_dir=/usr/local"
setenv GYP_DEFINES "$GYP_DEFINES python_ver=2.7.9"
setenv GYP_DEFINES "$GYP_DEFINES use_allocator=none"
setenv GYP_DEFINES "$GYP_DEFINES use_cups=1"
setenv GYP_DEFINES "$GYP_DEFINES linux_link_gsettings=1"
setenv GYP_DEFINES "$GYP_DEFINES linux_link_libpci=1"
setenv GYP_DEFINES "$GYP_DEFINES linux_link_libspeechd=1"
setenv GYP_DEFINES "$GYP_DEFINES libspeechd_h_prefix=speech-dispatcher/"
setenv GYP_DEFINES "$GYP_DEFINES usb_ids_path=/usr/local/share/usbids/usb.ids"
setenv GYP_DEFINES "$GYP_DEFINES want_separate_host_toolset=0"
setenv GYP_DEFINES "$GYP_DEFINES use_system_bzip2=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_flac=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_harfbuzz=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_icu=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_jsoncpp=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_libevent=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_libexif=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_libjpeg=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_libpng=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_libusb=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_libwebp=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_libxml=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_libxslt=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_nspr=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_protobuf=0"
setenv GYP_DEFINES "$GYP_DEFINES use_system_re2=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_snappy=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_speex=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_xdg_utils=1"
setenv GYP_DEFINES "$GYP_DEFINES use_system_yasm=1"
setenv GYP_DEFINES "$GYP_DEFINES v8_use_external_startup_data=0"
# overrides
setenv GYP_DEFINES "$GYP_DEFINES clang=0" # because gcc
setenv GYP_DEFINES "$GYP_DEFINES use_system_icu=0" # better that way
build/gyp_chromium --depth . -Ichromiumcontent/chromiumcontent.gypi chromiumcontent/chromiumcontent.gyp
ninja -C out_component/Release chromiumcontent_all
libchromiumcontent% git diff
diff --git a/chromiumcontent/chromiumcontent.gyp b/chromiumcontent/chromiumcontent.gyp
index 6387e64..7814646 100644
--- a/chromiumcontent/chromiumcontent.gyp
+++ b/chromiumcontent/chromiumcontent.gyp
@@ -20,6 +20,11 @@
'chromiumviews',
],
}],
+ ['OS=="freebsd"', {
+ 'dependencies': [
+ 'chromiumviews',
+ ],
+ }],
],
},
{
@@ -40,7 +45,7 @@
},
],
'conditions': [
- ['OS in ["win", "linux"]', {
+ ['OS in ["win", "linux", "freebsd"]', {
'targets': [
{
'target_name': 'chromiumviews',
@@ -54,7 +59,7 @@
'<(DEPTH)/ui/wm/wm.gyp:wm',
],
'conditions': [
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd"', {
'dependencies': [
'<(DEPTH)/chrome/browser/ui/libgtk2ui/libgtk2ui.gyp:gtk2ui',
],
diff --git a/patches/allow_new_privs.patch b/patches/allow_new_privs.patch
index 9152117..13f0f82 100644
--- a/patches/allow_new_privs.patch
+++ b/patches/allow_new_privs.patch
@@ -4,10 +4,10 @@ index 1c752bd..5092307 100644
+++ b/base/process/launch.cc
@@ -26,7 +26,7 @@ LaunchOptions::LaunchOptions()
new_process_group(false)
- #if defined(OS_LINUX)
+ #if defined(OS_LINUX) || defined(OS_FREEBSD)
, clone_flags(0)
- , allow_new_privs(false)
+ , allow_new_privs(true)
- #endif // OS_LINUX
+ #endif // OS_LINUX || OS_FREEBSD
#if defined(OS_POSIX)
, pre_exec_delegate(NULL)
freebsd-chromium/www/chromium% git diff files/
diff --git a/www/chromium/files/patch-base__base.gypi b/www/chromium/files/patch-base__base.gypi
index 9ddefad..2f56064 100644
--- a/www/chromium/files/patch-base__base.gypi
+++ b/www/chromium/files/patch-base__base.gypi
@@ -1,6 +1,6 @@
--- base/base.gypi.orig 2014-10-10 09:15:29 UTC
+++ base/base.gypi
-@@ -945,11 +945,16 @@
+@@ -945,11 +945,17 @@
'process/memory_stubs.cc',
],
'sources/': [
@@ -12,6 +12,7 @@
['exclude', '^process/process_linux\\.cc$'],
['exclude', '^sys_info_linux\\.cc$'],
+ ['exclude', '^process/process_iterator_linux\\.cc$'],
++ ['exclude', '^process/process_handle_linux\\.cc$'],
+ ['exclude', '^process/process_metrics_linux\\.cc$'],
+ ['exclude', '^files/file_path_watcher_fsevents\\.cc$'],
+ ['exclude', '^files/file_path_watcher_fsevents\\.h$'],
diff --git a/www/chromium/files/patch-content__content_common.gypi b/www/chromium/files/patch-content__content_common.gypi
index 5551554..a7c6309 100644
--- a/www/chromium/files/patch-content__content_common.gypi
+++ b/www/chromium/files/patch-content__content_common.gypi
@@ -6,11 +6,11 @@
}],
+ ['os_bsd==1', {
+ 'sources!': [
-+ 'common/sandbox_linux.cc',
-+ 'common/sandbox_linux.h',
-+ 'common/sandbox_init_linux.cc',
-+ 'common/sandbox_seccomp_bpf_linux.cc',
-+ 'common/sandbox_seccomp_bpf_linux.h',
++ 'common/sandbox_linux/sandbox_linux.cc',
++ 'common/sandbox_linux/sandbox_linux.h',
++ 'common/sandbox_linux/sandbox_init_linux.cc',
++ 'common/sandbox_linux/sandbox_seccomp_bpf_linux.cc',
++ 'common/sandbox_linux/sandbox_seccomp_bpf_linux.h',
+ 'common/sandbox_linux/bpf_cros_arm_gpu_policy_linux.cc',
+ 'common/sandbox_linux/bpf_gpu_policy_linux.cc',
+ 'common/sandbox_linux/bpf_ppapi_policy_linux.cc',
diff --git a/base/process/memory_stubs.cc b/base/process/memory_stubs.cc
index b06c7d5..bc090d9 100644
--- a/base/process/memory_stubs.cc
+++ b/base/process/memory_stubs.cc
@@ -16,4 +16,9 @@ bool AdjustOOMScore(ProcessId process, int score) {
return false;
}
+bool UncheckedMalloc(size_t size, void** result) {
+ *result = malloc(size);
+ return *result != NULL;
+}
+
} // namespace base
--- a/third_party/boringssl/src/crypto/bn/generic.c 2015-04-28 23:28:02.000000000 +0300
+++ b/third_party/boringssl/src/crypto/bn/generic.c 2015-05-04 19:56:56.766665163 +0300
@@ -72,7 +72,7 @@
#if defined(OPENSSL_WINDOWS)
#define alloca _alloca
#else
-#include <alloca.h>
+//~ #include <alloca.h>
#endif
--- a/third_party/boringssl/src/crypto/bn/asm/x86_64-gcc.c 2015-04-28 23:28:02.000000000 +0300
+++ b/third_party/boringssl/src/crypto/bn/asm/x86_64-gcc.c 2015-05-04 20:30:48.453094450 +0300
@@ -1,6 +1,6 @@
#include <openssl/bn.h>
-#if defined(OPENSSL_X86_64) && !defined(OPENSSL_WINDOWS)
+#if defined(OPENSSL_X86_64) && !defined(OPENSSL_WINDOWS) && !defined(OPENSSL_NO_ASM)
#include "../internal.h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment