diff --git a/Makefile b/Makefile index 6150021..61a8228 100644 --- a/Makefile +++ b/Makefile @@ -7,16 +7,18 @@ release:=$(shell cat ./release) #archive_create=tar cfJ #ext=.tar.xz -archive_create=tar cfz -ext=.tar.gz +archive_create:=tar cfz +ext:=.tar.gz -upstream_filename=firefox-$(version).source.tar.xz -upstream_dirname=firefox-$(version) +ff_source_dir:=firefox-$(version) +ff_source_tarball:=firefox-$(version).source.tar.xz +lw_source_dir:=librewolf-$(version)-$(release) +lw_source_tarball:=librewolf-$(version)-$(release).source$(ext) help : - @echo "use: $(MAKE) [all] [check] [clean] [veryclean] [build] [package] [run]" + @echo "use: $(MAKE) [all] [check] [clean] [veryclean] [bootstrap] [build] [package] [run]" @echo "" @echo " all - Make LibreWolf source archive ${version}-${release}." @echo " check - Check if there is a new version of Firefox." @@ -25,11 +27,11 @@ help : @echo " clean - Clean everything except the upstream firefox tarball." @echo " veryclean - Clean everything including the firefox tarball." @echo "" - @echo " bootstrap - Make librewolf source archive, and bootstrap the build system." + @echo " bootstrap - Bootstrap the build environment." @echo "" - @echo " build - After a bootstrap, build it." - @echo " package - After a build, package it." - @echo " run - After a build, run it." + @echo " build - Build LibreWolf (requires bootstraped build environment)." + @echo " package - Package LibreWolf (requires build)." + @echo " run - Run LibreWolf (requires build)." @echo "" @@ -47,28 +49,27 @@ README.md : README.md.in ./version ./release @rm -f tmp -all : librewolf-$(version)-$(release).source$(ext) +all : $(lw_source_tarball) clean : - rm -rf *~ firefox-$(version) librewolf-$(version) librewolf-$(version)-$(release).source$(ext) + rm -rf *~ $(ff_source_dir) $(lw_source_dir) $(lw_source_tarball) veryclean : clean - rm -f $(upstream_filename) + rm -rf $(ff_source_tarball) # # The actual build stuff # -$(upstream_filename) : - wget -q "https://archive.mozilla.org/pub/firefox/releases/$(version)/source/firefox-$(version).source.tar.xz" +$(ff_source_tarball) : + wget -q "https://archive.mozilla.org/pub/firefox/releases/$(version)/source/firefox-$(version).source.tar.xz" -O $(ff_source_tarball) -librewolf-$(version)-$(release).source$(ext) : $(upstream_filename) ./version ./release scripts/librewolf-patches.py assets/mozconfig assets/patches.txt - rm -rf $(upstream_dirname) - rm -rf librewolf-$(version) - tar xf $(upstream_filename) - mv $(upstream_dirname) librewolf-$(version) +$(lw_source_dir) : $(ff_source_tarball) ./version ./release scripts/librewolf-patches.py assets/mozconfig assets/patches.txt + rm -rf $(ff_source_dir) $(lw_source_dir) + tar xf $(ff_source_tarball) + mv $(ff_source_dir) $(lw_source_dir) python3 scripts/librewolf-patches.py $(version) $(release) rm -f librewolf-$(version)-$(release).source$(ext) $(archive_create) librewolf-$(version)-$(release).source$(ext) librewolf-$(version) @@ -76,22 +77,23 @@ librewolf-$(version)-$(release).source$(ext) : $(upstream_filename) ./version ./ sha256sum librewolf-$(version)-$(release).source$(ext) > librewolf-$(version)-$(release).source$(ext).sha256sum cat librewolf-$(version)-$(release).source$(ext).sha256sum -librewolf-$(version) : librewolf-$(version)-$(release).source$(ext) - tar xf librewolf-$(version)-$(release).source$(ext) +$(lw_source_tarball) : $(lw_source_dir) + rm -f $(lw_source_tarball) + $(archive_create) $(lw_source_tarball) $(lw_source_dir) debs=python3 python3-dev python3-pip rpms=python3 python3-devel -bootstrap : librewolf-$(version) +bootstrap : $(lw_source_dir) (sudo apt -y install $(debs); true) (sudo rpm -y install $(rpms); true) - (cd librewolf-$(version) && MOZBUILD_STATE_PATH=$$HOME/.mozbuild ./mach --no-interactive bootstrap --application-choice=browser) + (cd $(lw_source_dir) && MOZBUILD_STATE_PATH=$$HOME/.mozbuild ./mach --no-interactive bootstrap --application-choice=browser) -build : - (cd librewolf-$(version) && ./mach build) +build : $(lw_source_dir) + (cd $(lw_source_dir) && ./mach build) package : - (cd librewolf-$(version) && ./mach package) + (cd $(lw_source_dir) && ./mach package) + cp -v $(lw_source_dir)/obj-*/dist/librewolf-$(version)-$(release).en-US.*.tar.bz2 . run : - (cd librewolf-$(version) && ./mach run) - + (cd $(lw_source_dir) && ./mach run) diff --git a/scripts/librewolf-patches.py b/scripts/librewolf-patches.py index 8bc58e3..2743688 100755 --- a/scripts/librewolf-patches.py +++ b/scripts/librewolf-patches.py @@ -58,7 +58,7 @@ def patch(patchfile): def enter_srcdir(_dir = None): if _dir == None: - dir = "librewolf-{}".format(version) + dir = "librewolf-{}-{}".format(version, release) else: dir = _dir print("cd {}".format(dir)) @@ -140,7 +140,7 @@ if len(args) != 2: sys.exit(1) version = args[0] release = args[1] -if not os.path.exists('librewolf-{}'.format(version) + '/configure.py'): +if not os.path.exists('librewolf-{}-{}'.format(version, release) + '/configure.py'): sys.stderr.write('error: folder doesn\'t look like a Firefox folder.') sys.exit(1)