Implemented most non-librewolf functionality
This commit is contained in:
parent
1ef6478501
commit
147e5f7be8
2 changed files with 145 additions and 47 deletions
2
common
2
common
|
|
@ -1 +1 @@
|
||||||
Subproject commit bf95af6af7ccf96fccb58d553ff552c41558e5d3
|
Subproject commit febf04e63f6eb4428e573a23cb5433d3d969eeac
|
||||||
190
pybuild.py
190
pybuild.py
|
|
@ -1,7 +1,9 @@
|
||||||
#!/usr/bin/python3
|
#!/bin/env python3
|
||||||
|
|
||||||
|
pkgver='89.0'
|
||||||
|
|
||||||
#
|
#
|
||||||
# pybuild.py - try move functionality away from that too big of a script.
|
# pybuild.py - try move functionality away from that too big/horrible build script.
|
||||||
#
|
#
|
||||||
|
|
||||||
import optparse
|
import optparse
|
||||||
|
|
@ -11,6 +13,8 @@ import os
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
|
|
||||||
parser.add_option('-x', '--cross', dest='cross_compile', default=False, action="store_true")
|
parser.add_option('-x', '--cross', dest='cross_compile', default=False, action="store_true")
|
||||||
|
parser.add_option('-n', '--no-execute', dest='no_execute', default=False, action="store_true")
|
||||||
|
parser.add_option('-l', '--no-librewolf', dest='no_librewolf', default=False, action="store_true")
|
||||||
parser.add_option('-s', '--src', dest='src', default='release')
|
parser.add_option('-s', '--src', dest='src', default='release')
|
||||||
parser.add_option('-t', '--distro', dest='distro', default='win')
|
parser.add_option('-t', '--distro', dest='distro', default='win')
|
||||||
|
|
||||||
|
|
@ -19,6 +23,7 @@ options, remainder = parser.parse_args()
|
||||||
|
|
||||||
#print("[debug] ----------")
|
#print("[debug] ----------")
|
||||||
#print("[debug] --cross = ", options.cross_compile)
|
#print("[debug] --cross = ", options.cross_compile)
|
||||||
|
#print("[debug] --no-execute = ", options.no_execute)
|
||||||
#print("[debug] --src = ", options.src)
|
#print("[debug] --src = ", options.src)
|
||||||
#print("[debug] --distro = ", options.distro)
|
#print("[debug] --distro = ", options.distro)
|
||||||
#print("[debug] ----------")
|
#print("[debug] ----------")
|
||||||
|
|
@ -26,13 +31,80 @@ options, remainder = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def beep():
|
||||||
|
print('\a')
|
||||||
|
|
||||||
|
|
||||||
def enter_srcdir():
|
def enter_srcdir():
|
||||||
pass
|
dir = "firefox-{}".format(pkgver)
|
||||||
|
if options.src == 'nightly':
|
||||||
|
dir = 'mozilla-unified'
|
||||||
|
elif options.src == 'tor-browser':
|
||||||
|
dir = 'tor-browser'
|
||||||
|
print("cd {}".format(dir))
|
||||||
|
if not options.no_execute:
|
||||||
|
os.chdir(dir)
|
||||||
|
|
||||||
def leave_srcdir():
|
def leave_srcdir():
|
||||||
pass
|
print("cd ..")
|
||||||
|
if not options.no_execute:
|
||||||
|
os.chdir("..")
|
||||||
|
|
||||||
def exec(cmd):
|
def exec(cmd):
|
||||||
# print command on stdout and sys.exit(1) on errors
|
print("{}".format(cmd))
|
||||||
pass
|
if not options.no_execute:
|
||||||
|
retval = os.system(cmd)
|
||||||
|
if retval != 0:
|
||||||
|
beep()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Utilities:
|
||||||
|
def execute_git_subs():
|
||||||
|
exec("git submodule update --recursive")
|
||||||
|
exec("git submodule foreach git pull origin master")
|
||||||
|
exec("git submodule foreach git merge origin master")
|
||||||
|
|
||||||
|
def execute_git_init():
|
||||||
|
enter_srcdir()
|
||||||
|
exec("rm -rf .git")
|
||||||
|
exec("git init")
|
||||||
|
exec("git config core.safecrlf false")
|
||||||
|
exec("git config commit.gpgsign false")
|
||||||
|
exec("git add -f * .[a-z]*")
|
||||||
|
exec("git commit -am 'Initial commit'")
|
||||||
|
leave_srcdir()
|
||||||
|
|
||||||
|
|
||||||
|
def execute_deps_deb():
|
||||||
|
deps1 = "python python-dev python3 python3-dev python3-distutils clang pkg-config libpulse-dev gcc"
|
||||||
|
deps2 = "curl wget nodejs libpango1.0-dev nasm yasm zip m4 libgtk-3-dev libgtk2.0-dev libdbus-glib-1-dev"
|
||||||
|
deps3 = "libxt-dev python3-pip mercurial automake autoconf libtool m4"
|
||||||
|
exec("apt install -y {} {} {}".format(deps1,deps2,deps3))
|
||||||
|
|
||||||
|
def execute_deps_rpm():
|
||||||
|
deps1 = "python3 python3-distutils-extra clang pkg-config gcc curl wget nodejs nasm yasm zip m4"
|
||||||
|
deps2 = "python3-zstandard python-zstandard python-devel python3-devel gtk3-devel llvm gtk2-devel dbus-glib-devel libXt-devel pulseaudio-libs-devel"
|
||||||
|
exec("dnf -y install {} {}".format(deps1,deps2))
|
||||||
|
|
||||||
|
def execute_deps_pkg():
|
||||||
|
deps = "wget gmake m4 python3 py37-sqlite3 pkgconf llvm node nasm zip unzip yasm"
|
||||||
|
exec("pkg install {}".format(deps))
|
||||||
|
|
||||||
|
|
||||||
|
def execute_rustup():
|
||||||
|
# rust needs special love: https://www.atechtown.com/install-rust-language-on-debian-10/
|
||||||
|
exec("curl https://sh.rustup.rs -sSf | sh")
|
||||||
|
exec("cargo install cbindgen")
|
||||||
|
|
||||||
|
def execute_mach_env():
|
||||||
|
enter_srcdir()
|
||||||
|
exec("bash ./mach create-mach-environment")
|
||||||
|
leave_srcdir()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -43,28 +115,61 @@ def exec(cmd):
|
||||||
|
|
||||||
# Targets:
|
# Targets:
|
||||||
def execute_fetch():
|
def execute_fetch():
|
||||||
print("[debug] doing target -> fetch")
|
if options.src == 'release':
|
||||||
|
exec("rm -f firefox-{}.source.tar.xz".format(pkgver))
|
||||||
|
exec("wget -q https://archive.mozilla.org/pub/firefox/releases/{}/source/firefox-{}.source.tar.xz".format(pkgver, pkgver))
|
||||||
|
elif options.src == 'nightly':
|
||||||
|
exec("rm -f bootstrap.py")
|
||||||
|
exec("rm -rf mozilla-unified")
|
||||||
|
exec("wget -q https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py")
|
||||||
|
exec("python3 bootstrap.py --no-interactive --application-choice=browser")
|
||||||
|
elif options.src == 'tor-browser':
|
||||||
|
exec("rm -rf tor-browser")
|
||||||
|
exec("git clone --no-checkout --recursive https://git.torproject.org/tor-browser.git")
|
||||||
|
enter_srcdir()
|
||||||
|
exec("git checkout tor-browser-89.0-10.5-1-build1")
|
||||||
|
exec("git submodule update --recursive")
|
||||||
|
exec("patch -p1 -i ../patches/tb-mozconfig-win10.patch")
|
||||||
|
leave_srcdir()
|
||||||
|
|
||||||
def execute_extract():
|
def execute_extract():
|
||||||
print("[debug] doing target -> extract")
|
if options.src == 'release':
|
||||||
|
exec("rm -rf firefox-{}".format(pkgver))
|
||||||
|
exec("tar xf firefox-{}.source.tar.xz".format(pkgver))
|
||||||
|
|
||||||
def execute_lw_do_patches():
|
def execute_lw_do_patches():
|
||||||
|
if options.no_librewolf:
|
||||||
|
return
|
||||||
print("[debug] doing target -> lw_do_patches")
|
print("[debug] doing target -> lw_do_patches")
|
||||||
|
|
||||||
def execute_build():
|
def execute_build():
|
||||||
enter_srcdir()
|
enter_srcdir()
|
||||||
cmd = "./mach build"
|
exec("bash ./mach build")
|
||||||
exec(cmd)
|
|
||||||
leave_srcdir()
|
leave_srcdir()
|
||||||
|
|
||||||
def execute_lw_post_build():
|
def execute_lw_post_build():
|
||||||
|
if options.no_librewolf:
|
||||||
|
return
|
||||||
print("[debug] doing target -> lw_post_build")
|
print("[debug] doing target -> lw_post_build")
|
||||||
|
|
||||||
def execute_package():
|
def execute_package():
|
||||||
enter_srcdir()
|
enter_srcdir()
|
||||||
cmd = "./mach package"
|
exec("bash ./mach package")
|
||||||
exec(cmd)
|
|
||||||
leave_srcdir()
|
leave_srcdir()
|
||||||
|
|
||||||
def execute_lw_artifacts():
|
def execute_lw_artifacts():
|
||||||
|
if options.no_librewolf:
|
||||||
|
return
|
||||||
print("[debug] doing target -> lw_artifacts")
|
print("[debug] doing target -> lw_artifacts")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Main targets:
|
# Main targets:
|
||||||
def execute_all():
|
def execute_all():
|
||||||
execute_fetch()
|
execute_fetch()
|
||||||
|
|
@ -74,41 +179,35 @@ def execute_all():
|
||||||
execute_lw_post_build()
|
execute_lw_post_build()
|
||||||
execute_package()
|
execute_package()
|
||||||
execute_lw_artifacts()
|
execute_lw_artifacts()
|
||||||
|
|
||||||
def execute_clean():
|
def execute_clean():
|
||||||
print("[debug] doing target -> clean")
|
if options.src == 'release':
|
||||||
|
exec("rm -rf firefox-{}".format(pkgver))
|
||||||
|
elif options.src == 'nightly':
|
||||||
|
exec("rm -rf mozilla-unified")
|
||||||
|
elif options.src == 'tor-browser':
|
||||||
|
exec("rm -rf tor-browser")
|
||||||
|
|
||||||
|
exec("rm -rf librewolf firefox-{}.source.tar.xz mozconfig bootstrap.py".format(pkgver))
|
||||||
|
exec("rm -f librewolf-{}.en-US.win64.zip librewolf-{}.en-US.win64-setup.exe".format(pkgver,pkgver))
|
||||||
|
exec("rm -f tmp.nsi tmp-permissive.nsi tmp-strict.nsi".format())
|
||||||
|
|
||||||
# Utilities:
|
|
||||||
def execute_git_subs():
|
|
||||||
print("[debug] doing target -> git_subs")
|
|
||||||
|
|
||||||
def execute_git_init():
|
|
||||||
print("[debug] doing target -> git_init")
|
|
||||||
def execute_git_reset():
|
|
||||||
print("[debug] doing target -> git_reset")
|
|
||||||
|
|
||||||
def execute_deps_deb():
|
|
||||||
print("[debug] doing target -> deps_deb")
|
|
||||||
def execute_deps_rpm():
|
|
||||||
print("[debug] doing target -> deps_rpm")
|
|
||||||
def execute_deps_pkg():
|
|
||||||
print("[debug] doing target -> deps_pkg")
|
|
||||||
|
|
||||||
def execute_rustup():
|
|
||||||
print("[debug] doing target -> rustup")
|
|
||||||
def execute_mach_env():
|
|
||||||
print("[debug] doing target -> mach_env")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# main commandline interpretation
|
|
||||||
if len(remainder)>0:
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# main commandline interface
|
||||||
|
#
|
||||||
|
|
||||||
|
if options.src == 'tor-browser':
|
||||||
|
options.no_librewolf = True
|
||||||
|
|
||||||
|
if len(remainder) > 0:
|
||||||
if not options.src in ['release','nightly','tor-browser']:
|
if not options.src in ['release','nightly','tor-browser']:
|
||||||
print("error: option --src invalid value")
|
print("error: option --src invalid value")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
@ -146,8 +245,6 @@ if len(remainder)>0:
|
||||||
|
|
||||||
elif arg == 'git_init':
|
elif arg == 'git_init':
|
||||||
execute_git_init()
|
execute_git_init()
|
||||||
elif arg == 'git_reset':
|
|
||||||
execute_git_reset()
|
|
||||||
|
|
||||||
elif arg == 'deps_deb':
|
elif arg == 'deps_deb':
|
||||||
execute_deps_deb()
|
execute_deps_deb()
|
||||||
|
|
@ -164,6 +261,7 @@ if len(remainder)>0:
|
||||||
else:
|
else:
|
||||||
print("error: unknown command on command line: ", arg)
|
print("error: unknown command on command line: ", arg)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
beep()
|
||||||
else:
|
else:
|
||||||
# Print help message
|
# Print help message
|
||||||
print("""# Use:
|
print("""# Use:
|
||||||
|
|
@ -172,7 +270,9 @@ else:
|
||||||
|
|
||||||
# Options:
|
# Options:
|
||||||
|
|
||||||
-x,--cross - build windows setup.exe from linux
|
-n,--no-execute - print commands, don't execute them
|
||||||
|
-l,--no-librewolf - skip LibreWolf specific stages.
|
||||||
|
-x,--cross - crosscompile from linux, implies -t win
|
||||||
-s,--src <src> - release,nightly,tor-browser
|
-s,--src <src> - release,nightly,tor-browser
|
||||||
(default=release)
|
(default=release)
|
||||||
-t,--distro <distro> - deb,rpm,win (default=win)
|
-t,--distro <distro> - deb,rpm,win (default=win)
|
||||||
|
|
@ -180,7 +280,7 @@ else:
|
||||||
# Targets:
|
# Targets:
|
||||||
|
|
||||||
all - all steps from fetch to producing setup.exe
|
all - all steps from fetch to producing setup.exe
|
||||||
clean - clean everything, includeing extracted/fetched sources
|
clean - clean everything, including extracted/fetched sources
|
||||||
|
|
||||||
fetch - wget or hg clone or git pull
|
fetch - wget or hg clone or git pull
|
||||||
extract - nop if not wget
|
extract - nop if not wget
|
||||||
|
|
@ -193,9 +293,7 @@ else:
|
||||||
# Utilities:
|
# Utilities:
|
||||||
|
|
||||||
git_subs - git update submodules
|
git_subs - git update submodules
|
||||||
|
git_init - put the source folder in a .git repository
|
||||||
git_init - put the source folder in a .git reposity
|
|
||||||
git_reset - reset the source folder from the .git repo
|
|
||||||
|
|
||||||
deps_deb - install dependencies with apt
|
deps_deb - install dependencies with apt
|
||||||
deps_rpm - install dependencies with dnf
|
deps_rpm - install dependencies with dnf
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue