Skip to content

Commit

Permalink
Debian|Builder: Added new script for generating source package metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 4, 2019
1 parent 97d2163 commit 19af6d9
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 0 deletions.
41 changes: 41 additions & 0 deletions doomsday/build/debian/gen.py
@@ -0,0 +1,41 @@
#!/usr/bin/python
#
# This script will generate the debian/ directory required for creating
# a source package. Binary packages are created by CPack, so they do
# not need this.

import os, subprocess, sys

DENG_ROOT = os.getcwd()
OUT_DIR = os.path.join(DENG_ROOT, 'debian')
TEMPLATE_DIR = os.path.join(DENG_ROOT, 'doomsday/build/debian/template')

if not os.path.exists(OUT_DIR):
os.mkdir(OUT_DIR)

ARCH = subprocess.check_output(['dpkg', '--print-architecture']).strip()
DEBFULLNAME = os.getenv('DEBFULLNAME')
DEBEMAIL = os.getenv('DEBEMAIL')
PACKAGE = 'doomsday'
BUILDNUMBER = sys.argv[1]

control = open(os.path.join(TEMPLATE_DIR, 'control'), 'r').read()
control = control.replace('${Package}', PACKAGE)
control = control.replace('${Arch}', ARCH)
control = control.replace('${DEBFULLNAME}', DEBFULLNAME)
control = control.replace('${DEBEMAIL}', DEBEMAIL)
open(os.path.join(OUT_DIR, 'control'), 'w').write(control)

rules = open(os.path.join(TEMPLATE_DIR, 'rules'), 'r').read()
rules = rules.replace('${BuildNumber}', BUILDNUMBER)
open(os.path.join(OUT_DIR, 'rules'), 'w').write(rules)

compat = open(os.path.join(TEMPLATE_DIR, 'compat'), 'r').read()
open(os.path.join(OUT_DIR, 'compat'), 'w').write(compat)

copyright = open(os.path.join(TEMPLATE_DIR, 'copyright'), 'r').read()
open(os.path.join(OUT_DIR, 'copyright'), 'w').write(copyright)

docs = open(os.path.join(TEMPLATE_DIR, 'docs'), 'r').read()
open(os.path.join(OUT_DIR, 'docs'), 'w').write(docs)

9 changes: 9 additions & 0 deletions doomsday/build/debian/template/.gitignore
@@ -0,0 +1,9 @@
control
*.ex
*.EX
*.substvars
*.log
source
files
doomsday
changelog
1 change: 1 addition & 0 deletions doomsday/build/debian/template/compat
@@ -0,0 +1 @@
7
29 changes: 29 additions & 0 deletions doomsday/build/debian/template/copyright
@@ -0,0 +1,29 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: deng
Source: http://dengine.net/

Files: *
Copyright: 1999-2011 Jaakko Keränen <jaakko.keranen@iki.fi>
License: GPL-2.0+

Files: debian/*
Copyright: 2011 Jaakko Keränen <jaakko.keranen@iki.fi>
License: GPL-3.0+

License: GPL-3.0+
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 package 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/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

Empty file.
64 changes: 64 additions & 0 deletions doomsday/build/debian/template/rules
@@ -0,0 +1,64 @@
#!/usr/bin/make -f
APPNAME := doomsday

builddir:
mkdir -p builddir

builddir/Makefile: builddir
cd builddir && QTCHOOSER_RUNTOOL=qmake QT_SELECT=5 cmake \
-DQMAKE=qtchooser \
-DCMAKE_BUILD_TYPE=Release \
-DDENG_BUILD=${BuildNumber} \
-DCMAKE_CXX_FLAGS=-std=c++11 \
-DDENG_ENABLE_COTIRE=OFF \
../../doomsday

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp

build-stamp: builddir/Makefile
dh_testdir
# Add here commands to compile the package.
cd builddir && $(MAKE)
touch $@

clean:
dh_testdir
dh_testroot
rm -f build-stamp
# Add here commands to clean up after the build process.
rm -rf builddir
dh_clean
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs

# Add here commands to install the package into debian/your_appname
cd builddir && $(MAKE) DESTDIR=$(CURDIR)/debian/$(APPNAME) install

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installdocs
dh_installexamples
dh_installman
dh_link
#dh_strip --dbg-package=my-application-dbg
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

0 comments on commit 19af6d9

Please sign in to comment.