Bug 226526

Summary: devel/chromium-gn: current_os should return "freebsd"
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Luca Pizzamiglio <pizzamig>
Status: Closed DUPLICATE    
Severity: Affects Some People CC: chromium, cpm
Priority: --- Keywords: needs-patch
Version: LatestFlags: pizzamig: maintainer-feedback+
jbeich: maintainer-feedback? (chromium)
Hardware: Any   
OS: Any   

Description Jan Beich freebsd_committer freebsd_triage 2018-03-11 14:13:52 UTC
www/chromium patches current_os to return bsd on every platform that defines OS_BSD. While those platforms are similar they're independent projects with different ABIs. Some of userland APIs may not be available on all of BSDs. gn already supports current_os=="netbsd" and OpenBSD has a patch[1] for current_os=="openbsd".

For example, DragonFly and FreeBSD want OSS audio, OpenBSD wants sndio, NetBSD wants SunAudio but WebRTC doesn't have OSS/SunAudio backends, so DragonFly can only use ALSA layer on top of OSS while FreeBSD can also use PulseAudio. How one would express such defaults with current_os=="bsd" ?

[1] https://github.com/openbsd/ports/blob/master/www/chromium/patches/patch-tools_gn_args_cc
    https://github.com/NetBSD/pkgsrc-wip/blob/master/chromium/patches/patch-tools_gn_args.cc
Comment 2 Jan Beich freebsd_committer freebsd_triage 2019-06-17 05:07:37 UTC
(In reply to Carlos J. Puga Medina from comment #1)
Thanks. It now works with https://firefox-source-docs.mozilla.org/build/buildsystem/gn.html

$ pkg install python27
$ hash git 2>/dev/null || pkg install mercurial
$ hg clone https://hg.mozilla.org/mozilla-unified firefox ||
  git clone https://github.com/mozilla/gecko-dev firefox
$ cd firefox
$ hg update central || git checkout origin/master
$ echo "export CC=clang80 CXX=clang++80 # whichever mesa installs" >>.mozconfig
$ echo "ac_add_options --disable-debug-symbols" >>.mozconfig
$ ./mach bootstrap # select Firefox for Desktop
$ ./mach build
$ ./mach run

$ pkg install chromium-gn
$ ./mach configure
$ ./mach build-backend -b GnConfigGen
 0:01.32 objdir/_virtualenvs/init/bin/python objdir/config.status --backend GnConfigGen
Reticulating splines...
 0:00.76 File already read. Skipping: modules/brotli/moz.build
Running "/usr/local/bin/gn gen objdir/media/webrtc/trunk/webrtc/gn-output --args=is_debug=false host_cpu="x64" target_os="freebsd" target_cpu="x64" --ide=json"
Generating JSON projects took 24ms
Done. Made 205 targets from 80 files in 415ms
Wrote gn config to objdir/media/webrtc/trunk/webrtc/gn-output/x64_False_x64_freebsd.json
 0:04.71 File already read. Skipping: gfx/angle/targets/angle_common/moz.build
Finished reading 2067 moz.build files in 8.07s
Read 64 gyp files in parallel contributing 12.87s to total wall time
Processed into 10473 build config descriptors in 7.83s
GnConfigGen backend executed in 0.80s
  1 total backend files; 1 created; 0 updated; 0 unchanged; 0 deleted
Total wall time: 30.95s; CPU time: 7.68s; Efficiency: 25%; Untracked: 14.25s
$ hg diff 2>/dev/null || git diff

*** This bug has been marked as a duplicate of bug 234773 ***