2016-08-25 02:04:58 +00:00
|
|
|
PYTHON ?= python3
|
2017-09-19 17:14:11 +00:00
|
|
|
PYTHON_VERSION_MINOR := $(shell ${PYTHON} -c "import sys; print(sys.version_info.minor)")
|
2017-08-28 23:27:17 +00:00
|
|
|
PYRCC5 ?= pyrcc5
|
2020-12-29 20:08:37 +00:00
|
|
|
REQ_MINOR_VERSION = 6
|
2016-08-24 03:02:38 +00:00
|
|
|
PREFIX ?= /usr/local
|
2016-08-25 02:22:20 +00:00
|
|
|
|
2017-08-28 23:27:17 +00:00
|
|
|
# Window compatability via Msys2
|
|
|
|
# - venv creates Scripts instead of bin
|
|
|
|
# - compile generates .pyd instead of .so
|
|
|
|
# - venv with --sytem-site-packages has issues on windows as well...
|
|
|
|
|
2019-09-10 01:23:37 +00:00
|
|
|
ifeq ($(shell ${PYTHON} -c "import platform; print(platform.system())"), Windows)
|
2017-08-28 23:27:17 +00:00
|
|
|
BIN = Scripts
|
2017-09-19 17:14:11 +00:00
|
|
|
SO = *.pyd
|
2017-08-28 23:27:17 +00:00
|
|
|
VENV_OPTIONS =
|
|
|
|
else
|
|
|
|
BIN = bin
|
2020-12-29 20:08:37 +00:00
|
|
|
SO = *.so
|
2017-08-28 23:27:17 +00:00
|
|
|
VENV_OPTIONS = --system-site-packages
|
|
|
|
endif
|
|
|
|
|
2017-06-20 15:59:41 +00:00
|
|
|
# Set this variable if all dependencies are already met on the system. We will then avoid the
|
|
|
|
# whole vitualenv creation and pip install dance.
|
|
|
|
NO_VENV ?=
|
|
|
|
|
|
|
|
ifdef NO_VENV
|
|
|
|
VENV_PYTHON = $(PYTHON)
|
|
|
|
else
|
2017-08-28 23:27:17 +00:00
|
|
|
VENV_PYTHON = ./env/$(BIN)/python
|
2017-06-20 15:59:41 +00:00
|
|
|
endif
|
|
|
|
|
2016-08-25 02:22:20 +00:00
|
|
|
# If you're installing into a path that is not going to be the final path prefix (such as a
|
|
|
|
# sandbox), set DESTDIR to that path.
|
2016-08-16 02:38:47 +00:00
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
2016-08-24 03:02:38 +00:00
|
|
|
packages = hscommon qtlib core qt
|
2016-08-17 00:59:05 +00:00
|
|
|
localedirs = $(wildcard locale/*/LC_MESSAGES)
|
2016-08-16 02:38:47 +00:00
|
|
|
pofiles = $(wildcard locale/*/LC_MESSAGES/*.po)
|
2016-08-17 00:59:05 +00:00
|
|
|
mofiles = $(patsubst %.po,%.mo,$(pofiles))
|
|
|
|
|
|
|
|
vpath %.po $(localedirs)
|
|
|
|
vpath %.mo $(localedirs)
|
2016-08-16 02:38:47 +00:00
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
all: | env i18n modules qt/dg_rc.py
|
2016-08-16 02:38:47 +00:00
|
|
|
@echo "Build complete! You can run dupeGuru with 'make run'"
|
|
|
|
|
2017-03-12 01:41:47 +00:00
|
|
|
run:
|
2017-06-20 15:59:41 +00:00
|
|
|
$(VENV_PYTHON) run.py
|
2016-08-23 23:10:03 +00:00
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
pyc: | env
|
|
|
|
${VENV_PYTHON} -m compileall ${packages}
|
2016-08-24 03:02:38 +00:00
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
reqs:
|
2022-02-10 03:59:35 +00:00
|
|
|
ifneq ($(shell test $(PYTHON_VERSION_MINOR) -ge $(REQ_MINOR_VERSION); echo $$?),0)
|
2017-09-19 17:14:11 +00:00
|
|
|
$(error "Python 3.${REQ_MINOR_VERSION}+ required. Aborting.")
|
|
|
|
endif
|
2017-06-20 15:59:41 +00:00
|
|
|
ifndef NO_VENV
|
2016-08-16 02:38:47 +00:00
|
|
|
@${PYTHON} -m venv -h > /dev/null || \
|
|
|
|
echo "Creation of our virtualenv failed. If you're on Ubuntu, you probably need python3-venv."
|
2017-06-20 15:59:41 +00:00
|
|
|
endif
|
2016-08-16 02:38:47 +00:00
|
|
|
@${PYTHON} -c 'import PyQt5' >/dev/null 2>&1 || \
|
|
|
|
{ echo "PyQt 5.4+ required. Install it and try again. Aborting"; exit 1; }
|
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
env: | reqs
|
2017-06-20 15:59:41 +00:00
|
|
|
ifndef NO_VENV
|
2016-08-16 02:38:47 +00:00
|
|
|
@echo "Creating our virtualenv"
|
2017-08-14 13:26:44 +00:00
|
|
|
${PYTHON} -m venv env
|
|
|
|
$(VENV_PYTHON) -m pip install -r requirements.txt
|
|
|
|
# We can't use the "--system-site-packages" flag on creation because otherwise we end up with
|
|
|
|
# the system's pip and that messes up things in some cases (notably in Gentoo).
|
2017-08-28 23:27:17 +00:00
|
|
|
${PYTHON} -m venv --upgrade ${VENV_OPTIONS} env
|
2017-06-20 15:59:41 +00:00
|
|
|
endif
|
2016-08-16 02:38:47 +00:00
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
build/help: | env
|
2017-06-20 15:59:41 +00:00
|
|
|
$(VENV_PYTHON) build.py --doc
|
2016-08-16 02:38:47 +00:00
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
qt/dg_rc.py: qt/dg.qrc
|
2017-08-28 23:27:17 +00:00
|
|
|
$(PYRCC5) qt/dg.qrc > qt/dg_rc.py
|
2016-08-16 02:38:47 +00:00
|
|
|
|
2016-08-17 00:59:05 +00:00
|
|
|
i18n: $(mofiles)
|
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
%.mo: %.po
|
2016-08-17 02:03:43 +00:00
|
|
|
msgfmt -o $@ $<
|
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
modules: | env
|
|
|
|
$(VENV_PYTHON) build.py --modules
|
2016-08-17 02:03:43 +00:00
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
mergepot: | env
|
2017-06-20 15:59:41 +00:00
|
|
|
$(VENV_PYTHON) build.py --mergepot
|
2016-08-16 02:38:47 +00:00
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
normpo: | env
|
2017-06-20 15:59:41 +00:00
|
|
|
$(VENV_PYTHON) build.py --normpo
|
2016-08-16 02:38:47 +00:00
|
|
|
|
2017-06-20 15:49:11 +00:00
|
|
|
install: all pyc
|
2016-08-25 02:22:20 +00:00
|
|
|
mkdir -p ${DESTDIR}${PREFIX}/share/dupeguru
|
2017-06-20 15:49:11 +00:00
|
|
|
cp -rf ${packages} locale ${DESTDIR}${PREFIX}/share/dupeguru
|
2016-08-25 02:22:20 +00:00
|
|
|
cp -f run.py ${DESTDIR}${PREFIX}/share/dupeguru/run.py
|
|
|
|
chmod 755 ${DESTDIR}${PREFIX}/share/dupeguru/run.py
|
|
|
|
mkdir -p ${DESTDIR}${PREFIX}/bin
|
|
|
|
ln -sf ${PREFIX}/share/dupeguru/run.py ${DESTDIR}${PREFIX}/bin/dupeguru
|
|
|
|
mkdir -p ${DESTDIR}${PREFIX}/share/applications
|
|
|
|
cp -f pkg/dupeguru.desktop ${DESTDIR}${PREFIX}/share/applications
|
|
|
|
mkdir -p ${DESTDIR}${PREFIX}/share/pixmaps
|
|
|
|
cp -f images/dgse_logo_128.png ${DESTDIR}${PREFIX}/share/pixmaps/dupeguru.png
|
2016-08-24 03:02:38 +00:00
|
|
|
|
2017-06-20 15:49:11 +00:00
|
|
|
installdocs: build/help
|
|
|
|
mkdir -p ${DESTDIR}${PREFIX}/share/dupeguru
|
|
|
|
cp -rf build/help ${DESTDIR}${PREFIX}/share/dupeguru
|
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
uninstall:
|
2016-08-25 02:22:20 +00:00
|
|
|
rm -rf "${DESTDIR}${PREFIX}/share/dupeguru"
|
|
|
|
rm -f "${DESTDIR}${PREFIX}/bin/dupeguru"
|
|
|
|
rm -f "${DESTDIR}${PREFIX}/share/applications/dupeguru.desktop"
|
|
|
|
rm -f "${DESTDIR}${PREFIX}/share/pixmaps/dupeguru.png"
|
2016-08-24 03:02:38 +00:00
|
|
|
|
2016-08-16 02:38:47 +00:00
|
|
|
clean:
|
|
|
|
-rm -rf build
|
|
|
|
-rm locale/*/LC_MESSAGES/*.mo
|
2017-08-28 23:27:17 +00:00
|
|
|
-rm core/pe/*.$(SO) qt/pe/*.$(SO)
|
2016-08-24 03:02:38 +00:00
|
|
|
|
2020-12-29 20:08:37 +00:00
|
|
|
.PHONY: clean normpo mergepot modules i18n reqs run pyc install uninstall all
|