From 76e5817ff31829170293b1a665d8962b670c295b Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 15 Aug 2016 22:38:47 -0400 Subject: [PATCH] Add Makefile I finally took the time to properly learn how to write makefiles. This was long overdue, but here we go. Much of the makefile wraps `build.py`, but gradually, we'll extract stuff from there until the makefile is the main container for build logic. --- Makefile | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 17 +++++++++++++- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..86cd54c9 --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +PYTHON=python3 +REQ_MINOR_VERSION=4 + +# Our build scripts are not very "make like" yet and perform their task in a bundle. For now, we +# use one of each file to act as a representative, a target, of these groups. +pemodules_target = core/pe/_block.*.so +mofiles_target = locale/fr/LC_MESSAGES/core.mo +submodules_target = hscommon/__init__.py + +pofiles = $(wildcard locale/*/LC_MESSAGES/*.po) + +.PHONY : default +default : run.py + @echo "Build complete! You can run dupeGuru with 'make run'" + +run.py : env $(mofiles_target) $(pemodules_target) qt/dg_rc.py + cp qt/run_template.py run.py + +.PHONY : reqs +reqs : + @ret=`${PYTHON} -c "import sys; print(int(sys.version_info[:2] >= (3, ${REQ_MINOR_VERSION})))"`; \ + if [ $${ret} -ne 1 ]; then \ + echo "Python 3.${REQ_MINOR_VERSION}+ required. Aborting."; \ + exit 1; \ + fi + @${PYTHON} -m venv -h > /dev/null || \ + echo "Creation of our virtualenv failed. If you're on Ubuntu, you probably need python3-venv." + @${PYTHON} -c 'import PyQt5' >/dev/null 2>&1 || \ + { echo "PyQt 5.4+ required. Install it and try again. Aborting"; exit 1; } + +# Ensure that submodules are initialized +$(submodules_target) : + git submodule init + git submodule update + +env : | $(submodules_target) reqs + @echo "Creating our virtualenv" + ${PYTHON} -m venv env --system-site-packages + ./env/bin/pip install -r requirements.txt + +build/help : | env + ./env/bin/python build.py --doc + +qt/dg_rc.py : qt/dg.qrc + pyrcc5 qt/dg.qrc > qt/dg_rc.py + +$(mofiles_target) : $(pofiles) | env + ./env/bin/python build.py --loc + +$(pemodules_target) : + ./env/bin/python -c 'import build; build.build_pe_modules("qt")' + +.PHONY : mergepot +mergepot : + ./env/bin/python build.py --mergepot + +.PHONY : normpo +normpo : + ./env/bin/python build.py --normpo + +.PHONY : run +run: run.py + ./env/bin/python run.py + +.PHONY : clean +clean: + -rm run.py + -rm -rf build + -rm locale/*/LC_MESSAGES/*.mo diff --git a/README.md b/README.md index a7cb484f..b2244eb0 100644 --- a/README.md +++ b/README.md @@ -66,11 +66,26 @@ git submodules: ## How to build dupeGuru from source +### make + +If you're on linux, you can build the ap for local development with `make`: + + $ make + $ make run + +The `Makefile` is a recent addition, however. You might have to fallback to the legacy build +scripts. + +### Legacy build + +If you're on OS X or that if the `make` method didn't work, you can build dupeGuru with the +legacy scripts. + There's a bootstrap script that will make building very easy. There might be some things that you need to install manually on your system, but the bootstrap script will tell you when what you need to install. You can run the bootstrap with: - ./bootstrap.sh + $ ./bootstrap.sh and follow instructions from the script.