Skip to content

Commit

Permalink
HZ10 final
Browse files Browse the repository at this point in the history
- use select() to also handle pipe I/O, and set pipe to non-blocking reads/writes
- build select()'s fd set only once, by operating on a copy
- process all pending socket/pipe I/O before calling main select() again
- enable redirect feature by default, deprecating -r and adding opposite -R parameter
- add program uptime to stats report
- various minor tweaks and optimizations
  • Loading branch information
HunterZ committed Sep 15, 2014
1 parent c9aca15 commit d632b3f
Show file tree
Hide file tree
Showing 6 changed files with 481 additions and 323 deletions.
34 changes: 29 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LDFLAGS="-Wl,--gc-sections"
STRIP="strip -s -R .note -R .comment -R .gnu.version -R .gnu.version_r"
OPTS="-DDO_COUNT -DIF_MODE -DTEXT_REPLY -DPORT_MODE -DDROP_ROOT -DVERBOSE -DTEST -DREAD_FILE -DREAD_GIF -DNULLSERV_REPLIES -DHEX_DUMP -DSSL_RESP -DMULTIPORT"
BIN=$OUT.host
$CC $CFLAGS $OPTS $SRC -o $BIN
$CC $CFLAGS $OPTS $SRC -o $BIN || exit $?
#$STRIP $BIN
ls -laF $BIN

Expand All @@ -28,21 +28,45 @@ OPTS="-DDROP_ROOT -DNULLSERV_REPLIES -DSSL_RESP -DMULTIPORT -DIF_MODE -DSTATS_RE
# -DDO_COUNT set by -DSTATS_REPLY and/or -DSTATS_PIPE
# -DVERBOSE
BIN=$OUT
$CC $CFLAGS $LDFLAGS $OPTS $SRC -o $BIN
$CC $CFLAGS $LDFLAGS $OPTS $SRC -o $BIN || exit $?
$STRIP $BIN
ls -laF $BIN

#tomato static - excludes libgcc_s.so because my toolchain doesn't have it
CC="mipsel-uclibc-gcc -mips32"
CFLAGS="-Os -s -Wall -ffunction-sections -fdata-sections"
LDFLAGS="-static -Wl,--gc-sections,-Bdynamic,-lgcc_s,-Bstatic"
STRIP="mipsel-uclibc-strip -s -R .note -R .comment -R .gnu.version -R .gnu.version_r"
OPTS="-DDROP_ROOT -DNULLSERV_REPLIES -DSSL_RESP -DMULTIPORT -DIF_MODE -DSTATS_REPLY -DREDIRECT -DSTATS_PIPE"
BIN=$OUT.static
$CC $CFLAGS $LDFLAGS $OPTS $SRC -o $BIN
$CC $CFLAGS $LDFLAGS $OPTS $SRC -o $BIN || exit $?
$STRIP $BIN
ls -laF $BIN

#tomato fast - same as standard but optimized for performance instead of size
CC="mipsel-uclibc-gcc -mips32"
CFLAGS="-O3 -s -Wall"
LDFLAGS="-Wl,--gc-sections"
STRIP="mipsel-uclibc-strip -s -R .note -R .comment -R .gnu.version -R .gnu.version_r"
OPTS="-DDROP_ROOT -DNULLSERV_REPLIES -DSSL_RESP -DMULTIPORT -DIF_MODE -DSTATS_REPLY -DREDIRECT -DSTATS_PIPE"
BIN=$OUT.fast
$CC $CFLAGS $LDFLAGS $OPTS $SRC -o $BIN || exit $?
$STRIP $BIN
ls -laF $BIN

#tomato tiny
CC="mipsel-uclibc-gcc -mips32"
CFLAGS="-O3 -s -Wall -ffunction-sections -fdata-sections"
LDFLAGS="-Wl,--gc-sections"
OPTS="-O3 -DTINY"
STRIP="mipsel-uclibc-strip -s -R .note -R .comment -R .gnu.version -R .gnu.version_r"
OPTS="-DTINY"
BIN=$OUT.tiny
$CC $CFLAGS $LDFLAGS $OPTS $SRC -o $BIN
$CC $CFLAGS $LDFLAGS $OPTS $SRC -o $BIN || exit $?
$STRIP $BIN
ls -laF $BIN

PVER=`grep VERSION util.h | awk '{print $NF}' | sed 's|\"||g'`
PFIL=pixelserv-$PVER.mips.zip
rm -f $PFIL > /dev/null 2>&1
zip $PFIL LICENSE README.md dist/pixelserv dist/pixelserv.static dist/pixelserv.tiny || exit $?
ls -laF $PFIL
Loading

0 comments on commit d632b3f

Please sign in to comment.