mirror of
https://github.com/morgan9e/helium
synced 2026-04-14 00:14:20 +09:00
More work on Mac OS
Add Mac OS build instructions Fix bug in Windows package building and add suffix to package name
This commit is contained in:
39
BUILDING.md
39
BUILDING.md
@@ -43,7 +43,7 @@ Google only supports [Windows 7 x64 or newer](https://chromium.googlesource.com/
|
||||
|
||||
For maximum portability, the build configuration will generate x86 binaries.
|
||||
|
||||
In addition to the general building requirements, there are additional requirements:
|
||||
### Additional Requirements
|
||||
* Visual Studio. See [Chromium's Windows Build Instructions](https://chromium.googlesource.com/chromium/src/+/51.0.2704.106/docs/windows_build_instructions.md) for Google's requirements
|
||||
* Build has been tested on 2015 Community Edition Update 2 with only the following features installed:
|
||||
* Programming Languages -> Visual C++ (including all subcomponents)
|
||||
@@ -58,6 +58,8 @@ In addition to the general building requirements, there are additional requireme
|
||||
* [bison from GNUWin32](http://gnuwin32.sourceforge.net/packages/bison.htm)
|
||||
* Get the Binaries, Developer files, and Dependencies
|
||||
|
||||
### Setting up the build environment
|
||||
|
||||
Make sure all of the following are in the `PATH`:
|
||||
* Python 2 as `python`
|
||||
* Ninja as `ninja`
|
||||
@@ -69,21 +71,40 @@ Also, ensure that `TEMP` and `TMP` environment variables point to existing direc
|
||||
|
||||
See `build_windows.py` for more on customizing the build environment or process.
|
||||
|
||||
Build steps:
|
||||
### Build
|
||||
|
||||
# Change directory to ungoogled-chromium's root directory
|
||||
path\to\python3 build_windows.py
|
||||
|
||||
## Mac OS
|
||||
|
||||
**NOTE: Currently, the build instructions for this platform have several caveats:**
|
||||
* No automatic source cleaning or domain substitution
|
||||
* Uses Google's binaries; downloads tools automatically from Google
|
||||
* No automatic patching
|
||||
* Uses depot_tools and Chromium's git repository (which takes quite a bit of space) as opposed to the source archive
|
||||
* Does not use `buildlib`
|
||||
**NOTE: There is no official maintainer for this platform. If there is a problem, please submit a pull request or issue**
|
||||
|
||||
[The build instructions can be found here](https://github.com/Eloston/ungoogled-chromium/issues/30#issuecomment-239644518). Credits to [9Morello](//github.com/9Morello)
|
||||
Tested on Mac OS 10.11.6
|
||||
|
||||
Credits to [9Morello](//github.com/9Morello) for most of the work done on this platform.
|
||||
|
||||
### Additional Requirements
|
||||
|
||||
* Xcode 7
|
||||
* Homebrew
|
||||
* Subversion client
|
||||
* Perl (for creating a `.dmg` package)
|
||||
* LLVM with Clang (see next section)
|
||||
* GNU patch (see next section)
|
||||
|
||||
### Setting up the build environment
|
||||
|
||||
1. Setup [Homebrew Versions](//github.com/Homebrew/homebrew-versions) if you haven't already: `brew tap homebrew/versions`
|
||||
2. Install LLVM 3.8 via Homebrew: `brew install llvm38 --with-clang --with-clang-extra-tools`
|
||||
3. Install GNU patch via Homebrew: `brew install gpatch`
|
||||
|
||||
See `build_macos.py` for more on customizing the build environment or process.
|
||||
|
||||
### Build
|
||||
|
||||
# Change directory to ungoogled-chromium's root directory
|
||||
python3 build_macos.py
|
||||
|
||||
## Other systems, platforms, and configurations
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ Currently supported platforms and distributions:
|
||||
* Debian
|
||||
* Ubuntu
|
||||
* Windows
|
||||
* Mac OS (partial; see [Building](#building))
|
||||
* Mac OS
|
||||
|
||||
## ungoogled-chromium's design
|
||||
|
||||
|
||||
@@ -182,7 +182,10 @@ class GenericPlatform:
|
||||
tar_file_obj.members = NoAppendList()
|
||||
for tarinfo in tar_file_obj:
|
||||
try:
|
||||
relative_path = pathlib.PurePosixPath(tarinfo.name).relative_to(relative_to)
|
||||
if relative_to is None:
|
||||
relative_path = pathlib.PurePosixPath(tarinfo.name)
|
||||
else:
|
||||
relative_path = pathlib.PurePosixPath(tarinfo.name).relative_to(relative_to)
|
||||
if str(relative_path) in ignore_files:
|
||||
ignore_files.remove(str(relative_path))
|
||||
else:
|
||||
|
||||
@@ -18,9 +18,51 @@
|
||||
|
||||
'''Code for Mac OS'''
|
||||
|
||||
import tempfile
|
||||
|
||||
from . import generic
|
||||
|
||||
class MacOSPlatform(generic.GenericPlatform):
|
||||
PLATFORM_RESOURCES = pathlib.Path("resources", "macos")
|
||||
PDFSQUEEZE_COMMIT = "5936b871e6a087b7e50d4cbcb122378d8a07499f"
|
||||
GOOGLE_TOOLBOX_FOR_MAC_COMMIT = "401878398253074c515c03cb3a3f8bb0cc8da6e9"
|
||||
|
||||
def setup_chromium_source(self, *args, check_if_exists=True, force_download=False, extract_archive=True, destination_dir=pathlib.Path("."), pdfsqueeze_path=None, google_toolbox_path=None, **kwargs):
|
||||
super(MacOSPlatform, self).setup_chromium_source(*args, check_if_exists=check_if_exists, force_download=force_download, extract_archive=extract_archive, destination_dir=destination_dir, **kwargs)
|
||||
|
||||
if pdfsqueeze_path is None:
|
||||
pdfsqueezearchive = destination_dir / pathlib.Path("pdfsqueeze-{}.tar.gz".format(self.PDFSQUEEZE_COMMIT))
|
||||
|
||||
def pdfsqueeze_downloader():
|
||||
download_url = "https://chromium.googlesource.com/external/pdfsqueeze.git/+archive/{}.tar.gz".format(self.PDFSQUEEZE_COMMIT)
|
||||
self._download_file(download_url, pdfsqueezearchive)
|
||||
|
||||
self._download_helper(pdfsqueezearchive, force_download, check_if_exists, pdfsqueeze_downloader)
|
||||
else:
|
||||
pdfsqueezearchive = pdfsqueeze_path
|
||||
|
||||
if google_toolbox_path is None:
|
||||
google_toolboxarchive = destination_dir / pathlib.Path("google-toolbox-for-mac-{}.tar.gz".format(self.GOOGLE_TOOLBOX_FOR_MAC_COMMIT))
|
||||
|
||||
def google_toolbox_downloader():
|
||||
download_url = "https://github.com/google/google-toolbox-for-mac/archive/{}.tar.gz".format(self.GOOGLE_TOOLBOX_FOR_MAC_COMMIT)
|
||||
self._download_file(download_url, google_toolboxarchive)
|
||||
|
||||
self._download_helper(google_toolboxarchive, force_download, check_if_exists, google_toolbox_downloader)
|
||||
else:
|
||||
google_toolboxarchive = google_toolbox_path
|
||||
|
||||
if extract_archive:
|
||||
self.logger.info("Extracting pdfsqueeze archive...")
|
||||
pdfsqueeze_dir = self.sandbox_root / pathlib.Path("third_party", "pdfsqueeze")
|
||||
os.makedirs(str(pdfsqueeze_dir))
|
||||
self._extract_tar_file(pdfsqueezearchive, pdfsqueeze_dir, list(), None)
|
||||
|
||||
self.logger.info("Extracting google-toolbox-for-mac archive...")
|
||||
google_toolbox_dir = self.sandbox_root / pathlib.Path("third_party", "google_toolbox_for_mac", "src")
|
||||
os.makedirs(str(google_toolbox_dir))
|
||||
self._extract_tar_file(google_toolboxarchive, google_toolbox_dir, list(), "google-toolbox-for-mac-{}".format(self.GOOGLE_TOOLBOX_FOR_MAC))
|
||||
|
||||
def apply_patches(self, patch_command=["patch", "-p1"]):
|
||||
self.logger.info("Applying patches via '{}' ...".format(" ".join(patch_command)))
|
||||
self._generate_patches(self.sandbox_patches, self._ran_domain_substitution)
|
||||
@@ -31,3 +73,32 @@ class MacOSPlatform(generic.GenericPlatform):
|
||||
result = self._run_subprocess(patch_command, cwd=str(self.sandbox_root), stdin=patch_file)
|
||||
if not result.returncode == 0:
|
||||
raise Exception("'{}' returned non-zero exit code {}".format(" ".join(patch_command), result.returncode))
|
||||
|
||||
def build(self, *args, **kwargs):
|
||||
if (self.sandbox_root / pathlib.Path("third_party", "libc++-static", "libc++.a")).exists():
|
||||
self.logger.info("libc++.a already exists. Skipping its building")
|
||||
else:
|
||||
self.logger.info("Building libc++.a ...")
|
||||
result = self._run_subprocess([str(self.sandbox_root / pathlib.Path("third_party", "libc++-static", "build.sh"))])
|
||||
if not result.returncode == 0:
|
||||
raise Exception("libc++.a build script returned non-zero exit code")
|
||||
|
||||
super(MacOSPlatform, self).build(*args, **kwargs)
|
||||
|
||||
def generate_package(self):
|
||||
# Based off of chrome/tools/build/mac/build_app_dmg
|
||||
self.logger.info("Generating .dmg file...")
|
||||
with tempfile.TemporaryDirectory() as tmpdirname:
|
||||
pkg_dmg_command = [
|
||||
str(self.sandbox_root / pathlib.Path("chrome", "installer", "mac", "pkg-dmg")),
|
||||
"--source", "/var/empty",
|
||||
"--target", "ungoogled-chromium_{}-{}_macos.dmg".format(self.version, self.revision),
|
||||
"--format", "UDBZ",
|
||||
"--verbosity", "2",
|
||||
"--volname", "Chromium", # From chrome/app/theme/chromium/BRANDING
|
||||
"--tempdir", tmpdirname,
|
||||
"--copy", str(self.sandbox_root / self.build_output / "Chromium.app") + "/:/Chromium.app"
|
||||
]
|
||||
result = self._run_subprocess(pkg_dmg_command)
|
||||
if not result.returncode == 0:
|
||||
raise Exception("pkg-dmg returned non-zero exit code")
|
||||
|
||||
@@ -26,12 +26,12 @@ from . import generic
|
||||
|
||||
class WindowsPlatform(generic.GenericPlatform):
|
||||
PLATFORM_RESOURCES = pathlib.Path("resources", "windows")
|
||||
FILES_CFG = generic.GenericPlatform.SANDBOX_ROOT / pathlib.Path("chrome", "tools", "build", "win", "FILES.cfg")
|
||||
SYZYGY_COMMIT = "3c00ec0d484aeada6a3d04a14a11bd7353640107"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(WindowsPlatform, self).__init__(*args, **kwargs)
|
||||
|
||||
self._files_cfg = self.sandbox_root / pathlib.Path("chrome", "tools", "build", "win", "FILES.cfg")
|
||||
self.syzygyarchive = None
|
||||
|
||||
def _download_syzygy(self):
|
||||
@@ -89,11 +89,11 @@ class WindowsPlatform(generic.GenericPlatform):
|
||||
def generate_package(self):
|
||||
# Derived from chrome/tools/build/make_zip.py
|
||||
# Hardcoded to only include files with buildtype "dev" and "official", and files for 32bit
|
||||
output_filename = "ungoogled-chromium_{}-{}.zip".format(self.version, self.revision)
|
||||
output_filename = "ungoogled-chromium_{}-{}_win32.zip".format(self.version, self.revision)
|
||||
self.logger.info("Creating build output archive {} ...".format(output_filename))
|
||||
def file_list_generator():
|
||||
exec_globals = {"__builtins__": None}
|
||||
with self.FILES_CFG.open() as cfg_file:
|
||||
with self._files_cfg.open() as cfg_file:
|
||||
exec(cfg_file.read(), exec_globals)
|
||||
for file_spec in exec_globals["FILES"]:
|
||||
if "dev" in file_spec["buildtype"] and "official" in file_spec["buildtype"]:
|
||||
|
||||
8
resources/macos/gyp_flags
Normal file
8
resources/macos/gyp_flags
Normal file
@@ -0,0 +1,8 @@
|
||||
clang=1
|
||||
clang_use_chrome_plugins=0
|
||||
clang_dir=/usr/local/Cellar/llvm/3.8.1/bin
|
||||
make_clang_dir=/usr/local/Cellar/llvm/3.8.1
|
||||
host_cc=/usr/local/Cellar/llvm/3.8.1/bin/clang
|
||||
CC=/usr/local/Cellar/llvm/3.8.1/bin/clang
|
||||
host_cxx=/usr/local/Cellar/llvm/3.8.1/bin/clang++
|
||||
LDPLUSPLUS=/usr/local/Cellar/llvm/3.8.1/bin/clang++
|
||||
2
resources/macos/patches/patch_order
Normal file
2
resources/macos/patches/patch_order
Normal file
@@ -0,0 +1,2 @@
|
||||
ungoogled-macos/remove-opus-clang-warning-flag.patch
|
||||
ungoogled-macos/fix-libcxx-archive-build-script.patch
|
||||
@@ -0,0 +1,31 @@
|
||||
# Modify libc++.a build script to work with Xcode's clang++
|
||||
|
||||
--- a/third_party/libc++-static/build.sh
|
||||
+++ b/third_party/libc++-static/build.sh
|
||||
@@ -28,14 +28,14 @@ cd libcxxbuild
|
||||
|
||||
mkdir libcxx
|
||||
pushd libcxx
|
||||
-sed -i '' 's/"default"/"hidden"/g' ../../libcxx/include/__config
|
||||
+#sed -i '' 's/"default"/"hidden"/g' ../../libcxx/include/__config
|
||||
"$CXX" -c -I../../libcxx/include/ ../../libcxx/src/*.cpp $FLAGS
|
||||
popd
|
||||
|
||||
mkdir libcxxabi
|
||||
pushd libcxxabi
|
||||
-sed -i '' 's/"default"/"hidden"/g' ../../libcxxabi/src/*
|
||||
-sed -i '' 's/push(default)/push(hidden)/g' ../../libcxxabi/src/*
|
||||
+#sed -i '' 's/"default"/"hidden"/g' ../../libcxxabi/src/*
|
||||
+#sed -i '' 's/push(default)/push(hidden)/g' ../../libcxxabi/src/*
|
||||
|
||||
# Let the default handler not depend on __cxa_demangle, this saves 0.5MB binary
|
||||
# size in each binary linking against libc++.a
|
||||
@@ -47,7 +47,7 @@ popd
|
||||
libtool -static -o libc++.a libcxx*/*.o
|
||||
|
||||
cp libc++.a "${THIS_DIR}/libc++.a"
|
||||
-upload_to_google_storage.py -b chromium-libcpp "${THIS_DIR}/libc++.a"
|
||||
+#upload_to_google_storage.py -b chromium-libcpp "${THIS_DIR}/libc++.a"
|
||||
|
||||
popd
|
||||
rm -rf "${DIR}"
|
||||
@@ -0,0 +1,13 @@
|
||||
# Remove clang warning flag -Wno-expansion-to-defined that will throw an error in older clangs
|
||||
|
||||
--- a/third_party/opus/opus.gyp
|
||||
+++ b/third_party/opus/opus.gyp
|
||||
@@ -62,7 +62,7 @@
|
||||
'variables': {
|
||||
'clang_warning_flags': [
|
||||
# TODO(thakis): Remove once silk/macros.h has been fixed
|
||||
- '-Wno-expansion-to-defined',
|
||||
+ #'-Wno-expansion-to-defined',
|
||||
],
|
||||
},
|
||||
'include_dirs': [
|
||||
Reference in New Issue
Block a user