A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 107 lines 2.9 kB view raw
1#!/usr/bin/perl 2# __________ __ ___. 3# Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7# \/ \/ \/ \/ \/ 8# $Id$ 9# 10 11# This program attempts to run configure with the correct build target 12# and type based on the pwd. 13# example: ~/rockbox/sansae200 is the build dir, it would run configure 14# for the sansae200 normal build target. 15# ~/rockbox/sansae200-sim for the e200 sim build (-boot for bootloader) 16# ~/rockbox/sim/sansae200 for e200 sim build. (replace sim with boot is also possible) 17# The full shortname is not required, each target name is checked and the first 18# possible match is used. 19 20# This script must be placed in the same directory as configure and builds.pm 21# 22 23use File::Basename; 24my $srcdir = dirname $0; 25require "$srcdir/builds.pm"; 26 27my $builddir = `pwd`; 28my @dirs = split(/\//, $builddir); 29 30my $test = pop(@dirs); 31 32sub doconfigure { 33 my ($target, $type, $width, $height) = @_; 34 if (!exists($builds{$target})) { 35 for $key (keys(%builds)) { 36 if ($key =~ $target) { 37 $target = $key; 38 last; 39 } 40 } 41 } 42 $command = "${srcdir}/configure --type=${type} --target=${target}"; 43 if (defined $width) { 44 $command .= " --lcdwidth=${width}"; 45 } 46 if (defined $height) { 47 $command .= " --lcdheight=${height}"; 48 } 49 %typenames = ("n" => "Normal", "s" => "Simulator", "b" => "Bootloader" ); 50 unless (@ARGV[0] eq "-y") { 51 $prompt = "Rockbox autoconf: \n\tTarget: $target \n\tType: $typenames{$type} \n"; 52 if (defined $width) { 53 $prompt .= "\tLCD width: $width\n"; 54 } 55 if (defined $height) { 56 $prompt .= "\tLCD height: $height\n"; 57 } 58 print $prompt . "Correct? [Y/n] "; 59 60 chomp($response = <>); 61 if ($response eq "") { 62 $response = "y"; 63 } 64 if ($response ne "y" && $response ne "Y") { 65 print "autoconf: Aborting\n"; 66 exit(0); 67 } 68 } 69 system($command); 70} 71 72sub buildtype { 73 my ($text) = @_; 74 if ($text eq "sim") { 75 $build = "s"; 76 } elsif ($text eq "boot") { 77 $build = "b"; 78 } elsif ($text eq "build") { 79 $build = "n"; 80 } else { 81 $build = ""; 82 } 83 return $build; 84} 85 86if ($test =~ /(.*)-(.*)-([0-9]+)x([0-9]+)/) 87{ 88 if (buildtype($2)) { 89 doconfigure($1, buildtype($2), $3, $4); 90 } elsif (buildtype($1)) { 91 doconfigure($2, buildtype($1), $3, $4); 92 } 93} 94elsif ($test =~ /(.*)-(.*)/) 95{ 96 if (buildtype($2)) { 97 doconfigure($1, buildtype($2)); 98 } elsif (buildtype($1)) { 99 doconfigure($2, buildtype($1)); 100 } 101} 102elsif ($test =~ /(.*)/) 103{ 104 $target = $1; 105 $build = buildtype(pop(@dirs)); 106 doconfigure($target, $build); 107}