<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
  img {
    max-width: 100%;
    height: auto;
  }
  p.details {
    font-style:italic;
    color:#777
  }
  .footer p {
    font-size:small;
    color:#777
  }
  pre.commit-message {
    white-space: pre-wrap;
  }
  .file-stats a {
    text-decoration: none;
  }
  .file-stats .new-file {
    color: #090;
  }
  .file-stats .deleted-file {
    color: #B00;
  }
</style>
<body>
<div class='content'>
<h3>
Andrew Price pushed to branch master
at <a href="https://projects.sucs.org/arthur/mw">Justin Mitchell / mw</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942">c73d5b10</a></strong>
<div>
<span>by Andrew Price</span>
<i>at 2016-03-04T01:58:57+00:00</i>
</div>
<pre class='commit-message'>Build system improvements

Various cleanups and simplifications of the makefiles, plus:

- an additional 'make RELEASE_BUILD=1' mode which switches on
  optimisation and -D_FORTIFY_SOURCE=2, and switches off -Werror
- Use RELEASE_BUILD=1 in rpm and deb packaging
- Build with PIE and full RELRO by default
- Add CFLAGS_APPEND to append options instead of overriding CFLAGS</pre>
</li>
</ul>
<h4>9 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
Makefile
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
Makefile.common
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
debian-template/rules
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
mw.spec
</a>
</li>
<li class='file-stats'>
<a href='#diff-4'>
src/Makefile
</a>
</li>
<li class='file-stats'>
<a href='#diff-5'>
src/client/Makefile
</a>
</li>
<li class='file-stats'>
<a href='#diff-6'>
src/client/js.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-7'>
src/server/Makefile
</a>
</li>
<li class='file-stats'>
<a href='#diff-8'>
src/utils/Makefile
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942#diff-0'>
<strong>
Makefile
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/Makefile
</span><span style="color: #000000;background-color: #ddffdd">+++ b/Makefile
</span><span style="color: #aaaaaa">@@ -6,11 +6,15 @@ build:
</span>   $(MAKE) -C src $@
        $(MAKE) -C po $@
 
<span style="color: #000000;background-color: #ffdddd">-ifeq ($(GITVER),)
-# These rules can only be called from inside an exported tree
-install:
</span><span style="color: #000000;background-color: #ddffdd">+# The non source files that should get installed
+INSTALLFILES = colour help login.banner scripthelp talkhelp wizhelp COPYING INSTALL LICENSE README
+install-home:
</span>   install -d $(DESTDIR)$(libdir)/mw
        cp -a $(INSTALLFILES) $(DESTDIR)$(libdir)/mw/
<span style="color: #000000;background-color: #ddffdd">+
+ifeq ($(GITVER),)
+# These rules can only be called from inside an exported tree
+install: install-home
</span>   install -d $(DESTDIR)$(initddir)
        install mwserv.init $(DESTDIR)$(initddir)/mwserv
        $(MAKE) -C src $@
<span style="color: #aaaaaa">@@ -63,4 +67,4 @@ clean:
</span> version:
        @echo $(VERSION)
 
<span style="color: #000000;background-color: #ffdddd">-.PHONY: build clean rpm deb tarball export install version
</span><span style="color: #000000;background-color: #ddffdd">+.PHONY: build clean rpm deb tarball export install-static install version
</span></code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942#diff-1'>
<strong>
Makefile.common
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/Makefile.common
</span><span style="color: #000000;background-color: #ddffdd">+++ b/Makefile.common
</span><span style="color: #aaaaaa">@@ -10,6 +10,9 @@ endif
</span> 
 MWVERSION = mw3-$(VERSION)
 
<span style="color: #000000;background-color: #ddffdd">+# Build with `make RELEASE_BUILD=1` to disable debugging features and enable optimisation
+RELEASE_BUILD ?= 0
+
</span> prefix ?= /usr
 libdir ?= $(prefix)/lib
 bindir ?= $(prefix)/bin
<span style="color: #aaaaaa">@@ -17,9 +20,6 @@ datadir ?= $(prefix)/share
</span> localstatedir ?= /var
 initddir ?= /etc/init.d
 
<span style="color: #000000;background-color: #ffdddd">-# The non source files that should get installed
-INSTALLFILES = colour help login.banner scripthelp talkhelp wizhelp COPYING INSTALL LICENSE README
-
</span> LOGDIR := $(localstatedir)/log/mw
 MSGDIR := $(localstatedir)/run/mw
 STATEDIR := $(localstatedir)/lib/mw
<span style="color: #aaaaaa">@@ -29,21 +29,33 @@ GCCMAJOR := $(echo __GNUC__ | $compiler -E -xc - | tail -n 1)
</span> GCCMINOR := $(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1)
 GCCVER := $(shell printf "%02d%02d" $(GCCMAJOR) $(GCCMINOR))
 
<span style="color: #000000;background-color: #ffdddd">-JSDIR=$(DEPTH)mozjs/installroot
-JSFLAGS=-include $(JSDIR)/usr/include/js-17.0/js/RequiredDefines.h -I/usr/include/nspr -I$(JSDIR)/usr/include/js-17.0
-JSOBJ=$(DEPTH)mozjs/installroot/usr/lib/libmozjs-17.0.a
-JSSCRIPTTYPE=JSScript
-
-# cflags for standard 'cc' compiler
-CFLAGS+= -Wall -Wshadow -Wmissing-prototypes -Wpointer-arith -Wwrite-strings -Wcast-align -Wbad-function-cast -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing -pedantic -std=gnu99 -D_GNU_SOURCE $(JSFLAGS) -DJSSCRIPTTYPE=$(JSSCRIPTTYPE)
</span><span style="color: #000000;background-color: #ddffdd">+JSDIR = $(DEPTH)mozjs/installroot
+JSOBJ = $(JSDIR)/usr/lib/libmozjs-17.0.a
+JSFLAGS = \
+       -include $(JSDIR)/usr/include/js-17.0/js/RequiredDefines.h \
+       -I/usr/include/nspr \
+       -I$(JSDIR)/usr/include/js-17.0
+
+WARNINGS = \
+       -Wall \
+       -Wshadow \
+       -Wmissing-prototypes \
+       -Wpointer-arith \
+       -Wwrite-strings \
+       -Wcast-align \
+       -Wbad-function-cast \
+       -Wmissing-format-attribute \
+       -Wformat=2 \
+       -Wformat-security \
+       -Wformat-nonliteral \
+       -Wno-long-long \
+       -Wno-strict-aliasing \
</span> 
 # until gcc catches up (4.7.x is good)
<span style="color: #000000;background-color: #ffdddd">-CFLAGS += $(shell if [ $(GCCVER) -lt 0406 ] ; then echo "-Wno-multichar"; fi )
</span><span style="color: #000000;background-color: #ddffdd">+WARNINGS += $(shell if [ $(GCCVER) -lt 0406 ] ; then echo "-Wno-multichar"; fi )
</span> 
<span style="color: #000000;background-color: #ffdddd">-ifdef WITHPIE
-CFLAGS += -fpie
-LDFLAGS += -pie
-endif
</span><span style="color: #000000;background-color: #ddffdd">+CCSEC = -fpie -fstack-protector-all
+LDSEC = -pie -Wl,-z,relro,-z,now
</span> 
 # info strings, do not edit.
 DEFS:= -DBUILD_DATE=\"$(shell date +%Y%m%d)\"
<span style="color: #aaaaaa">@@ -54,17 +66,30 @@ DEFS+= -DLOGDIR=\"$(LOGDIR)\"
</span> DEFS+= -DSTATEDIR=\"$(STATEDIR)\"
 DEFS+= -DMSGDIR=\"$(MSGDIR)\"
 
<span style="color: #000000;background-color: #ffdddd">-### uncomment for gdb debugging
-LDFLAGS+= -ggdb -g
-CFLAGS+= -ggdb -g -D__NO_STRING_INLINE -fstack-protector-all
</span><span style="color: #000000;background-color: #ddffdd">+DEFS+= -D_GNU_SOURCE
</span> 
<span style="color: #000000;background-color: #ffdddd">-### Optimisation - uncomment for release & extra testing
-CFLAGS+=-O0 -Werror
</span><span style="color: #000000;background-color: #ddffdd">+# Set debugging and optimisation features depending on the build type
+MWLDFLAGS += $(LDSEC)
+ifneq ($(RELEASE_BUILD),0)
+MWLDFLAGS += -O2
+else
+MWLDFLAGS += -O0
+endif
</span> 
<span style="color: #000000;background-color: #ffdddd">-CFLAGS += $(DEFS)
</span><span style="color: #000000;background-color: #ddffdd">+MWCFLAGS = -std=gnu99 -pedantic -g $(DEFS) $(JSFLAGS) $(CCSEC) $(WARNINGS)
+ifneq ($(RELEASE_BUILD),0)
+MWCFLAGS += -O2
+# This requires optimisation so add it here instead of CCSEC
+MWCFLAGS += -D_FORTIFY_SOURCE=2
+else
+MWCFLAGS += -O0 -Werror
+endif
</span> 
 ### The magic which lets us autogenerate dependencies
<span style="color: #000000;background-color: #ffdddd">-CFLAGS += -MMD
</span><span style="color: #000000;background-color: #ddffdd">+CFLAGS = $(MWCFLAGS) -MMD
+LDFLAGS = $(MWLDFLAGS)
+# Let the user add some flags at the end
+CFLAGS_APPEND =
</span> 
 CODE=$(wildcard *.c)
 HDRS=$(wildcard *.h)
<span style="color: #aaaaaa">@@ -72,7 +97,7 @@ HDRS=$(wildcard *.h)
</span> all: build
 
 %.o: %.c
<span style="color: #000000;background-color: #ffdddd">-        $(CC) $(CFLAGS) -c -o $@ $<
</span><span style="color: #000000;background-color: #ddffdd">+   $(CC) $(CFLAGS) $(CFLAGS_APPEND) -c -o $@ $<
</span> 
 -include $(CODE:.c=.d)
 
</code></pre>

<br>
</li>
<li id='diff-2'>
<a href='https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942#diff-2'>
<strong>
debian-template/rules
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/debian-template/rules
</span><span style="color: #000000;background-color: #ddffdd">+++ b/debian-template/rules
</span><span style="color: #aaaaaa">@@ -1,5 +1,6 @@
</span> #!/usr/bin/make -f
 #export DH_VERBOSE=1
<span style="color: #000000;background-color: #ddffdd">+export RELEASE_BUILD=1
</span> 
 %:
        dh $@
</code></pre>

<br>
</li>
<li id='diff-3'>
<a href='https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942#diff-3'>
<strong>
mw.spec
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/mw.spec
</span><span style="color: #000000;background-color: #ddffdd">+++ b/mw.spec
</span><span style="color: #aaaaaa">@@ -22,7 +22,7 @@ architecture, intended to be used over telnet or similar.
</span> %setup -q
 
 %build
<span style="color: #000000;background-color: #ffdddd">-make libdir="%{_libdir}" bindir="%{_bindir}"
</span><span style="color: #000000;background-color: #ddffdd">+make libdir="%{_libdir}" bindir="%{_bindir}" RELEASE_BUILD=1
</span> 
 %install
 make DESTDIR=$RPM_BUILD_ROOT prefix=/usr libdir="%{_libdir}" install
</code></pre>

<br>
</li>
<li id='diff-4'>
<a href='https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942#diff-4'>
<strong>
src/Makefile
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/Makefile
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/Makefile
</span><span style="color: #aaaaaa">@@ -37,14 +37,11 @@ cleanall: clean
</span> 
 ifndef TESTDIR
 test testclean:
<span style="color: #000000;background-color: #ffdddd">-        $(MAKE) TESTDIR=$(CURDIR)/mwtest $@
</span><span style="color: #000000;background-color: #ddffdd">+   $(MAKE) TESTDIR="$(CURDIR)/mwtest" $@
</span> else
 test:
<span style="color: #000000;background-color: #ffdddd">-        mkdir -p "$(TESTDIR)"
</span><span style="color: #000000;background-color: #ddffdd">+   $(MAKE) -C $(SRCROOT) DESTDIR="$(TESTDIR)" install-home
</span>   cd "$(TESTDIR)" && mkdir -p mw run/mw log/mw lib/mw
<span style="color: #000000;background-color: #ffdddd">-        for d in $(INSTALLFILES); do \
-               cp -a ../$$d $(TESTDIR)/mw/ ; \
-       done
</span>   $(MAKE) libdir="$(TESTDIR)" localstatedir="$(TESTDIR)" all
        $(MAKE) -C utils libdir="$(TESTDIR)" localstatedir="$(TESTDIR)" all
 
</code></pre>

<br>
</li>
<li id='diff-5'>
<a href='https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942#diff-5'>
<strong>
src/client/Makefile
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/Makefile
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/Makefile
</span><span style="color: #aaaaaa">@@ -3,7 +3,6 @@ DEPTH=../../
</span> include ../../Makefile.common
 
 LDLIBS+= -lreadline -ltermcap -lcrypt -lsqlite3 -lcurl -lpthread -lcrypto -ljansson -lz -lm
<span style="color: #000000;background-color: #ffdddd">-LDFLAGS+= -L..
</span> CFLAGS+= -I..
 
 build: mw
</code></pre>

<br>
</li>
<li id='diff-6'>
<a href='https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942#diff-6'>
<strong>
src/client/js.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/js.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/js.c
</span><span style="color: #aaaaaa">@@ -1127,11 +1127,7 @@ js_error_handler(JSContext __attribute__((unused)) *cx, const char *msg, JSError
</span> int load_jsfile(FILE *f, const char *filename)
 {
        JSBool success;
<span style="color: #000000;background-color: #ffdddd">-#ifdef JSSCRIPTTYPE
-       JSSCRIPTTYPE *script;
-#else
-#error "JSSCRIPTTYPE not defined"
-#endif
</span><span style="color: #000000;background-color: #ddffdd">+   JSScript *script;
</span>   jsval retval;
 
        /* Compile the js file specified */
</code></pre>

<br>
</li>
<li id='diff-7'>
<a href='https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942#diff-7'>
<strong>
src/server/Makefile
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/server/Makefile
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/server/Makefile
</span><span style="color: #aaaaaa">@@ -4,13 +4,9 @@ include $(DEPTH)Makefile.common
</span> 
 CFLAGS+= -I..
 LDLIBS+= -ljansson -lsqlite3
<span style="color: #000000;background-color: #ffdddd">-LDFLAGS+= -L..
</span> 
 build: mwserv
 
<span style="color: #000000;background-color: #ffdddd">-### The magic which lets us autogenerate dependencies
-CFLAGS += -MMD
-
</span> mwserv: $(CODE:.c=.o) ../libmw.a $(JSOBJ)
        $(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^
 
</code></pre>

<br>
</li>
<li id='diff-8'>
<a href='https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942#diff-8'>
<strong>
src/utils/Makefile
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/utils/Makefile
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/utils/Makefile
</span><span style="color: #aaaaaa">@@ -2,7 +2,6 @@ SRCROOT = $(CURDIR)/../..
</span> DEPTH=../../
 include ../../Makefile.common
 
<span style="color: #000000;background-color: #ffdddd">-LDFLAGS+= -L..
</span> CFLAGS+= -I.. -Wno-error
 
 all: mwnci listuser fixuser del_user sizes
</code></pre>

<br>
</li>

</div>
<div class='footer' style='margin-top: 10px;'>
<p>

<br>
<a href="https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942">View it on GitLab</a>.
<br>
You're receiving this email because of your account on projects.sucs.org.
If you'd like to receive fewer emails, you can
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://projects.sucs.org/arthur/mw/commit/c73d5b1086860d7ab466798e57f7fe06fcd84942"}}</script>
</p>
</div>
</body>
</html>