Blob Blame History Raw
From 7458c82f2a6d183f86f217f57afa2615b396c19c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kone=C4=8Dn=C3=BD?=
 <DragonLichcz@gmail.com>
Date: Mon, 2 Nov 2015 22:20:09 +0100
Subject: [PATCH 1/3] Add Makefile to build and install playonlinux

Build check_direct_rendering.c to bin folder.
Build pyc files for python source codes.
Create executable files for /usr/bin.
Install playonlinux to DESTDIR if nothing set use install to / and user
can also specify the PREFIX of the installation.
As bonus could create changelog from git.
---
 Makefile | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 Makefile

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2e7c538
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,74 @@
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Authors:		Jiri Konecny <dragonlichcz@gmail.com>
+
+
+# Arguments:
+#
+# PREFIX  -- Set prefix for the installation (/usr is default)
+# DESTDIR -- Where you want to install
+#
+
+CFLAGS ?= -O2
+CC = gcc $(CFLAGS)
+PYTHON = python2 -m py_compile
+GZIP = gzip
+
+PREFIX ?= /usr
+DESTDIR ?= # root dir
+
+CFLAGS += -lGL -lX11
+
+sharedir := $(DESTDIR)$(PREFIX)/share
+bindir := $(DESTDIR)$(PREFIX)/bin
+
+all: build
+
+clean:
+	$(RM) ./python/*.pyc
+	$(RM) ./python/lib/*.pyc
+	$(RM) ./bin/check_dd
+	$(RM) ./bin/playonlinux
+	$(RM) ./bin/playonlinux-pkg
+	$(RM) ./ChangeLog
+
+build:
+	$(CC) ./src/check_direct_rendering.c -o ./bin/check_dd
+	$(PYTHON) ./python/*.py
+	$(PYTHON) ./python/lib/*.py
+	echo -e '#!/bin/bash\n${sharedir}/playonlinux/playonlinux "$$@"\nexit 0' > ./bin/playonlinux
+	echo -e '#!/bin/bash\n${sharedir}/playonlinux/playonlinux-pkg "$$@"\nexit 0' > ./bin/playonlinux-pkg
+	chmod +x ./bin/playonlinux
+	chmod +x ./bin/playonlinux-pkg
+
+install:
+	install -d $(bindir)
+	install -d $(sharedir)/pixmaps
+	install -d $(sharedir)/applications
+	install -d $(sharedir)/playonlinux/bin
+	install -d $(sharedir)/man/man1
+	$(GZIP) -c ./doc/playonlinux-pkg.1 > $(sharedir)/man/man1/playonlinux-pkg.1.gz
+	$(GZIP) -c ./doc/playonlinux.1 > $(sharedir)/man/man1/playonlinux.1.gz
+	cp ./etc/PlayOnLinux.desktop $(sharedir)/applications/PlayOnLinux.desktop
+	cp ./etc/playonlinux.png $(sharedir)/pixmaps/playonlinux.png
+	cp ./etc/playonlinux16.png $(sharedir)/pixmaps/playonlinux16.png
+	cp ./etc/playonlinux32.png $(sharedir)/pixmaps/playonlinux32.png
+	cp ./bin/{playonlinux,playonlinux-pkg} $(bindir)/
+	cp ./{playonlinux*,README.md,TRANSLATORS,CHANGELOG.md,LICENCE} $(sharedir)/playonlinux/
+	cp -R ./{bash,etc,lang,lib,plugins,python,resources,tests} $(sharedir)/playonlinux/
+
+changelog:
+	(GIT_DIR=.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
+
+.PHONY: all clean build install changelog
-- 
2.5.0