Skip to content

Commit

Permalink
Move mikmod build in separate script
Browse files Browse the repository at this point in the history
  • Loading branch information
rasky authored and Dragorn421 committed Sep 3, 2023
1 parent 502b388 commit dbeed39
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 16 deletions.
16 changes: 0 additions & 16 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,10 @@ makeWithParams(){
JOBS="${JOBS:-$(getconf _NPROCESSORS_ONLN)}"
JOBS="${JOBS:-1}" # If getconf returned nothing, default to 1

# Specify where to get libmikmod from and where to put it
LIBMIKMOD_REPO=https://github.com/networkfusion/libmikmod.git
LIBMIKMOD_COMMIT=738b1e8b11b470360b1b919680d1d88429d9d174
LIBMIKMOD_DIR=/tmp/libmikmod

# Clean, build, and install libdragon + tools
makeWithParams clobber
makeWithParams install tools-install

# Remove the cloned libmikmod repo if it already exists
[ -d "$LIBMIKMOD_DIR" ] && rm -Rf $LIBMIKMOD_DIR
# Clone, compile, and install libmikmod
git clone $LIBMIKMOD_REPO $LIBMIKMOD_DIR
pushd $LIBMIKMOD_DIR/n64
git checkout $LIBMIKMOD_COMMIT
makeWithParams
makeWithParams install
popd
rm -Rf $LIBMIKMOD_DIR

# Build examples and tests - libdragon must be already installed at this point,
# so first clobber the build to make sure that everything works against the
# installed version rather than using local artifacts.
Expand Down
42 changes: 42 additions & 0 deletions tools/build-mikmod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

# This script downloads and build MikMod, a music library for playing
# different module files. Notice that, albeit ported to N64, it is a
# CPU-only port, so it will use lots of CPU time to play the music.
# This is basically kept here for backward compatibility for old code
# using it. New code should default to use the new mixer library
# with its XM64/WAV64 support for music files.

# Bash strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'

makeWithParams(){
make -j"${JOBS}" "$@"
}

sudoMakeWithParams(){
make -j"${JOBS}" "$@" || \
sudo env N64_INST="$N64_INST" \
make -j"${JOBS}" "$@"
}

# Limit the number of make jobs to the number of CPUs
JOBS="${JOBS:-$(getconf _NPROCESSORS_ONLN)}"
JOBS="${JOBS:-1}" # If getconf returned nothing, default to 1

# Specify where to get libmikmod from and where to put it
LIBMIKMOD_REPO=https://github.com/networkfusion/libmikmod.git
LIBMIKMOD_COMMIT=738b1e8b11b470360b1b919680d1d88429d9d174
LIBMIKMOD_DIR=/tmp/libmikmod

# Remove the cloned libmikmod repo if it already exists
[ -d "$LIBMIKMOD_DIR" ] && rm -Rf $LIBMIKMOD_DIR
# Clone, compile, and install libmikmod
git clone $LIBMIKMOD_REPO $LIBMIKMOD_DIR
pushd $LIBMIKMOD_DIR/n64
git checkout $LIBMIKMOD_COMMIT
makeWithParams
sudoMakeWithParams install
popd
rm -Rf $LIBMIKMOD_DIR

0 comments on commit dbeed39

Please sign in to comment.