1
0
Fork 0
mirror of https://github.com/kbumsik/VirtScreen.git synced 2025-02-12 11:21:53 +00:00
VirtScreen/Makefile

106 lines
2.9 KiB
Makefile
Raw Normal View History

# See https://packaging.python.org/tutorials/distributing-packages/#packaging-your-project
# for python packaging reference.
VERSION ?= 0.2.4
2018-06-18 00:14:40 +00:00
DOCKER_NAME=kbumsik/virtscreen
DOCKER_RUN=docker run --interactive --tty -v $(shell pwd):/app $(DOCKER_NAME)
DOCKER_RUN_TTY=docker run --interactive --tty -v $(shell pwd):/app $(DOCKER_NAME)
2018-06-18 00:14:40 +00:00
.ONESHELL:
2018-06-28 14:26:41 +00:00
# Run script
run:
python3 -m virtscreen
2018-06-26 07:33:46 +00:00
# Docker tools
.PHONY: docker docker-build
2018-05-23 01:26:17 +00:00
2018-06-18 00:14:40 +00:00
docker:
2018-06-18 07:11:21 +00:00
$(DOCKER_RUN_TTY) /bin/bash
2018-06-26 07:33:46 +00:00
docker-build:
docker build -f Dockerfile -t $(DOCKER_NAME) .
2018-06-18 00:14:40 +00:00
2018-06-26 07:33:46 +00:00
# Python wheel package for PyPI
.PHONY: wheel-clean
package/pypi/%.whl:
python3 setup.py bdist_wheel --universal
cp dist/* package/pypi
-rm -rf build dist *.egg-info
2018-05-23 01:26:17 +00:00
2018-06-26 07:33:46 +00:00
wheel-clean:
-rm package/pypi/virtscreen*.whl
2018-06-18 00:14:40 +00:00
# For AppImage packaging, https://github.com/AppImage/AppImageKit/wiki/Creating-AppImages
2018-06-26 07:33:46 +00:00
.PHONY: appimage-clean
.SECONDARY: package/appimage/VirtScreen-x86_64.AppImage
2018-06-26 07:33:46 +00:00
package/appimage/%.AppImage:
$(DOCKER_RUN) package/appimage/build.sh
$(DOCKER_RUN) chown -R $(shell id -u):$(shell id -u) package/appimage
appimage-clean:
2018-06-26 07:33:46 +00:00
-rm -rf package/appimage/virtscreen.AppDir package/appimage/VirtScreen-x86_64.AppImage
# For Debian packaging, https://www.debian.org/doc/manuals/maint-guide/index.en.html
# https://www.debian.org/doc/manuals/debmake-doc/ch08.en.html#setup-py
2018-06-26 07:33:46 +00:00
.PHONY: deb-contents deb-clean
2018-05-23 01:26:17 +00:00
package/debian/%.deb: package/appimage/VirtScreen-x86_64.AppImage
$(DOCKER_RUN) package/debian/build.sh
$(DOCKER_RUN) chown -R $(shell id -u):$(shell id -u) package/debian
2018-06-26 07:33:46 +00:00
deb-contents:
2018-06-26 09:02:30 +00:00
$(DOCKER_RUN) dpkg -c package/debian/*.deb
2018-06-03 15:55:15 +00:00
2018-05-23 01:26:17 +00:00
deb-clean:
rm -rf package/debian/build package/debian/*.deb package/debian/*.buildinfo \
package/debian/*.changes
2018-05-21 19:09:42 +00:00
# For AUR: https://wiki.archlinux.org/index.php/Python_package_guidelines
# and: https://wiki.archlinux.org/index.php/Creating_packages
2018-06-26 07:33:46 +00:00
.PHONY: arch-upload arch-clean
2018-06-26 07:33:46 +00:00
arch-upload: package/archlinux/.SRCINFO
2018-05-21 19:09:42 +00:00
cd package/archlinux
git clone ssh://aur@aur.archlinux.org/virtscreen.git
cp PKGBUILD virtscreen
cp .SRCINFO virtscreen
cd virtscreen
git add --all
git commit
git push
cd ..
rm -rf virtscreen
2018-06-26 07:33:46 +00:00
package/archlinux/.SRCINFO:
cd package/archlinux
makepkg --printsrcinfo > .SRCINFO
arch-clean:
cd package/archlinux
2018-06-26 07:33:46 +00:00
-rm -rf pkg src *.tar* .SRCINFO
# Override version
.PHONY: override-version
override-version:
# Update python setup.py
perl -pi -e "s/version=\'\d+\.\d+\.\d+\'/version=\'$(VERSION)\'/" \
setup.py
# Update .json files in the module
perl -pi -e "s/\"version\"\s*\:\s*\"\d+\.\d+\.\d+\"/\"version\"\: \"$(VERSION)\"/" \
virtscreen/assets/data.json
perl -pi -e "s/\"version\"\s*\:\s*\"\d+\.\d+\.\d+\"/\"version\"\: \"$(VERSION)\"/" \
virtscreen/assets/config.default.json
# Arch AUR
perl -pi -e "s/pkgver=\d+\.\d+\.\d+/pkgver=$(VERSION)/" \
package/archlinux/PKGBUILD
# Debian
perl -pi -e "s/PKGVER=\d+\.\d+\.\d+/PKGVER=$(VERSION)/" \
package/debian/build.sh
2018-06-26 07:33:46 +00:00
# Clean packages
clean: appimage-clean arch-clean deb-clean wheel-clean