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
|
2016-08-25 02:04:58 +00:00
|
|
|
REQ_MINOR_VERSION = 4
|
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...
|
|
|
|
|
|
|
|
ifeq ($(shell uname -o), Msys)
|
|
|
|
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
|
2017-09-19 17:14:11 +00:00
|
|
|
SO = cpython-3$(PYTHON_VERSION_MINOR)m*.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.
|
|
|
|
submodules_target = hscommon/__init__.py
|
|
|
|
|
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
|
|
|
|
2017-03-12 01:41:47 +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
|
|
|
|
2016-08-24 03:02:38 +00:00
|
|
|
pyc:
|
|
|
|
${PYTHON} -m compileall ${packages}
|
|
|
|
|
2016-08-16 02:38:47 +00:00
|
|
|
reqs :
|
2017-09-19 17:14:11 +00:00
|
|
|
ifneq ($(shell test $(PYTHON_VERSION_MINOR) -gt $(REQ_MINOR_VERSION); echo $$?),0)
|
|
|
|
$(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; }
|
|
|
|
|
|
|
|
# Ensure that submodules are initialized
|
|
|
|
$(submodules_target) :
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
|
|
|
|
env : | $(submodules_target) 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
|
|
|
|
|
|
|
build/help : | env
|
2017-06-20 15:59:41 +00:00
|
|
|
$(VENV_PYTHON) build.py --doc
|
2016-08-16 02:38:47 +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)
|
|
|
|
|
|
|
|
%.mo : %.po
|
2016-08-17 02:03:43 +00:00
|
|
|
msgfmt -o $@ $<
|
|
|
|
|
2017-09-19 17:14:11 +00:00
|
|
|
core/pe/_block.$(SO) : core/pe/modules/block.c core/pe/modules/common.c
|
|
|
|
$(PYTHON) hscommon/build_ext.py $^ _block
|
|
|
|
mv _block.$(SO) core/pe
|
2016-08-17 02:03:43 +00:00
|
|
|
|
2017-09-19 17:14:11 +00:00
|
|
|
core/pe/_cache.$(SO) : core/pe/modules/cache.c core/pe/modules/common.c
|
|
|
|
$(PYTHON) hscommon/build_ext.py $^ _cache
|
|
|
|
mv _cache.$(SO) core/pe
|
2016-08-17 02:03:43 +00:00
|
|
|
|
2017-09-19 17:14:11 +00:00
|
|
|
qt/pe/_block_qt.$(SO) : qt/pe/modules/block.c
|
|
|
|
$(PYTHON) hscommon/build_ext.py $^ _block_qt
|
|
|
|
mv _block_qt.$(SO) qt/pe
|
2016-08-17 02:03:43 +00:00
|
|
|
|
2017-09-19 17:14:11 +00:00
|
|
|
modules : core/pe/_block.$(SO) core/pe/_cache.$(SO) qt/pe/_block_qt.$(SO)
|
2016-08-16 02:38:47 +00:00
|
|
|
|
|
|
|
mergepot :
|
2017-06-20 15:59:41 +00:00
|
|
|
$(VENV_PYTHON) build.py --mergepot
|
2016-08-16 02:38:47 +00:00
|
|
|
|
|
|
|
normpo :
|
2017-06-20 15:59:41 +00:00
|
|
|
$(VENV_PYTHON) build.py --normpo
|
2016-08-16 02:38:47 +00:00
|
|
|
|
2016-08-23 23:10:03 +00:00
|
|
|
srcpkg :
|
|
|
|
./scripts/srcpkg.sh
|
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
|
|
|
|
|
2016-08-24 03:02:38 +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
|
|
|
|
|
|
|
.PHONY : clean srcpkg normpo mergepot modules i18n reqs run pyc install uninstall all
|