Skip to content

Add Extra build flags to support only exporting editor, only exporting templates and adding encryption keys #127

Description

@MyrTheMoth

I've been using this project to build export templates with encryption keys, but that means I end up editing the .sh scripts to comments out sections that relate to building editors, also commenting out some architectures I don't want to compile or support in certain platforms (x82_32, arm32, etc),

It'd be great if we had a flag for export scope besides 'classical' and 'mono'

How about flags for 'full', 'editor' and 'templates' to limit building only to the specified elements.

As well as flags for specific multi-arch platforms such as 'x86-only', 'arm-only' '64-only' '32-only' and such.

I've also been adding additional scripts to support building with the encryption key and making sure it passes as an environment variable into each of the build scripts, such that you can supply a file with your encryption key

I've been doing it by adding the following to build.sh

# extra option for an encryption key in the arguments

while getopts "h?r:u:p:v:g:b:e:fsc" opt; do
  case "$opt" in
  h|\?)
    echo "Usage: $0 [OPTIONS...]"
    echo
    echo "  -r registry"
    echo "  -u username"
    echo "  -p password"
    echo "  -v godot version (e.g. 3.1-alpha5) [mandatory]"
    echo "  -g git treeish (e.g. master)"
    echo "  -b all|classical|mono (default: all)"
    echo "  -f force redownload of all images"
    echo "  -s skip downloading"
    echo "  -c skip checkout"
    echo "  -e encryption_file"
    echo
    exit 1
    ;;
  e)
    encryption_key=$(<$OPTARG)
    echo "using encryption file ${OPTARG}"
    export SCRIPT_AES256_ENCRYPTION_KEY="${encryption_key}"
    ;;

# a check to display if you are using a key or not

if [ -z "${encryption_key}" ]; then
  echo "Building with no encryption."
  unset SCRIPT_AES256_ENCRYPTION_KEY
fi

if [ ! -z "${encryption_key}" ]; then
  echo "SCRIPT_AES256_ENCRYPTION_KEY: ${SCRIPT_AES256_ENCRYPTION_KEY}"
fi

# then adding it as an environment variable to the export command

export podman_run="${podman} run -it --rm --env SCRIPT_AES256_ENCRYPTION_KEY=${SCRIPT_AES256_ENCRYPTION_KEY} --env BUILD_NAME=${BUILD_NAME} --env GODOT_VERSION_STATUS=${GODOT_VERSION_STATUS} --env NUM_CORES=${NUM_CORES} --env CLASSICAL=${build_classical} --env MONO=${build_mono} -v ${basedir}/godot-${godot_version}.tar.gz:/root/godot.tar.gz -v ${basedir}/mono-glue:/root/mono-glue -w /root/"

Then I also added something like this in every platform's build script, build-linux.sh for example:

if [ -z "${SCRIPT_AES256_ENCRYPTION_KEY}" ]; then
  echo "Building Linux with no encryption."
  unset SCRIPT_AES256_ENCRYPTION_KEY
fi

if [ ! -z "${SCRIPT_AES256_ENCRYPTION_KEY}" ]; then
  echo "Building Linux with SCRIPT_AES256_ENCRYPTION_KEY: ${SCRIPT_AES256_ENCRYPTION_KEY}"
  export SCRIPT_AES256_ENCRYPTION_KEY=${SCRIPT_AES256_ENCRYPTION_KEY}
fi

build-release.sh would probably also need some checks for any files missing by customizing build.sh to only build certain things, since currently it would require commenting out any copy operations for files that won't exist from partial build setups

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions