]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
Merge branch 'martin-t/tutlink' into 'master'
authorMario <zacjardine@y7mail.com>
Fri, 28 Jul 2017 22:48:16 +0000 (22:48 +0000)
committerMario <zacjardine@y7mail.com>
Fri, 28 Jul 2017 22:48:16 +0000 (22:48 +0000)
Use shortlink for Halogene's tutorial in tips

See merge request !27

.gitignore
CMakeLists.txt
default.nix [new file with mode: 0644]
misc/tools/encode-demos.sh

index 0a76101ea4fb0d17e80502bddbcc4d7441ecc659..ab43afbbdc6d7046ab40283c8bf70dd584cfea1e 100644 (file)
@@ -15,3 +15,4 @@
 /wiki
 
 .idea/
+/result*
index e5f53a214087c9adbbb9764a6c445b09358fea2f..704c5439928969b2c35a55699fa1a47fe275bddd 100644 (file)
@@ -4,18 +4,18 @@ project(xonotic)
 option(DOWNLOAD_MAPS "Download new maps from the build server" ON)
 option(BUILD_RELEASE "Package a release" OFF)
 
-macro(subproject name)
-    if (EXISTS "${PROJECT_SOURCE_DIR}/${name}/CMakeLists.txt")
+macro(subproject id name)
+    if (EXISTS "${PROJECT_SOURCE_DIR}/${name}/CMakeLists.txt" AND NOT DEFINED ENV{XON_NO_${id}})
         add_subdirectory(${name} ${ARGN})
     endif ()
 endmacro()
 
-subproject(daemon)
-subproject(d0_blind_id)
-subproject(darkplaces)
-subproject(data/xonotic-data.pk3dir)
-subproject(gmqcc)
-subproject(netradiant)
+subproject(DAEMON  daemon)
+subproject(PKI     d0_blind_id)
+subproject(DP      darkplaces)
+subproject(DATA    data/xonotic-data.pk3dir)
+subproject(QCC     gmqcc)
+subproject(RADIANT netradiant)
 
 if (DOWNLOAD_MAPS)
     add_custom_target(update-maps ALL
diff --git a/default.nix b/default.nix
new file mode 100644 (file)
index 0000000..fe38854
--- /dev/null
@@ -0,0 +1,141 @@
+# nix-shell -A xonotic
+# --argstr cc clang
+{
+    nixpkgs ? <nixpkgs>,
+    pkgs ? (import nixpkgs) {},
+    cc ? null,
+}:
+with pkgs;
+let
+    VERSION = "0.8.2";
+    stdenv = if (cc != null) then overrideCC pkgs.stdenv pkgs."${cc}" else pkgs.stdenv;
+    targets = rec {
+        xonotic = stdenv.mkDerivation rec {
+            name = "xonotic-${version}";
+            version = VERSION;
+
+            XON_NO_DAEMON = true;
+            XON_NO_RADIANT = true;
+
+            XON_NO_QCC = true;
+            QCC = "${gmqcc}/gmqcc";
+
+            src = lib.sourceFilesBySuffices ./. [
+                ".txt" ".cmake" ".in"
+                ".c" ".cpp" ".h"
+                ".inc" ".def"
+                ".qc" ".qh"
+                ".sh"
+            ];
+
+            enableParallelBuilding = true;
+
+            cmakeFlags = [
+                "-DDOWNLOAD_MAPS=0"
+            ];
+
+            nativeBuildInputs = [
+                cmake   # for building
+                git     # for versioning
+                # unzip # for downloading maps
+            ];
+
+            buildInputs = [
+                openssl # for d0_blind_id
+                SDL2    # for darkplaces
+            ];
+
+            runtimeInputs = [
+                zlib
+                curl
+
+                libjpeg
+                libpng
+
+                freetype
+
+                libogg
+                libtheora
+                libvorbis
+            ];
+
+            shellHook = ''
+                export LD_LIBRARY_PATH=''${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${lib.makeLibraryPath runtimeInputs}
+            '';
+
+            installPhase = ''
+                mkdir $out
+
+                exe=darkplaces/darkplaces
+                rpath=$(patchelf --print-rpath $exe)
+                rpath_firstparty=$out/d0_blind_id
+                rpath_thirdparty=${lib.makeLibraryPath runtimeInputs}
+                rpath=''${rpath:+$rpath:}$rpath_firstparty:$rpath_thirdparty
+                patchelf --set-rpath $rpath $exe
+
+                cp -r . $out
+            '';
+
+            dontPatchELF = true;
+        };
+
+        gmqcc = stdenv.mkDerivation rec {
+            name = "gmqcc-${version}";
+            version = "xonotic-${VERSION}";
+
+            src = ./gmqcc;
+
+            enableParallelBuilding = true;
+
+            installPhase = ''
+                mkdir $out
+                cp -r . $out
+            '';
+        };
+
+        netradiant = stdenv.mkDerivation rec {
+            name = "netradiant-${version}";
+            version = VERSION;
+
+            XON_NO_DAEMON = true;
+            XON_NO_DP = true;
+            XON_NO_PKI = true;
+            XON_NO_QCC = true;
+            XON_NO_DATA = true;
+
+            src = ./netradiant;
+
+            enableParallelBuilding = true;
+
+            cmakeFlags = [
+                "-DDOWNLOAD_MAPS=0"
+                "-DGTK_NS=GTK"
+            ];
+
+            nativeBuildInputs = [
+                cmake   # for building
+                git     # for versioning
+            ];
+
+            buildInputs = [
+                pkgconfig
+                glib
+                libxml2
+                ncurses
+                libjpeg
+                libpng
+                minizip
+
+                mesa
+
+                xorg.libXt
+                xorg.libXmu
+                xorg.libSM
+                xorg.libICE
+
+                gnome2.gtk
+                gnome2.gtkglext
+            ];
+        };
+    };
+in targets
index ab84bd3c33e5076f21b7b595a39f05b055e44b60..ef920a9727fd14ec94a485bbf5017d42b96ee70e 100755 (executable)
@@ -1,9 +1,9 @@
 #!/bin/bash
 # name: encode-demos.sh
-# version: 0.6.2
+# version: 0.6.3
 # author: Tyler "-z-" Mulligan <z@xnz.me>
 # license: GPL & MIT
-# date: 26-02-2017
+# date: 01-04-2017
 # description: headless encoding of demo files to HD video concurrently with Xfvb and parallel
 #
 # The encoding is done with a full Xonotic client inside Xfvb.
@@ -42,7 +42,7 @@
 
 # Customize
 USERDIR=${HOME}/.xonotic-clean                      # path to Xonotic userdir for client that does encoding
-GAMEDIR=${USERDIR}/data                             # path to Xonotic userdir for client that does encoding
+GAMEDIR=${USERDIR}/data                             # path to Xonotic gamedir for client that does encoding
 XONOTIC_BIN="./all"                                 # binary used to launch Xonotic
 JOB_TIMEOUT="4h"                                    # if demo doesn't quit itself or hangs
 JOBS=4                                              # number of concurrent jobs
@@ -358,6 +358,24 @@ compress() {
     fi
 }
 
+create_gif() {
+    local video=$1
+    local fps=${2:-15}
+    local width=${3:-320}
+    local start=${4:-0}
+    local length=${5:-999999}
+    local loop=${6:-1}
+    local output=$(basename ${video%.*}.gif)
+
+    # Generate palette for better quality
+    ${FFMPEG} -i ${GAMEDIR}/${video} -vf fps=${fps},scale=${width}:-1:flags=lanczos,palettegen ${GAMEDIR}/tmp_palette.png
+
+    # Generate gif using palette
+    ${FFMPEG} -i ${GAMEDIR}/${video} -i ${GAMEDIR}/tmp_palette.png -ss ${start} -t ${length} -loop ${loop} -filter_complex "fps=${fps},scale=${width}:-1:flags=lanczos[x];[x][1:v]paletteuse" ${GAMEDIR}/${output}
+
+    rm ${GAMEDIR}/tmp_palette.png
+}
+
 list_jobs() {
     completed_jobs=$(_get_completed_jobs)
     active_jobs=$(_get_active_demo_jobs)
@@ -510,19 +528,23 @@ COMMANDS
 
     Encoding
     --------
-    batch  [demos.txt] [timeout] [--compress]   batch process a list of demos from file relative to \$USERDIR/data
-    single <demo> [timeout] [--compress]        process a single demo file in \$USERDIR/data. ex: demos/cool.dem
-                                                'timeout' does not include '--compress', compress starts a new job
+    batch  [demos.txt] [timeout] [--compress]           batch process a list of demos from file relative to \$USERDIR/data
+    single <demo> [timeout] [--compress]                process a single demo file in \$USERDIR/data. ex: demos/cool.dem
+                                                        'timeout' does not include '--compress', compress starts a new job
     Compression
     -----------
-    compress <video> [mp4|webm] [--cleanup]     compress an encoded ogv in \$USERDIR/data, ex: video/cool.ogv
+    compress <video> [mp4|webm] [--cleanup]             compress an encoded ogv in \$USERDIR/data, ex: video/cool.ogv
+
+    Convert
+    -----------
+    gif <video> [fps] [width] [start] [length] [loop]   convert a video to gif in \$USERDIR/data, ex: video/cool.ogv
 
     Job Management
     --------------
-    grep <keyword>                              grep the server logs of the workers
-    kkill <keyword>                             keyword kill, kill a worker if string is matched
-    list [-f]                                   list currently active/queued/completed jobs
-    log [-f]                                    tail the current log (-f follows log)
+    grep <keyword>                                      grep the server logs of the workers
+    kkill <keyword>                                     keyword kill, kill a worker if string is matched
+    list [-f]                                           list currently active/queued/completed jobs
+    log [-f]                                            tail the current log (-f follows log)
 
 EXAMPLES
 
@@ -538,6 +560,9 @@ EXAMPLES
     # compress a video in \$USERDIR/data (outputs test.mp4, and deletes the original)
     ./encode-demos.sh compress video/test.ogv --cleanup
 
+    # convert video to gif (14 fps, 640 width, start at 4s, length of 4s, loop 100 times)
+    ./encode-demos.sh gif video/2017-04-01_11-53_afterslime_000.ogv 14 640 4 4 100
+
     # list jobs
     ./encode-demos.sh list
 
@@ -572,6 +597,8 @@ case $1 in
     'single')           _run_xvfb; process_single $2 $3 $4;;
     # compression
     'compress')         compress $2 $3 $4;;
+    # convert
+    'gif')              create_gif $2 $3 $4 $5 $6 $7;;
     # monitoring/management
     'grep')             log_keyword_grep 'normal' $2;;
     'kkill')            log_killer_keyword $2;;