From: Dale Weiler Date: Thu, 21 Mar 2013 02:02:41 +0000 (+0000) Subject: Cross architecture stuff for distro build scripts. If you have an x86_64 capable... X-Git-Tag: before-library~84 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1b02a5204a4fae46dcfef57ecfd6ff2ffe316657;p=xonotic%2Fgmqcc.git Cross architecture stuff for distro build scripts. If you have an x86_64 capable system with a compiler and make (the OS doesn't even matter), simply changing to "distro" directory and typing "make" is sufficent to make archlinux i686/x86_64, and debian i686/x86_64 packages. --- diff --git a/Makefile b/Makefile index 2474204..f35de15 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ DESTDIR := +OPTIONAL:= PREFIX := /usr/local BINDIR := $(PREFIX)/bin DATADIR := $(PREFIX)/share @@ -9,7 +10,7 @@ CYGWIN = $(findstring CYGWIN, $(UNAME)) MINGW = $(findstring MINGW32, $(UNAME)) CC ?= clang -CFLAGS += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char +CFLAGS += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char $(OPTIONAL) ifneq ($(shell git describe --always 2>/dev/null),) CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\"" endif @@ -38,7 +39,7 @@ else endif ifeq ($(track), no) - CFLAGS += -DNOTRACK + CFLAGS += -DNOTRACK endif OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o fs.o utf8.o correct.o diff --git a/distro/Makefile b/distro/Makefile new file mode 100644 index 0000000..ab88955 --- /dev/null +++ b/distro/Makefile @@ -0,0 +1,11 @@ +base: + $(MAKE) -C deb/ + $(MAKE) -C deb/ CARCH=i686 + $(MAKE) -C archlinux/this/ + $(MAKE) -C archlinux/this/ CARCH=i686 + @mv deb/*.deb ./ + @mv archlinux/this/*pkg.tar.xz ./ + +clean: + @rm -f *.deb + @rm -f *.pkg.tar.xz diff --git a/distro/archlinux/this/Makefile b/distro/archlinux/this/Makefile index 6d3b557..df94ff3 100644 --- a/distro/archlinux/this/Makefile +++ b/distro/archlinux/this/Makefile @@ -9,9 +9,16 @@ CARCH := $(shell uname -m) PKGDIR := gmqcc-$(MAJOR).$(MINOR).$(PATCH)-$(PKGREL)-$(CARCH) PKG := $(PKGDIR).pkg.tar.xz PKGINFO := $(PKGDIR)/.PKGINFO +CFLAGS := -base: clean - $(MAKE) -C $(BASEDIR) DESTDIR=distro/archlinux/this/$(PKGDIR) PREFIX=$(PREFIX) install + +ifneq (, $(findstring i686, $(CARCH))) + CFLAGS := -m32 +endif + +base: + $(MAKE) -C $(BASEDIR) clean + $(MAKE) -C $(BASEDIR) OPTIONAL=$(CFLAGS) DESTDIR=distro/archlinux/this/$(PKGDIR) PREFIX=$(PREFIX) install @echo "pkgname = gmqcc" > $(PKGINFO) @echo "pkgver = $(MAJOR).$(MINOR).$(PATCH)-$(PKGREL)" >> $(PKGINFO) @echo "pkgdesc = An Improved Quake C Compiler" >> $(PKGINFO) @@ -34,7 +41,7 @@ base: clean @rm -rf $(PKGDIR) clean: - @rm -f $(PKG) - + $(MAKE) -C $(BASEDIR) clean + @rm -f *.pkg.tar.xz all: base diff --git a/distro/deb/Makefile b/distro/deb/Makefile index 535cf1c..df23602 100644 --- a/distro/deb/Makefile +++ b/distro/deb/Makefile @@ -5,19 +5,39 @@ MAJOR := `sed -n -e '/GMQCC_VERSION_MAJOR/{s/.* .* //;p;q;}' $(HEADER)` MINOR := `sed -n -e '/GMQCC_VERSION_MINOR/{s/.* .* //;p;q;}' $(HEADER)` PATCH := `sed -n -e '/GMQCC_VERSION_PATCH/{s/.* .* //;p;q;}' $(HEADER)` DEBDIR := gmqcc-$(MAJOR).$(MINOR).$(PATCH) -DEB := $(DEBDIR).deb +CARCH := $(shell uname -m) +DEB := $(DEBDIR)-$(CARCH).deb +CONTROL := $(DEBDIR)/DEBIAN/control + +ifneq (, $(findstring i686, $(CARCH))) + CFLAGS := -m32 +endif base: + $(MAKE) -C $(BASEDIR) clean $(MAKE) -C $(BASEDIR) DESTDIR=distro/deb/$(DEBDIR) PREFIX=$(PREFIX) install @install -d -m755 $(DEBDIR)/DEBIAN - @cp control $(DEBDIR)/DEBIAN/control + @echo "Package: gmqcc" > $(CONTROL) + @echo "Version: $(MAJOR).$(MINOR).$(PATCH)" >> $(CONTROL) + @echo "Section: user/hidden" >> $(CONTROL) + @echo "Priority: optional" >> $(CONTROL) + @echo "Architecture: $(CARCH)" >> $(CONTROL) + @echo "Installed-Size: `du -ks $($(DEBDIR)/usr) | cut -f 1`" >> $(CONTROL) + @echo "Maintainer: Dale Weiler " >> $(CONTROL) + @echo "Description: An improved Quake C Compiler" >> $(CONTROL) + @echo " For an enduring period of time the options for a decent compiler for the Quake C programming language" >> $(CONTROL) + @echo " were confined to a specific compiler known as QCC. Attempts were made to extend and improve upon the" >> $(CONTROL) + @echo " design of QCC, but many foreseen the consequences of building on a broken foundation. The solution" >> $(CONTROL) + @echo " was obvious, a new compiler; one born from the NIH realm of sarcastic wit. We welcome you. You won't" >> $(CONTROL) + @echo " find a better Quake C compiler." >> $(CONTROL) @tar czf data.tar.gz -C $(DEBDIR)/ . --exclude=DEBIAN @tar czf control.tar.gz -C $(DEBDIR)/DEBIAN/ . @echo 2.0 > debian-binary @ar r $(DEB) debian-binary control.tar.gz data.tar.gz @rm -rf debian-binary control.tar.gz data.tar.gz $(DEBDIR) -clean: - @rm -f $(DEB) +clean: + $(MAKE) -C $(BASEDIR) clean + @rm -f *.deb all: base diff --git a/distro/deb/control b/distro/deb/control deleted file mode 100644 index 57cde3a..0000000 --- a/distro/deb/control +++ /dev/null @@ -1,13 +0,0 @@ -Package: gmqcc -Version: 0.3.0 -Section: user/hidden -Priority: optional -Architecture: i386 -Installed-Size: `du -ks usr|cut -f 1` -Maintainer: Dale Weiler -Description: An improved Quake C Compiler - For an enduring period of time the options for a decent compiler for the Quake C programming language - were confined to a specific compiler known as QCC. Attempts were made to extend and improve upon the - design of QCC, but many foreseen the consequences of building on a broken foundation. The solution - was obvious, a new compiler; one born from the NIH realm of sarcastic wit. We welcome you. You won't - find a better Quake C compiler.