https://github.com/kiwibrowser/src 这是项目地址,里边还包含编译流程,无中文。
-
mkdir chromium git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git git clone https://github.com/kiwibrowser/dependencies.git .cipd git clone https://github.com/kiwibrowser/src.git
新建chromiun目录,然后clone上边3个项目,很慢,慢慢等待
-
export PATH=$HOME/depot_tools:$PATH source ~/.bashrc
将depot_tools目录加入到环境变量中并生效,$HOME换成对应的目录即可
-
sudo apt-get update sudo apt-get install python openjdk-8-jdk-headless libncurses5
build项目所需
-
sudo update-java-alternatives --set java-1.8.0-openjdk-amd64
如果有多个jdk版本的话,建议还是了解下 update-java-alternatives 用法,对jdk版本有要求
-
bash install-build-deps.sh --no-chromeos-fonts build/linux/sysroot_scripts/install-sysroot.py --arch=i386 build/linux/sysroot_scripts/install-sysroot.py --arch=amd64
切换到src目录,其中根据架构选择是amd64还是i386。执行这一行的时候,实际是要去下载一个debian_sid_amd64_sysroot.tar.xz 文件。注意,此文件的具体下载路径可以通过执行的时候,会输出具体的路径,如果fq后,遇到还是卡死的情况,可以自己复制下载,之后放到
chromium/src/build/linux/debian_sid_amd64-sysroot
目录下,然后在到编辑文件
chromium/src/build/linux/sysroot_scripts/install-sysroot.py
将InstallSysroot方法修改,变成直接执行解压即可。
def InstallSysroot(target_platform, target_arch): sysroot_dict = GetSysrootDict(target_platform, target_arch) revision = sysroot_dict['Revision'] tarball_filename = sysroot_dict['Tarball'] tarball_sha1sum = sysroot_dict['Sha1Sum'] # TODO(thestig) Consider putting this elsewhere to avoid having to recreate # it on every build. linux_dir = os.path.dirname(SCRIPT_DIR) sysroot = os.path.join(linux_dir, sysroot_dict['SysrootDir']) url = '%s/%s/%s/%s' % (URL_PREFIX, URL_PATH, revision, tarball_filename) stamp = os.path.join(sysroot, '.stamp') if os.path.exists(stamp): with open(stamp) as s: if s.read() == url: return print 'Installing Debian %s %s root image: %s' % \ (target_platform, target_arch, sysroot) if os.path.isdir(sysroot): shutil.rmtree(sysroot) os.mkdir(sysroot) tarball = os.path.join(sysroot, tarball_filename) print 'Downloading %s' % url print tarball print 'shou dong xia zai dao mu lu' sys.stdout.flush() sys.stderr.flush() # 这里直接改成你手动下载的路径即可 tarball = '/home/ubu18/debian_sid_amd64_sysroot.tar.xz' subprocess.check_call(['tar', 'xf', tarball, '-C', sysroot]) os.remove(tarball) with open(stamp, 'w') as s: s.write(url)
执行成功后,会在
chromium/src/build/linux/debian_sid_amd64-sysroot
自动解压,且自动把tarball的文件删掉,所以保险起见,备份xz文件
-
keytool -genkey -v -keystore ~/chromium/keystore.jks -alias production -keyalg RSA -keysize 2048 -validity 10000 -storepass HERE_YOUR_ANDROID_KEYSTORE_PASSWORD -keypass HERE_YOUR_ANDROID_KEYSTORE_PASSWORD
创建需要打包apk的jks文件
-
mkdir -p chromium/src/out/android_arm
新建此目录,并在此目录新建文件args.gn
target_os = "android" target_cpu = "arm" # <---- can be arm, arm64, x86 or x64 is_debug = false is_java_debug = false android_channel = "stable" is_official_build = true is_component_build = false is_chrome_branded = false is_clang = true symbol_level = 1 use_unofficial_version_number = false android_default_version_code = "158" android_keystore_name = "production" android_keystore_password = "HERE_YOUR_ANDROID_KEYSTORE_PASSWORD" android_keystore_path = "../../../keystore.jks" android_default_version_name = "Quadea" fieldtrial_testing_like_official_build = true icu_use_data_file = false enable_iterator_debugging = false google_api_key = "KIWIBROWSER" google_default_client_id = "42.apps.kiwibrowser.com" google_default_client_secret = "KIWIBROWSER_NOT_SO_SECRET" use_official_google_api_keys = true ffmpeg_branding = "Chrome" proprietary_codecs = true enable_hevc_demuxing = true enable_nacl = false enable_wifi_display = false enable_widevine = false enable_google_now = true enable_ac3_eac3_audio_demuxing = true enable_iterator_debugging = false enable_mse_mpeg2ts_stream_parser = true enable_remoting = false rtc_use_h264 = false rtc_use_lto = false use_openh264 = false v8_use_external_startup_data = true update_android_aar_prebuilts = true use_thin_lto = true enable_extensions = true enable_plugins = true
-
gclient runhooks
-
/home/ubu18/kiwibrowser/depot_tools/vpython3: line 52: /home/ubu18/kiwibrowser/depot_tools/.cipd_bin/vpython3: No such file or directory 基本上挂代理就行了 点击查看如何挂代理
-
IOError: [Errno 28] No space left on device
Error: Command 'python src/build/download_nacl_toolchains.py --mode nacl_core_sdk sync --extract' returned non-zero exit status 1
-
gclient 报错 To use a proxy in this situation, please supply those settingsin a .boto
这个问题是gclient不会自动去找到代理端口和地址,要增加.boto文件。
解决办法:
在.bashrc文件里 增加环境变量 export NO_AUTH_BOTO_CONFIG=/home/webrtc/.boto 路径是自己 要存放的.boto文件的地址。
保证.bahsrc新增加的环境变量生效,输入 $ source .bashrc命令
然后执行 $ echo -e "[Boto]\nproxy = 10.211.55.2\nproxy_port = 1087" > /home/webrtc/.boto
会在后面的地址新建一个.boto文件,然后把前面代理的ip和端口写进文件。
这样 gclient就不会报错了。
-
gn gen out/android_arm
-
ninja -C out/android_arm chrome_public_apk
如果出现报错 depot_tools/ninja.py: Could not find Ninja in the third_party of the current 那么自行去安装ninja即可
这个过程会很久很久,慢慢等。历史估计8个小时,终于编译成功,并且生成可用的apk文件。