~rabbits/hiversaires

ref: 3e1627a4c505fa9109dd8d7d107a0b9946af8e5c hiversaires/build.sh -rwxr-xr-x 2.0 KiB
3e1627a4Rezmason Implementing the credits as just a slower splash, with fading in mixed in, and click-through links to the logos' corresponding sites. Added Aliceffekt logo and the secret logo. Updated the credit trigger to only show the secret if the player has an extra fuse *and* didn't use the walkthrough. 1 year, 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash

#You probably want to run this script like so: ./build.sh -debug -run

PROJECT_NAME="hiversaires"

DEFINES=""
OUTPUT_PARAM="-o ./bin/$PROJECT_NAME"
LINK_PARAMS="-L/usr/local/lib -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lm"
WARNING_PARAMS="-Wall"
INSTRUMENTATION_PARAMS=""
FLAGS="-Os -g0 -s"
DEBUG=false
RUN=false
INCREMENT=false

for arg in "$@"
do
  case $arg in
    -debug)
      DEBUG=true
      WARNING_PARAMS="-Wall -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla"
      INSTRUMENTATION_PARAMS="-fsanitize=address -fsanitize=undefined"
      DEFINES="$DEFINES -DDEBUG"
      FLAGS="-g -Og"
      ;;
    -expand)
      OUTPUT_PARAM="-E"
      LINK_PARAMS=""
      ;;
    -borders)
      DEFINES="$DEFINES -DDRAW_REGION_BORDERS"
      ;;
    -run)
      RUN=true
      ;;
    -increment)
      INCREMENT=true
      ;;
  esac
done
if [ $DEBUG = false ] ; then DEFINES="$DEFINES -DNDEBUG" ; fi

if [ $INCREMENT = false ]
then
  # format code
  clang-format -i src/*.c src/*.h

  # rebuild bin
  rm -Rf bin
  mkdir bin
else
  rm "./bin/$PROJECT_NAME"
fi

# build
if [ $DEBUG = true ] ; then echo "Building (debug)..." ; else echo "Building (release)..." ; fi
cc -std=c89 $DEFINES src/*.c $FLAGS $INSTRUMENTATION_PARAMS $WARNING_PARAMS $LINK_PARAMS $OUTPUT_PARAM > ./bin/$PROJECT_NAME.i
echo "Build complete."

if [ -e "./bin/$PROJECT_NAME" ]
then
  # Report size
  echo "Size: $(du -kh ./bin/$PROJECT_NAME)"

  if [ $INCREMENT = false ]
  then
    # Copy media
    echo "Copying media..."
    cp -R media/audio media/fonts media/icons media/data bin
    mkdir bin/graphics
    cp -R media/graphics/cursor media/graphics/interface media/graphics/logos bin/graphics
    mkdir bin/graphics/node_render
    while IFS= read -r line
    do
      filenames=($line)
      cp media/graphics/node_render/${filenames[0]} bin/graphics/node_render/${filenames[1]}
    done < "node_file_mapping.txt"
  fi

  # run
  if [ $RUN = true ]
  then
    echo "Running..."
    ./bin/$PROJECT_NAME "$@"
  fi
fi