2023-01-16 06:47:10 -05:00
# Copyright 1999-2023 Gentoo Authors
2020-11-06 21:10:34 -05:00
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: projucer.eclass
# @MAINTAINER:
# Ryan Fox <flewkey@2a03.party>
# @AUTHOR:
# Ryan Fox <flewkey@2a03.party>
# @BLURB: Resave Projucer projects
# @DESCRIPTION:
# Provides a function to resave Projucer projects, and automatically sets the
# paths for JUCE and it's modules.
2023-01-16 06:47:10 -05:00
# @ECLASS_VARIABLE: JUCE_VERSION
2020-11-06 21:10:34 -05:00
# @REQUIRED
# @DEFAULT_UNSET
# @DESCRIPTION:
# Choose a specific version of JUCE to use. A project may only build with older
# versions of JUCE.
#
# Example:
# @CODE
# JUCE_VERSION=6.0.4
# @CODE
2023-01-16 06:47:10 -05:00
# @ECLASS_VARIABLE: PROJUCER_VERSION
2020-11-06 21:10:34 -05:00
# @DESCRIPTION:
# Choose a specific version of JUCE to use. A project may only build with older
# versions of JUCE.
: ${ PROJUCER_VERSION = " ${ JUCE_VERSION } " }
2023-01-16 06:47:10 -05:00
# @ECLASS_VARIABLE: JUCE_PATH
2020-11-06 21:10:34 -05:00
# @DESCRIPTION:
# The path to JUCE
: ${ JUCE_PATH : = " /opt/juce- ${ JUCE_VERSION } " }
2023-01-16 06:47:10 -05:00
# @ECLASS_VARIABLE: JUCE_MODULES_PATH
2020-11-06 21:10:34 -05:00
# @DESCRIPTION:
# The path to JUCE modules
: ${ JUCE_MODULES_PATH : = " ${ JUCE_PATH } /modules " }
2023-01-16 06:47:10 -05:00
# @ECLASS_VARIABLE: PROJUCER
2020-11-06 21:10:34 -05:00
# @DESCRIPTION:
# Provided in case someone wants to use a different binary
: ${ PROJUCER : = " /opt/juce- ${ PROJUCER_VERSION } /Projucer " }
2023-01-16 06:47:10 -05:00
# @ECLASS_VARIABLE: PROJUCER_CONF
2020-11-06 21:10:34 -05:00
# @INTERNAL
# @DESCRIPTION:
# Config file affected by the eclass. Projucer itself doesn't care
: ${ PROJUCER_CONF : = " ${ HOME } /.config/Projucer/Projucer.settings " }
# @FUNCTION: _projucer_update_paths
# @USAGE: <project>
# @INTERNAL
# @DESCRIPTION:
# Sets the proper paths in the project and Projucer
_projucer_update_paths( ) {
# Update project
sed -i " s/path=\".*\"\/>/path=\" ${ JUCE_MODULES_PATH // \/ / \\ / } \"\/>/g " " ${ 1 } "
# Generate config (This is fine since ebuilds have a temporary homedir)
${ PROJUCER } --help > /dev/null
sed -i " s/<PROJECT_DEFAULT_SETTINGS\/>/<PROJECT_DEFAULT_SETTINGS jucePath=\" ${ JUCE_PATH // \/ / \\ / } \" defaultJuceModulePath=\" ${ JUCE_MODULES_PATH // \/ / \\ / } \"\/>/g " " ${ PROJUCER_CONF } "
}
# @FUNCTION: projucer_resave
# @USAGE: <project>
# @DESCRIPTION:
# Resave all project files and resources
projucer_resave( ) {
_projucer_update_paths " ${ 1 } "
${ PROJUCER } --resave " ${ 1 } "
}