#!/bin/bash function createEmbeddedBinary() { local BINFILE=$1 local SOURCEFILE=$2 local BLOCKER=$3 outputLicense > ${SOURCEFILE} outputHeader ${BLOCKER} >> ${SOURCEFILE} printf "\n#ifdef EMBED_HERE\n\n" >> ${SOURCEFILE} xxd -i ${BINFILE} >> ${SOURCEFILE} printf "\n#else // EMBED_HERE\n\n" >> ${SOURCEFILE} printf "extern unsigned char ${BINFILE/\./_}[];\n" >> ${SOURCEFILE} printf "extern unsigned int ${BINFILE/\./_}_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 /* * * Ham'n'Cheese * Copyright (C) 2006-2020 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 2 * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ LICENSE } # Eventually provide a build_profile file to reduce file size. TEMPLATE="disable_3d=yes svg=no" LTO="lto=none" # Use "lto=full" for releases. # Embed edge binaries. pushd bin mkdir -p ../modules/embedded/embeds createEmbeddedBinary x86_64-linux-gnu-edge ../modules/embedded/embeds/linux_x86_64.h EDGE_H popd pushd godot # Use Our Custom Settings. ln -f -s ../custom.py . # Clean Prior Builds. #scons --clean # Build Editor. scons platform=linuxbsd target=editor arch=x86_64 ${LTO} # Create JSON for IDE support. scons compiledb=yes # Build Templates. scons platform=linuxbsd target=template_release arch=x86_64 ${TEMPLATE} ${LTO} popd :<