SRB2/debian/rules

149 lines
4.8 KiB
Text
Raw Permalink Normal View History

2014-03-15 16:59:03 +00:00
#!/usr/bin/make -f
# -*- makefile -*-
#############################################################################
#
# GNU Make Debian package makefile for SRB2
#
# Copyright (C) 1998-2010 by Callum Dickinson
#
# 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 2
# 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.
#
# This file most likely will not need to be modified to make
# branches of SRB2 capable of making their own Debian packages,
# instead look at the /debian/control file for configuration.
#
#############################################################################
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# user/group of to-be-installed files
ROOT_USER := 0
ROOT_GROUP := 0
# determine cross-compile (may need some work)
CROSS_COMPILE_BUILD := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CROSS_COMPILE_HOST := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
CROSS_COMPILE := $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "$(CROSS_COMPILE_HOST)")
MKDIR = mkdir -p
MAKE = make
INSTALL = install -o $(ROOT_USER) -g $(ROOT_GROUP) -m 644
MV = mv
RM = rm -rf
STRIPARGS = --strip-unneeded
ifdef CROSS_COMPILE
STRIP = $(CROSS_COMPILE_HOST)-strip $(STRIPARGS)
else
STRIP = strip $(STRIPARGS)
endif
DIR := $(shell pwd)
# FIXME: hate hate hate head/tail hack :(
CONTROLF = $(DIR)/debian/control
PACKAGE = srb2
DBGPKG = $(PACKAGE)-dbg
TITLE = Sonic Robo Blast 2
SECTION = Games/Action
EXENAME = srb2
DBGNAME = debug/$(EXENAME)
PKGDIR = usr/games
DBGDIR = usr/lib/debug/$(PKGDIR)
2016-02-06 23:08:53 +00:00
PIXMAPS_DIR = usr/share/pixmaps
DESKTOP_DIR = usr/share/applications
2014-03-15 16:59:03 +00:00
PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)")
OS = LINUX=1
NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "NONX86=1")
MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng NOOBJDUMP=1
2014-03-15 16:59:03 +00:00
MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)"
MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)"
# FIXME pkg-config dir hacks
2016-02-06 22:25:27 +00:00
export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig
2014-03-15 16:59:03 +00:00
BINDIR := $(DIR)/bin/Linux/Release
2016-02-06 22:25:27 +00:00
LDFLAGS += "-Wl,-rpath=/usr/lib/$(CROSS_COMPILE_HOST)"
2014-03-15 16:59:03 +00:00
build:
$(MKDIR) $(BINDIR)/debug
$(MAKE) -C $(DIR)/src $(MAKEARGS)
$(STRIP) $(BINDIR)/$(EXENAME)
binary-indep:
# only here to kill Lintian warning
echo "no need to do any arch-independent stuff"
binary-arch:
2016-02-06 23:08:53 +00:00
# create ddirs
2014-03-15 16:59:03 +00:00
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DBGDIR)
2016-02-06 23:08:53 +00:00
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DESKTOP_DIR)
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(PIXMAPS_DIR)
# install main binaries
2014-03-15 16:59:03 +00:00
$(INSTALL) $(BINDIR)/$(EXENAME) $(DIR)/debian/tmp/$(PKGDIR)/$(PACKAGE)
$(INSTALL) $(BINDIR)/$(DBGNAME) $(DIR)/debian/tmp/$(DBGDIR)/$(PACKAGE)
# Install desktop file and banner image
$(INSTALL) $(DIR)/srb2.png $(DIR)/debian/tmp/usr/share/pixmaps
$(INSTALL) $(DIR)/debian/srb2.desktop $(DIR)/debian/tmp/usr/share/applications
2014-03-15 16:59:03 +00:00
# add compiled binaries to include-binaries
echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries
echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries
# Generate install folder files
echo $(PKGDIR) > $(DIR)/debian/$(PACKAGE).install
2016-02-07 03:17:14 +00:00
echo $(DESKTOP_DIR) >> $(DIR)/debian/$(PACKAGE).install
echo $(PIXMAPS_DIR) >> $(DIR)/debian/$(PACKAGE).install
2014-03-15 16:59:03 +00:00
echo $(DBGDIR) > $(DIR)/debian/$(DBGPKG).install
binary: binary-arch
# Generate .desktop specifications
echo "`echo '$(MENUFILE1)\\'`" > $(DIR)/debian/menu
echo " `echo '$(MENUFILE2)'`" >> $(DIR)/debian/menu
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
# dh_installexamples
dh_install --sourcedir=$(DIR)/debian/tmp
dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_python
# dh_installinit
# dh_installcron
# dh_installinfo
# dh_installman
# dh_link
dh_compress
dh_fixperms
# dh_perl
# dh_makeshlibs
dh_installdeb
-dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
clean:
$(MAKE) -C $(DIR)/src $(MAKEARGS) clean cleandep
$(RM) $(BINDIR)/*
$(RM) $(DIR)/debian/$(PACKAGE)/*
$(RM) $(DIR)/debian/$(DBGPKG)/*
$(RM) $(DIR)/debian/tmp/*
$(RM) $(DIR)/debian/$(PACKAGE).install
$(RM) $(DIR)/debian/$(DBGPKG).install
$(RM) $(DIR)/debian/menu
$(RM) $(DIR)/debian/files
$(RM) $(DIR)/debian/source/include-binaries
.PHONY: all clean binary binary-arch binary-indep build