summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2014-03-30 13:43:33 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2014-03-30 14:03:21 -0400
commit84a59ae28b1c5cf4b7d0afae49fa3e64b39b98a2 (patch)
treee5aefea27428a51738f5bd02d69a15bd314e70d3
parentffebbcd2dee04b8c06e90432618e0e013ac5b7dc (diff)
downloadhtml5ks-84a59ae28b1c5cf4b7d0afae49fa3e64b39b98a2.tar.xz
html5ks-84a59ae28b1c5cf4b7d0afae49fa3e64b39b98a2.zip
add configure
-rw-r--r--.gitignore1
-rw-r--r--Makefile4
-rw-r--r--README.rst16
-rwxr-xr-xconfigure64
4 files changed, 49 insertions, 36 deletions
diff --git a/.gitignore b/.gitignore
index de34822..a7e93a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
/ast2json/*.rpyc
# generated files
+/Makefile.inc
/www/js/all.min.js*
/node_modules
diff --git a/Makefile b/Makefile
index adfaf4e..81f9d59 100644
--- a/Makefile
+++ b/Makefile
@@ -75,7 +75,6 @@ AJSON := $(JSON) $(JSONGZ)
# FIXME
json: $(AJSON)
-# the rules here are NOT BROKEN. think about it.
%.json.i: ast2json/rpyc2json.py %.rpyc
$^ $@
@@ -139,8 +138,7 @@ audio: $(CAUDIO)
PNG := $(shell find www/dump -name '*.png' ! -name 'ctc_strip.png')
JPG := $(shell find www/dump -name '*.jpg')
-WEBP := $(PNG:.png=.webp) \
- $(JPG:.jpg=.webp)
+WEBP := $(PNG:.png=.webp) $(JPG:.jpg=.webp)
CTC_ANIM_SRC := www/dump/ui/ctc_strip.png
CTC_ANIM_MORE_TMP := www/dump/ui/ctc_strip-1.png \
www/dump/ui/ctc_strip-2.png www/dump/ui/ctc_strip-3.png \
diff --git a/README.rst b/README.rst
index facaf3f..950e6b9 100644
--- a/README.rst
+++ b/README.rst
@@ -24,7 +24,7 @@ Requirements
- cwebp and webpmux from libwebp
- convert from ImageMagick
- apngasm
-- Node.js, npm
+- Node.js, npm for uglifyjs
Recommended
'''''''''''
@@ -36,15 +36,15 @@ Recommended
- jpegtran
- nginx
- pngquant
-- zopfli
+- zopfli and zopflipng
Build steps
-----------
0. Get Katawa Shoujo, install prerequisites. For guidance on Ubuntu, see .travis.sh.
-1. Copy \*.rpyc from Katawa Shoujo/game into unrpyc/ directory.
-2. Extract files from Katawa Shoujo/game/data.rpa with an rpa extractor, e.g. unrpa. Put files in www/dump.
-3. Install prerequisites, download DeflOpt and defluff and place exes in this directory.
+1. Copy \*.rpyc from Katawa Shoujo/game into ast2json/ directory.
+2. Extract files from Katawa Shoujo/game/data.rpa to www/dump/ with an rpa extractor, like rpatool or unrpa.
+3. Install prerequisites.
4. Run ./configure.
5. Run make.
6. Run nginx.sh to start nginx, then navigate to localhost:8080 in your browser.
@@ -55,10 +55,10 @@ Disabling unused conversions
----------------------------
To reduce programs and build time required, some conversions can be disabled.
-Defining MINIMAL as an environment variable will disable the safe ones.
+Passing --minimal to configure will disable the safe ones.
-Alternatively, specific conversions can be disabled by passing ``PROGRAM=`` on the command line, i.e. leaving it undefined.
-See the Makefile for more information.
+Alternatively, specific conversions can be disabled by passing --disable-conversion on the command line.
+See ``./configure --help`` for more information.
Reducing disk usage
-------------------
diff --git a/configure b/configure
index e5c7fe7..1db6e1e 100755
--- a/configure
+++ b/configure
@@ -1,55 +1,69 @@
#!/bin/bash
-set -e
-
-OUT=Makefile.inc
-
-> "${OUT}"
-
checking() {
printf "checking for %s... " "$1" >&2
}
check() {
- checking="$1"
- shift
- var="${VAR:-${checking^^}}"
+ checking "$1"
+ var="${VAR:-${1^^}}"
cmd="${!var}"
+ : ${cmd:=${1}}
+ shift
varflags="${var}FLAGS"
varflags="$@ ${!varflags}"
- if [[ -z "${cmd}" ]]; then
- cmd="${checking}"
- fi
get=$(command -v "${cmd}")
e=$?
if [[ -n "$get" ]]; then
+ if [[ -z "$NO_RUN" ]]; then
+ ${get} -h >/dev/null 2>&1
+ e=$?
+ if (( $e )); then
+ echo unusable, returned $e
+ return $e
+ fi
+ fi
+ declare -g "$var=$get"
echo ${get}
+ # intentionally stripping whitespace
echo ${var} := ${get} ${varflags} >> "${OUT}"
+ else
+ echo no
fi
return $e
}
rcheck() {
- checking "$1"
- if ! check "$@"; then
- echo no
- return 1
- fi
+ check "$@" || exit
}
-ocheck() {
- rcheck "$@" || true
+fcheck() {
+ for f in $3; do
+ checking "$f $1 support in ffmpeg"
+ if grep -Eq "^ $2 $f " <<< "$4"; then
+ echo yes
+ else
+ echo no
+ exit 1
+ fi
+ done
}
-checking "zopfli or gzip"
-VAR=GZIP check zopfli || check gzip -9
+OUT=Makefile.inc
+> "${OUT}"
-rcheck apngasm
+VAR=GZIP rcheck zopfli || rcheck gzip -9
+NO_RUN=1 rcheck apngasm
rcheck convert
rcheck cwebp -quiet -alpha_cleanup -m 6
rcheck ffmpeg -v warning -y
+F=$($FFMPEG -formats 2>&1)
+fcheck demuxing "D." "matroska,webm ogg wav yuv4mpegpipe" "$F"
+fcheck muxing ".E" "ipod mp4 ogg wav webm yuv4mpegpipe" "$F"
+fcheck decoding ".{6}" "mpeg4 rawvideo pcm_s16le vorbis" "$($FFMPEG -decoders 2>&1)"
+fcheck encoding ".{6}" "libx264 rawvideo libtheora libvpx libvpx-vp9 libfdk_aac libopus pcm_s16le" "$($FFMPEG -encoders 2>&1)"
rcheck npm --quiet
rcheck webpmux
-ocheck defluff
-ocheck pngquant
-ocheck zopflipng
+NO_RUN=1 check defluff
+check pngquant
+check zopflipng