[Replicant] [PATCH][replicant-6.0][vendor/replicant] Add build script to simplify the build procedure.

Josh Branning lovell.joshyyy at gmail.com
Mon Aug 5 20:06:43 UTC 2019


That's quite nice,

Have you considered using /bin/sh instead? I can only guess; but 
probably this script will run with that shebang.

Josh

On 05/08/19 13:55, Denis 'GNUtoo' Carikli wrote:
> Once the source code is downloaded and the dependencies are
> installed, it makes it easier for people to build Replicant.
> 
> It also saves the builds logs, to enable to later look at why
> the build failed without needing to re-run the build.
> 
> Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
> ---
>   build.sh | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 80 insertions(+)
>   create mode 100755 build.sh
> 
> diff --git a/build.sh b/build.sh
> new file mode 100755
> index 00000000..e8c5ce29
> --- /dev/null
> +++ b/build.sh
> @@ -0,0 +1,80 @@
> +#!/bin/bash
> +# Copyright (C) 2019 Denis 'GNUtoo' Carikli' <GNUtoo at cyberdimension.org>
> +#
> +# 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 <http://www.gnu.org/licenses/>.
> +set -e
> +
> +supported_machines=" \
> +    espresso3g \
> +    espressowifi \
> +    i9100 \
> +    i9300 \
> +    i9305 \
> +    maguro \
> +    n5100 \
> +    n5110 \
> +    n7000 \
> +    n7100 \
> +"
> +
> +usage()
> +{
> +	printf "%s [" "$0"
> +	for machine in ${supported_machines} ; do
> +		printf "${machine}|"
> +	done
> +	printf "\b]\n"
> +	printf "%s all # build all machines\n" "$0"
> +	exit 1
> +}
> +
> +build()
> +{
> +    machine="$1"
> +    parallel_tasks=$(echo "$(grep 'processor' /proc/cpuinfo | wc -l ) + 1" | bc)
> +    log="logs/build_${machine}_$(date '+%s').log"
> +
> +    echo "starting to building for ${machine}: ${log}"
> +    source build/envsetup.sh
> +    lunch "replicant_${machine}-userdebug"
> +    time make -j$parallel_tasks bacon 2>&1 | tee "${log}"
> +    vendor/replicant/sign-build "${machine}" | tee -a "${log}"
> +    echo "${machine} DONE: ${log}"
> +}
> +
> +if [ $# -ne 1 ] ; then
> +	usage
> +fi
> +
> +if [ "$1" = "all" ] ; then
> +    repo sync --force-sync
> +    for machine in ${supported_machines} ; do
> +	build "${machine}"
> +    done
> +else
> +    repo sync --force-sync
> +    found=0
> +    for machine in ${supported_machines} ; do
> +	if [ "${machine}" = "$1" ] ; then
> +	    found=1
> +	fi
> +    done
> +
> +    if [ ${found} -eq 0 ] ; then
> +	printf "machine %s not supported\n" "$1"
> +	usage
> +    fi
> +
> +    build "$1"
> +fi
> 



More information about the Replicant mailing list