109 lines
3.2 KiB
Bash
Executable file
109 lines
3.2 KiB
Bash
Executable file
#!/bin/bash -ex
|
|
|
|
#
|
|
# Kangaroo Punch MultiPlayer Game Server Mark II
|
|
# Copyright (C) 2020-2021 Scott Duensing
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
#
|
|
|
|
|
|
function createEmbeddedBinary() {
|
|
local BINFILE=$1
|
|
local BINEXTENSION=$2
|
|
local TARGETDIR=$3
|
|
local SOURCEFILE="$3/${1,,}.h"
|
|
local BLOCKER="${1^^}_${2^^}_H"
|
|
|
|
outputLicense > ${SOURCEFILE}
|
|
outputHeader ${BLOCKER} >> ${SOURCEFILE}
|
|
printf "\n#ifdef EMBED_HERE\n\n" >> ${SOURCEFILE}
|
|
xxd -i ${BINFILE}.${BINEXTENSION} >> ${SOURCEFILE}
|
|
printf "\n#else // EMBED_HERE\n\n" >> ${SOURCEFILE}
|
|
printf "extern unsigned char ${BINFILE}_${BINEXTENSION}[];\n" >> ${SOURCEFILE}
|
|
printf "extern unsigned int ${BINFILE}_${BINEXTENSION}_len;\n" >> ${SOURCEFILE}
|
|
printf "\n#endif // EMBED_HERE\n\n" >> ${SOURCEFILE}
|
|
outputFooter ${BLOCKER} >> ${SOURCEFILE}
|
|
}
|
|
|
|
|
|
function outputFooter() {
|
|
local BLOCKER=$1
|
|
|
|
printf "\n#pragma GCC diagnostic pop\n\n\n#endif // ${BLOCKER}\n"
|
|
}
|
|
|
|
|
|
function outputHeader() {
|
|
local BLOCKER=$1
|
|
|
|
printf "\n\n#ifndef ${BLOCKER}\n#define ${BLOCKER}\n\n\n"
|
|
printf "// ===== THIS FILE IS AUTOMATICALLY GENERATED - DO NOT EDIT =====\n\n\n"
|
|
printf "#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wunused-variable\"\n"
|
|
}
|
|
|
|
|
|
function outputLicense() {
|
|
cat <<-LICENSE
|
|
/*
|
|
* Kangaroo Punch MultiPlayer Game Server Mark II
|
|
* Copyright (C) 2020-2021 Scott Duensing
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
LICENSE
|
|
}
|
|
|
|
|
|
# Include DJGPP into the path for this script
|
|
PATH=/opt/cross/djgpp/bin:$PATH
|
|
|
|
#pushd font/data
|
|
#createEmbeddedBinary vga8x14 dat ../../client/src/embedded
|
|
#popd
|
|
|
|
# Build SQLite for DOS
|
|
pushd client/src/thirdparty/sqlite-3.4.2
|
|
[[ -d build ]] && rm -rf build
|
|
mkdir -p build
|
|
cd build
|
|
sh ../configure \
|
|
--disable-tcl \
|
|
--disable-threadsafe\
|
|
--build=x86_64-linux-gnu \
|
|
--host=i586-pc-msdosdjgpp
|
|
make
|
|
popd
|
|
|
|
# Build SQLite for Linux
|
|
pushd client/src/thirdparty/sqlite-3.4.2
|
|
[[ -d build-linux ]] && rm -rf build
|
|
mkdir -p build-linux
|
|
cd build-linux
|
|
sh ../configure \
|
|
--disable-tcl
|
|
make
|
|
popd
|