mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
nbd's makefile/menuconfig rewrite
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@307 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
12
openwrt/scripts/configtest.pl
Executable file
12
openwrt/scripts/configtest.pl
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
my %change = (
|
||||
'BUSYBOX' => 'make -C package busybox-clean',
|
||||
'' => 'make target_clean'
|
||||
);
|
||||
|
||||
foreach my $change (keys %change) {
|
||||
my $v1 = `grep '$change' .config.test`;
|
||||
my $v2 = `grep '$change' .config`;
|
||||
$v1 eq $v2 or system($change{$change});
|
||||
}
|
||||
22
openwrt/scripts/gen_busybox_config.pl
Executable file
22
openwrt/scripts/gen_busybox_config.pl
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
|
||||
my $line;
|
||||
my $l1 = '';
|
||||
my $l2 = '=y';
|
||||
while (<>) {
|
||||
chomp;
|
||||
/^(# )BR2_LARGEFILE(.+)$/ and do {
|
||||
$l1 = $1;
|
||||
$l2 = $2;
|
||||
};
|
||||
/^(# )?BUSYBOX_(.+)/ and do {
|
||||
my $p1 = $1;
|
||||
my $p2 = $2;
|
||||
$p2 =~ /(CONFIG_LFS|FDISK_SUPPORT_LARGE_DISKS)/ and do {
|
||||
$p1 = $l1;
|
||||
$p2 = "$1$l2";
|
||||
};
|
||||
print "$p1$p2\n";
|
||||
}
|
||||
}
|
||||
69
openwrt/scripts/gen_busybox_menuconfig.pl
Normal file
69
openwrt/scripts/gen_busybox_menuconfig.pl
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
my $PATH = $ARGV[0];
|
||||
($PATH and -d $PATH) or die 'invalid path';
|
||||
my $DEFCONFIG = $ARGV[1];
|
||||
($DEFCONFIG and -f $DEFCONFIG) or die 'invalid config file';
|
||||
|
||||
my %config;
|
||||
|
||||
open CONFIG, $DEFCONFIG or die 'cannot open config file';
|
||||
while (<CONFIG>) {
|
||||
/^([\w_]+)=([ym])/ and $config{$1} = $2;
|
||||
/^([\w_]+)=(\d+)/ and $config{$1} = $2;
|
||||
/^([\w_]+)=(".+")/ and $config{$1} = $2;
|
||||
}
|
||||
close CONFIG;
|
||||
|
||||
open FIND, "find \"$PATH\" -name Config.in |";
|
||||
while (<FIND>) {
|
||||
chomp;
|
||||
my $input = $_;
|
||||
s/^$PATH\///g;
|
||||
s/sysdeps\/linux\///g;
|
||||
my $output = $_;
|
||||
print STDERR "$input => $output\n";
|
||||
$output =~ /^(.+)\/[^\/]+$/ and system("mkdir -p $1");
|
||||
|
||||
open INPUT, $input;
|
||||
open OUTPUT, ">$output";
|
||||
my ($cur, $default_set, $line);
|
||||
while ($line = <INPUT>) {
|
||||
next if $line =~ /^\s*mainmenu/;
|
||||
|
||||
# FIXME: make this dynamic
|
||||
$line =~ s/default CONFIG_FEATURE_BUFFERS_USE_MALLOC/default CONFIG_FEATURE_BUFFERS_GO_ON_STACK/;
|
||||
$line =~ s/default BUSYBOX_CONFIG_FEATURE_SH_IS_NONE/default BUSYBOX_CONFIG_FEATURE_SH_IS_ASH/;
|
||||
|
||||
if ($line =~ /^\s*config\s*([\w_]+)/) {
|
||||
$cur = $1;
|
||||
undef $default_set;
|
||||
}
|
||||
if ($line =~ /^\s*(menu|choice|end|source)/) {
|
||||
undef $cur;
|
||||
undef $default_set;
|
||||
}
|
||||
$line =~ s/^(\s*source\s+)/$1package\/busybox\/config\//;
|
||||
|
||||
$line =~ s/(\s+)((CONFIG|FDISK|USING|CROSS|EXTRA|PREFIX|FEATURE|HAVE|BUSYBOX)[\w_]*)/$1BUSYBOX_$2/g;
|
||||
|
||||
if ($cur) {
|
||||
($cur !~ /^CONFIG/ or $cur eq 'CONFIG_LFS') and do {
|
||||
$line =~ s/^(\s*(bool|tristate|string))\s*".+"$/$1/;
|
||||
};
|
||||
if ($line =~ /^\s*default/) {
|
||||
my $c;
|
||||
$default_set = 1;
|
||||
$c = $config{$cur} or $c = 'n';
|
||||
|
||||
$line =~ s/^(\s*default\s*)(\w+|"[^"]*")(.*)/$1$c$3/;
|
||||
}
|
||||
}
|
||||
|
||||
print OUTPUT $line;
|
||||
}
|
||||
close OUTPUT;
|
||||
close INPUT;
|
||||
|
||||
}
|
||||
close FIND;
|
||||
11
openwrt/scripts/make-ipkg-dir.sh
Executable file
11
openwrt/scripts/make-ipkg-dir.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
TARGET=$1
|
||||
CONTROL=$2
|
||||
VERSION=$3
|
||||
ARCH=$4
|
||||
|
||||
mkdir -p "$TARGET/CONTROL"
|
||||
grep '^[^(Version|Architecture)]' "$CONTROL" > "$TARGET/CONTROL/control"
|
||||
echo "Version: $VERSION" >> "$TARGET/CONTROL/control"
|
||||
echo "Architecture: $ARCH" >> "$TARGET/CONTROL/control"
|
||||
chmod 644 "$TARGET/CONTROL/control"
|
||||
53
openwrt/scripts/patch-kernel.sh
Executable file
53
openwrt/scripts/patch-kernel.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#! /bin/sh
|
||||
# A little script I whipped up to make it easy to
|
||||
# patch source trees and have sane error handling
|
||||
# -Erik
|
||||
#
|
||||
# (c) 2002 Erik Andersen <andersen@codepoet.org>
|
||||
|
||||
# Set directories from arguments, or use defaults.
|
||||
targetdir=${1-.}
|
||||
patchdir=${2-../kernel-patches}
|
||||
patchpattern=${3-*}
|
||||
|
||||
if [ ! -d "${targetdir}" ] ; then
|
||||
echo "Aborting. '${targetdir}' is not a directory."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "${patchdir}" ] ; then
|
||||
echo "Aborting. '${patchdir}' is not a directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i in ${patchdir}/${patchpattern} ; do
|
||||
case "$i" in
|
||||
*.gz)
|
||||
type="gzip"; uncomp="gunzip -dc"; ;;
|
||||
*.bz)
|
||||
type="bzip"; uncomp="bunzip -dc"; ;;
|
||||
*.bz2)
|
||||
type="bzip2"; uncomp="bunzip2 -dc"; ;;
|
||||
*.zip)
|
||||
type="zip"; uncomp="unzip -d"; ;;
|
||||
*.Z)
|
||||
type="compress"; uncomp="uncompress -c"; ;;
|
||||
*)
|
||||
type="plaintext"; uncomp="cat"; ;;
|
||||
esac
|
||||
echo ""
|
||||
echo "Applying ${i} using ${type}: "
|
||||
${uncomp} ${i} | patch -p1 -E -d ${targetdir}
|
||||
if [ $? != 0 ] ; then
|
||||
echo "Patch failed! Please fix $i!"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for rejects...
|
||||
if [ "`find $targetdir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ] ; then
|
||||
echo "Aborting. Reject files found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove backup files
|
||||
find $targetdir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;
|
||||
Reference in New Issue
Block a user