diff --git a/build/arguments.sh b/build/arguments.sh index 2952f90d2e..3f8353185c 100755 --- a/build/arguments.sh +++ b/build/arguments.sh @@ -34,10 +34,6 @@ if [ -z "$inc_arguments" ]; then command="$1$command" [ "$#" -gt 0 ] && shift 1 && target="$1" ;; - svn_build_into) - command="$1$command" - [ "$#" -gt 0 ] && shift 1 && target="$1" - ;; build_xmlstream) command="$1$command" [ "$#" -gt 0 ] && shift 1 && workfile="$1" @@ -81,7 +77,6 @@ if [ -z "$inc_arguments" ]; then case "$command" in build_into) [ -z "$target" ] && die "Missing destination directory" ;; git_build_into) [ -z "$target" ] && die "Missing destination directory" ;; - svn_build_into) [ -z "$target" ] && die "Missing destination directory" ;; process_file) [ -z "$workfile" ] && die "Need at least input file" ;; build_xmlstream) [ -z "$workfile" ] && die "Missing xhtml file name" ;; tree_maker) [ -z "$target" ] && die "Missing target location" ;; diff --git a/build/build_main.sh b/build/build_main.sh index 423057c3a0..e71d2d75e7 100755 --- a/build/build_main.sh +++ b/build/build_main.sh @@ -38,7 +38,7 @@ buildpids=$( | egrep "[s]h ${0} .*" \ | wc -l ) -if [ $command = "build_into" -o $command = "git_build_into" -o $command = "svn_build_into" ] && [ "$buildpids" -gt 2 ]; then +if [ $command = "build_into" -o $command = "git_build_into" ] && [ "$buildpids" -gt 2 ]; then debug "build script is already running" exit 1 fi @@ -59,12 +59,6 @@ case "$command" in else git_build_into fi ;; - svn_build_into) if [ "${statusdir}/full_build" -nt "${statusdir}/index.cgi" ]; then - debug "discovered flag file, performing full build" - build_into - else - svn_build_into - fi ;; build_into) build_into ;; process_file) process_file "$workfile" "$processor" ;; build_xmlstream) build_xmlstream "$(get_shortname "$workfile")" "$(get_language "$workfile")" ;; diff --git a/build/buildrun.sh b/build/buildrun.sh index b1e26468d7..0199c99179 100755 --- a/build/buildrun.sh +++ b/build/buildrun.sh @@ -24,9 +24,9 @@ build_into(){ make -C "$basedir" | t_logstatus premake ) || exit 1 - dir_maker "$basedir" "$stagedir" + dir_maker "$basedir" "$stagedir" || exit 1 - tree_maker "$basedir" "$stagedir" "$@" > "$(logname Makefile)" + tree_maker "$basedir" "$stagedir" > "$(logname Makefile)" || exit 1 ( # Make sure that the following pipe exits with a nonzero exit code if the @@ -58,86 +58,16 @@ git_build_into(){ gitterm="$?" if [ "$gitterm" -ne 0 ]; then - die "GIT reported the following problem:\n" \ - "$(cat "$GITerrors")" - #elif egrep '^(C...|.C..|...C) .+' "$SVNchanges"; then - # die "GIT encountered a conflict:\n" \ - # "$(cat "$SVNchanges")" - elif egrep '^Already up-to-date\.' "$GITchanges"; then - debug "No changes to GIT:\n" \ - "$(cat "$GITchanges")" + die "GIT reported the following problem:\n$(cat "$GITerrors")" + fi + + if egrep '^Already up-to-date\.' "$GITchanges"; then + debug "No changes to GIT:\n$(cat "$GITchanges")" # Exit status should only be 0 if there was a successful build. # So set it to 1 here. exit 1 - else - logstatus GITlatest <"$GITchanges" - regen_xhtml=false - regen_xsldeps=false - regen_copy=false - - # What to do, if a certain file type gets added, deleted, modified - egrep -q '^ (delete|rename) .*\.xhtml' "$GITchanges" && regen_xhtml=true - egrep -q '^ (create|rename) .*\.sources' "$GITchanges" && regen_xhtml=true - egrep -q '^ (delete|rename) .*\.sources' "$GITchanges" && regen_xhtml=true - egrep -q '^ (create|rename) .*\.xsl' "$GITchanges" && regen_xhtml=true - egrep -q '^ (delete|rename) .*\.xsl' "$GITchanges" && regen_xhtml=true && regen_xsldeps=true - egrep -q '^ .*\.xsl *\|' "$GITchanges" && regen_xsldeps=true - egrep -v '.*(\.xml|\.xsl|\.xhtml|\.sources|Makefile)' "$GITchanges" \ - | egrep -q '^ (delete|rename)' && regen_copy=true - - build_into $(sed -rn ' - /^ create mode [0-7]{6} .*(Makefile|\.xml)/d - /^ rename .* => .*(Makefile|\.xml)\}? \([0-9]+%\)/d - s;^ create mode [0-7]{6} (.+);\1;p; - s;^ rename ([^{]+ => )(.*) \([0-9]+%\);\2;p; - s;^ rename ([^{]*)(\{.* => )(.+)\}(.*) \([0-9]+%\);\1\3\4;p - ' "$GITchanges" \ - | xargs -d\\n printf "${basedir}"/%s\\n - ) - fi -} - -svn_build_into(){ - forcelog SVNchanges; SVNchanges="$(logname SVNchanges)" - forcelog SVNerrors; SVNerrors="$(logname SVNerrors)" - - svn --non-interactive update "$basedir" >"$SVNchanges" 2>"$SVNerrors" - svnterm="$?" - - if [ "$svnterm" -ne 0 ]; then - die "SVN reported the following problem:\n" \ - "$(cat "$SVNerrors")" - elif egrep '^(C...|.C..|...C) .+' "$SVNchanges"; then - die "SVN encountered a conflict:\n" \ - "$(cat "$SVNchanges")" - elif egrep '^At revision [0-9]+\.' "$SVNchanges"; then - debug "No changes to SVN:\n" \ - "$(cat "$SVNchanges")" - # Exit status should only be 0 if there was a successful build. - # So set it to 1 here. - exit 1 - else - logstatus SVNlatest <"$SVNchanges" - regen_xhtml=false - regen_xsldeps=false - regen_copy=false - - # What to do, if a certain file type gets added, deleted, modified - egrep -q '^[A]... .*\.xml' "$SVNchanges" && true - egrep -q '^[D]... .*\.xml' "$SVNchanges" && true - egrep -q '^[UGR]... .*\.xml' "$SVNchanges" && true - egrep -q '^[A]... .*\.xhtml' "$SVNchanges" && true - egrep -q '^[D]... .*\.xhtml' "$SVNchanges" && regen_xhtml=true - egrep -q '^[UGR]... .*\.xhtml' "$SVNchanges" && true - egrep -q '^[A]... .*\.sources' "$SVNchanges" && regen_xhtml=true - egrep -q '^[D]... .*\.sources' "$SVNchanges" && regen_xhtml=true - egrep -q '^[UGR]... .*\.sources' "$SVNchanges" && true - egrep -q '^[A]... .*\.xsl' "$SVNchanges" && regen_xhtml=true - egrep -q '^[D]... .*\.xsl' "$SVNchanges" && regen_xhtml=true && regen_xsldeps=true - egrep -q '^[UGR]... .*\.xsl' "$SVNchanges" && regen_xsldeps=true - egrep -v '.*(\.xml|\.xsl|\.xhtml|\.sources|Makefile)$' "$SVNchanges" \ - | egrep -q '^[D]... .*' && regen_copy=true - - build_into $(sed -rn '/.*(Makefile|\.xml)$/d;s;^A... (.+)$;\1;p' "$SVNchanges") fi + + logstatus GITlatest < "$GITchanges" + build_into } diff --git a/build/fundraising.sh b/build/fundraising.sh index c7c7761d50..51e0890549 100755 --- a/build/fundraising.sh +++ b/build/fundraising.sh @@ -4,24 +4,12 @@ inc_fundraising=true [ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh" [ -z "$inc_languages" ] && . "$basedir/build/languages.sh" -cache_fundraising(){ - cache_fundraising="$(for lang in $(get_languages); do - if [ -f "$basedir/fundraising-${lang}.xml" ]; then - echo -n " ${lang}:<$basedir/fundraising-${lang}.xml> " - elif [ -f "$basedir/fundraising-en.xml" ]; then - echo -n " ${lang}:<$basedir/fundraising-en.xml> " - fi - done)" -} - get_fundraisingfile(){ # get the fundraising file for a given language # TODO: integrate with regular texts function lang="$1" - if [ -n "$cache_fundraising" ]; then - echo "$cache_fundraising" |sed -r 's;^.* '"$lang"':<([^>]+)> .*$;\1;p' - elif [ -f "$basedir/fundraising-${lang}.xml" ]; then + if [ -f "$basedir/fundraising-${lang}.xml" ]; then echo "$basedir/fundraising-${lang}.xml" elif [ -f "$basedir/fundraising-en.xml" ]; then echo "$basedir/fundraising-en.xml" diff --git a/build/makerules.sh b/build/makerules.sh index 4d0cb89550..5f9be8cdbc 100755 --- a/build/makerules.sh +++ b/build/makerules.sh @@ -1,152 +1,22 @@ #!/bin/bash inc_makerules=true -[ -z "$inc_misc" ] && . "$basedir/build/misc.sh" -[ -z "$inc_translations" ] && . "$basedir/build/translations.sh" -[ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh" -[ -z "$inc_fundraising" ] && . "$basedir/build/fundraising.sh" [ -z "$inc_languages" ] && . "$basedir/build/languages.sh" -[ -z "$inc_sources" ] && . "$basedir/build/sources.sh" - -sourcefind() { - find "$input" -name .svn -prune -o -name .git -prune -o -type f "$@" -printf '%P\n' -} - -mio(){ - # make input/output abstraction, produce reusable makefiles - # by replacing in and out pathes with make variables. - for each in "$@"; do - case "$each" in - "$input"/*) printf '${INPUTDIR}/%s\n' "${each#${input}/}" ;; - "$output"/*) printf '${OUTPUTDIR}/%s\n' "${each#${output}/}" ;; - *) printf %s\\n "$each" ;; - esac - done -} - -mes(){ - # make escape... escape a filename for make syntax - # possibly not complete - mio "$@" \ - | sed -r ':X; $bY; N; bX; :Y; - s;[ #];\\&;g; s;\n; ;g' -} - -xhtml_maker(){ - # generate make rules for building html files out of xhtml - # account for included xml files and xsl rules - - shortname="$input/$1" - outpath="\${OUTPUTDIR}/${2}" - outpath="${outpath%/*}" - - textsen="$(get_textsfile "en")" - menufile="$basedir/tools/menu-global.xml" - filedir="${shortname%/*}" - shortbase="${shortname##*/}" - processor="$(get_processor "$shortname")" - list_file="`dirname ${shortname}`/.`basename ${shortname}`.xmllist" - - [ -f "${list_file}" ] && xmllist="${list_file}" || unset xmllist - - # For speed considerations: avoid all disk I/O in this loop - for lang in $(get_languages); do - infile="${shortname}.${lang}.xhtml" - depfile="${shortname}.*.xhtml" - - infile="$(mio "$infile")" - outbase="${shortbase}.${lang}.html" - outfile="${outpath}/${outbase}" - - textsfile="$(get_textsfile "$lang")" - fundraisingfile="$(get_fundraisingfile "$lang")" - - cat <"$outfile" || { rm $outfile; exit 1; } -MakeEND - done -} - -xhtml_makers(){ - # generate make rules concerning all .xhtml files in source tree - sourcefind -name '*.[a-z][a-z].xhtml' \ - | sed -r 's;\.[a-z][a-z]\.xhtml$;;' \ - | sort -u \ - | while read shortpath; do - xhtml_maker "$shortpath" "${shortpath}" - done -} - -xhtml_additions(){ - printf "%s\n" "$@" \ - | sed -rn 's;\.[a-z][a-z]\.xhtml$;;p' \ - | sort -u \ - | xargs realpath \ - | while read addition; do - xhtml_maker "${addition#$input/}" "${addition#$input/}" - done -} - -xslt_dependencies(){ - # list referenced xsl files for a given xsl file - # *not* recursive since Make will handle recursive - # dependency resolution - file="$1" - - cat "$file" \ - | tr '\n\t\r' ' ' \ - | sed -r 's;(]*>);\n\1\n;g' \ - | sed -nr '/]*>/s;^.*href *= *"([^"]*)".*$;\1;gp' -} - -xslt_maker(){ - # find external references in a xsl file and generate - # Make dependencies accordingly - - file="$input/$1" - dir="${file%/*}" - - deps="$( xslt_dependencies "$file" |xargs -I'{}' realpath "$dir/{}" )" - cat <]*>);\n\1\n;g' \ + | sed -nr '/]*>/s;^.*href *= *"([^"]*)".*$;\1;gp' \ + | xargs -I'{}' realpath "${input}/$(dirname ${xsl_file})/{}" \ + | sed -r "s;^${input};\$(INPUTDIR);" + )) + if [ -n "${prerequisites}" ]; then + echo "all: \$(INPUTDIR)/${xsl_file}" + echo "\$(INPUTDIR)/${xsl_file}: ${prerequisites}" + echo "" + fi + done + + cat <.html files to build HTML_DST_FILES := \$(foreach base,\$(HTML_DST_BASES),\$(foreach lang,\$(LANGUAGES),\$(base).\$(lang).html)) +# .xmllist file used to build a html file +XMLLIST_DEP = \$(wildcard \$(INPUTDIR)/\$(dir \$*).\$(notdir \$*).xmllist) + +# .xsl file used to build a html file +XSL_DEP = \$(firstword \$(wildcard \$(INPUTDIR)/\$*.xsl) \$(INPUTDIR)/\$(dir \$*).default.xsl) + +all: \$(HTML_DST_FILES) +EOF + + for lang in ${languages}; do + cat< \$@ +EOF + done + + cat < \$@ EOF @@ -279,7 +197,7 @@ EOF for lang in ${languages}; do cat< \$@ EOF @@ -335,26 +253,5 @@ clean: # ----------------------------------------------------------------------------- EOF - - forcelog Make_xslt; Make_xslt="$(logname Make_xslt)" - Make_xhtml="$(logname Make_xhtml)" - - trap "trap - 0 2 3 6 9 15; killall \"${0##*/}\"" 0 2 3 6 9 15 - - [ "$regen_xslt" = false -a -s "$Make_xslt" ] && \ - xslt_additions "$@" >>"$Make_xslt" \ - || xslt_makers >"$Make_xslt" & - - if [ "$regen_xhtml" = false -a -s "$Make_xhtml" ]; then - cat "$Make_xhtml" - xhtml_additions "$@" |tee -a "$Make_xhtml" - else - xhtml_makers |tee "$Make_xhtml" - fi - - wait - trap - 0 2 3 6 9 15 - - cat "$Make_xslt" } diff --git a/build/translations.sh b/build/translations.sh index f3fcf7dbb7..111fa7dcc7 100755 --- a/build/translations.sh +++ b/build/translations.sh @@ -4,24 +4,12 @@ inc_translations=true [ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh" [ -z "$inc_languages" ] && . "$basedir/build/languages.sh" -cache_textsfile(){ - cache_textsfile="$(for lang in $(get_languages); do - if [ -f "$basedir/tools/texts-${lang}.xml" ]; then - echo -n " ${lang}:<$basedir/tools/texts-${lang}.xml> " - else - echo -n " ${lang}:<$basedir/tools/texts-en.xml> " - fi - done)" -} - get_textsfile(){ # get the texts file for a given language # fall back to english if necessary lang="$1" - if [ -n "$cache_textsfile" ]; then - echo "$cache_textsfile" |sed -nr 's;^.* '"$lang"':<([^>]+)> .*$;\1;p' - elif [ -f "$basedir/tools/texts-${1}.xml" ]; then + if [ -f "$basedir/tools/texts-${1}.xml" ]; then echo "$basedir/tools/texts-${1}.xml" else echo "$basedir/tools/texts-en.xml" diff --git a/build/xslt/TEMPLATE.xsl b/build/xslt/TEMPLATE.xsl deleted file mode 100644 index 60ec9d5c75..0000000000 --- a/build/xslt/TEMPLATE.xsl +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - -