summaryrefslogtreecommitdiff
path: root/bld
diff options
context:
space:
mode:
authorSeonah Moon <seonah1.moon@samsung.com>2016-04-07 14:01:07 +0900
committerSeonah Moon <seonah1.moon@samsung.com>2016-04-07 14:01:28 +0900
commit9acb9eb162ab31ca7d23350c508b207a775da79f (patch)
tree42dc00b1f72e043d48e274170275bbed32dcfa70 /bld
parent282cb37dd9a95cafc948b14cb782a229f6511f71 (diff)
downloaddnsmasq-9acb9eb162ab31ca7d23350c508b207a775da79f.tar.gz
dnsmasq-9acb9eb162ab31ca7d23350c508b207a775da79f.tar.bz2
dnsmasq-9acb9eb162ab31ca7d23350c508b207a775da79f.zip
Change-Id: Ic7e94612466be7786c3d2b0724d745c7720e01c9 Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
Diffstat (limited to 'bld')
-rw-r--r--bld/Android.mk8
-rwxr-xr-xbld/bloat-o-meter130
-rwxr-xr-xbld/get-version31
-rwxr-xr-xbld/install-man2
-rwxr-xr-xbld/install-mo2
-rwxr-xr-xbld/pkg-wrapper37
6 files changed, 203 insertions, 7 deletions
diff --git a/bld/Android.mk b/bld/Android.mk
index 373a783..5364ee7 100644
--- a/bld/Android.mk
+++ b/bld/Android.mk
@@ -6,7 +6,11 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := bpf.c cache.c dbus.c dhcp.c dnsmasq.c \
forward.c helper.c lease.c log.c \
netlink.c network.c option.c rfc1035.c \
- rfc2131.c tftp.c util.c
+ rfc2131.c tftp.c util.c conntrack.c \
+ dhcp6.c rfc3315.c dhcp-common.c outpacket.c \
+ radv.c slaac.c auth.c ipset.c domain.c \
+ dnssec.c dnssec-openssl.c blockdata.c tables.c \
+ loop.c inotify.c poll.c
LOCAL_MODULE := dnsmasq
@@ -15,4 +19,6 @@ LOCAL_C_INCLUDES := external/dnsmasq/src
LOCAL_CFLAGS := -O2 -g -W -Wall -D__ANDROID__ -DNO_IPV6 -DNO_TFTP -DNO_SCRIPT
LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
+LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
+
include $(BUILD_EXECUTABLE)
diff --git a/bld/bloat-o-meter b/bld/bloat-o-meter
new file mode 100755
index 0000000..6db2a5e
--- /dev/null
+++ b/bld/bloat-o-meter
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+#
+# Copyright 2004 Matt Mackall <mpm@selenic.com>
+#
+# Inspired by perl Bloat-O-Meter (c) 1997 by Andi Kleen
+#
+# This software may be used and distributed according to the terms
+# of the GNU General Public License, incorporated herein by reference.
+
+import sys, os#, re
+
+def usage():
+ sys.stderr.write("usage: %s [-t] file1 file2\n" % sys.argv[0])
+ sys.exit(-1)
+
+f1, f2 = (None, None)
+flag_timing, dashes = (False, False)
+
+for f in sys.argv[1:]:
+ if f.startswith("-"):
+ if f == "--": # sym_args
+ dashes = True
+ break
+ if f == "-t": # timings
+ flag_timing = True
+ else:
+ if not os.path.exists(f):
+ sys.stderr.write("Error: file '%s' does not exist\n" % f)
+ usage()
+ if f1 is None:
+ f1 = f
+ elif f2 is None:
+ f2 = f
+if flag_timing:
+ import time
+if f1 is None or f2 is None:
+ usage()
+
+sym_args = " ".join(sys.argv[3 + flag_timing + dashes:])
+def getsizes(file):
+ sym, alias, lut = {}, {}, {}
+ for l in os.popen("readelf -W -s %s %s" % (sym_args, file)).readlines():
+ l = l.strip()
+ if not (len(l) and l[0].isdigit() and len(l.split()) == 8):
+ continue
+ num, value, size, typ, bind, vis, ndx, name = l.split()
+ if ndx == "UND": continue # skip undefined
+ if typ in ["SECTION", "FILES"]: continue # skip sections and files
+ if "." in name: name = "static." + name.split(".")[0]
+ value = int(value, 16)
+ size = int(size, 16) if size.startswith('0x') else int(size)
+ if vis != "DEFAULT" and bind != "GLOBAL": # see if it is an alias
+ alias[(value, size)] = {"name" : name}
+ else:
+ sym[name] = {"addr" : value, "size": size}
+ lut[(value, size)] = 0
+ for addr, sz in iter(alias.keys()):
+ # If the non-GLOBAL sym has an implementation elsewhere then
+ # it's an alias, disregard it.
+ if not (addr, sz) in lut:
+ # If this non-GLOBAL sym does not have an implementation at
+ # another address, then treat it as a normal symbol.
+ sym[alias[(addr, sz)]["name"]] = {"addr" : addr, "size": sz}
+ for l in os.popen("readelf -W -S " + file).readlines():
+ x = l.split()
+ if len(x)<6: continue
+ # Should take these into account too!
+ #if x[1] not in [".text", ".rodata", ".symtab", ".strtab"]: continue
+ if x[1] not in [".rodata"]: continue
+ sym[x[1]] = {"addr" : int(x[3], 16), "size" : int(x[5], 16)}
+ return sym
+
+if flag_timing:
+ start_t1 = int(time.time() * 1e9)
+old = getsizes(f1)
+if flag_timing:
+ end_t1 = int(time.time() * 1e9)
+ start_t2 = int(time.time() * 1e9)
+new = getsizes(f2)
+if flag_timing:
+ end_t2 = int(time.time() * 1e9)
+ start_t3 = int(time.time() * 1e9)
+grow, shrink, add, remove, up, down = 0, 0, 0, 0, 0, 0
+delta, common = [], {}
+
+for name in iter(old.keys()):
+ if name in new:
+ common[name] = 1
+
+for name in old:
+ if name not in common:
+ remove += 1
+ sz = old[name]["size"]
+ down += sz
+ delta.append((-sz, name))
+
+for name in new:
+ if name not in common:
+ add += 1
+ sz = new[name]["size"]
+ up += sz
+ delta.append((sz, name))
+
+for name in common:
+ d = new[name].get("size", 0) - old[name].get("size", 0)
+ if d>0: grow, up = grow+1, up+d
+ elif d<0: shrink, down = shrink+1, down-d
+ else:
+ continue
+ delta.append((d, name))
+
+delta.sort()
+delta.reverse()
+if flag_timing:
+ end_t3 = int(time.time() * 1e9)
+
+print("%-48s %7s %7s %+7s" % ("function", "old", "new", "delta"))
+for d, n in delta:
+ if d:
+ old_sz = old.get(n, {}).get("size", "-")
+ new_sz = new.get(n, {}).get("size", "-")
+ print("%-48s %7s %7s %+7d" % (n, old_sz, new_sz, d))
+print("-"*78)
+total="(add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s)%%sTotal: %s bytes"\
+ % (add, remove, grow, shrink, up, -down, up-down)
+print(total % (" "*(80-len(total))))
+if flag_timing:
+ print("\n%d/%d; %d Parse origin/new; processing nsecs" %
+ (end_t1-start_t1, end_t2-start_t2, end_t3-start_t3))
+ print("total nsecs: %d" % (end_t3-start_t1))
diff --git a/bld/get-version b/bld/get-version
new file mode 100755
index 0000000..5372869
--- /dev/null
+++ b/bld/get-version
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Determine the version string to build into a binary.
+# When building in the git repository, we can use the output
+# of "git describe" which gives an unequivocal answer.
+#
+# Failing that, we use the contents of the VERSION file
+# which has a set of references substituted into it by git.
+# If we can find one which matches $v[0-9].* then we assume it's
+# a version-number tag, else we just use the whole string.
+# If there is more than one v[0-9].* tag, sort them and use the
+# first. This favours, eg v2.63 over 2.63rc6.
+
+if which git >/dev/null 2>&1 && \
+ ([ -d $1/.git ] || grep '^gitdir:' $1/.git >/dev/null 2>&1); then
+ cd $1; git describe | sed 's/^v//'
+elif grep '\$Format:%d\$' $1/VERSION >/dev/null 2>&1; then
+# unsubstituted VERSION, but no git available.
+ echo UNKNOWN
+else
+ vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep ^v[0-9]`
+
+ if [ $? -eq 0 ]; then
+ echo "${vers}" | sort -r | head -n 1 | sed 's/^v//'
+ else
+ cat $1/VERSION
+ fi
+fi
+
+exit 0
+
diff --git a/bld/install-man b/bld/install-man
index f4cf3dc..420c9b1 100755
--- a/bld/install-man
+++ b/bld/install-man
@@ -4,6 +4,6 @@ for f in *; do
if [ -d $f ]; then
$2 -m 755 -d $1/$f/man8
$2 -m 644 $f/dnsmasq.8 $1/$f/man8
- echo installing $1/$f/man8/dnsmasq.8
+ echo installing $f/man8/dnsmasq.8
fi
done
diff --git a/bld/install-mo b/bld/install-mo
index d11fa9f..ab54301 100755
--- a/bld/install-mo
+++ b/bld/install-mo
@@ -3,7 +3,7 @@
for f in *.mo; do
$2 -m 755 -d $1/${f%.mo}/LC_MESSAGES
$2 -m 644 $f $1/${f%.mo}/LC_MESSAGES/dnsmasq.mo
- echo installing $1/${f%.mo}/LC_MESSAGES/dnsmasq.mo
+ echo installing ${f%.mo}/LC_MESSAGES/dnsmasq.mo
done
diff --git a/bld/pkg-wrapper b/bld/pkg-wrapper
index 4f3b76b..0ddb678 100755
--- a/bld/pkg-wrapper
+++ b/bld/pkg-wrapper
@@ -2,10 +2,39 @@
search=$1
shift
+pkg=$1
+shift
+op=$1
+shift
-if grep "^\#.*define.*$search" config.h 2>&1 >/dev/null || \
- grep $search 2>&1 >/dev/null ; then
- exec $*
-fi
+in=`cat`
+if grep "^\#[[:space:]]*define[[:space:]]*$search" config.h >/dev/null 2>&1 || \
+ echo $in | grep $search >/dev/null 2>&1; then
+# Nasty, nasty, in --copy, arg 2 is another config to search for, use with NO_GMP
+ if [ $op = "--copy" ]; then
+ if grep "^\#[[:space:]]*define[[:space:]]*$pkg" config.h >/dev/null 2>&1 || \
+ echo $in | grep $pkg >/dev/null 2>&1; then
+ pkg=""
+ else
+ pkg="$*"
+ fi
+ elif grep "^\#[[:space:]]*define[[:space:]]*${search}_STATIC" config.h >/dev/null 2>&1 || \
+ echo $in | grep ${search}_STATIC >/dev/null 2>&1; then
+ pkg=`$pkg --static $op $*`
+ else
+ pkg=`$pkg $op $*`
+ fi
+
+ if grep "^\#[[:space:]]*define[[:space:]]*${search}_STATIC" config.h >/dev/null 2>&1 || \
+ echo $in | grep ${search}_STATIC >/dev/null 2>&1; then
+ if [ $op = "--libs" ] || [ $op = "--copy" ]; then
+ echo "-Wl,-Bstatic $pkg -Wl,-Bdynamic"
+ else
+ echo "$pkg"
+ fi
+ else
+ echo "$pkg"
+ fi
+fi