blob: 1bbf10c3aa98349be708aed92efa381c5d665c81 [file] [log] [blame]
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001#!/bin/sh
2#
3# Copyright (C) 2002 Khalid Aziz <khalid_aziz at hp.com>
4# Copyright (C) 2002 Randy Dunlap <rddunlap at osdl.org>
5# Copyright (C) 2002 Al Stone <ahs3 at fc.hp.com>
6# Copyright (C) 2002 Hewlett-Packard Company
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21#
22# Busybox version by Matteo Croce <3297627799 at wind.it>
23#
Denis Vlasenko45854b52007-02-04 02:38:21 +000024# Rules to generate bbconfigopts.h from .config:
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000025# - Retain lines that begin with "CONFIG_"
26# - Retain lines that begin with "# CONFIG_"
27# - lines that use double-quotes must \\-escape-quote them
28
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020029config=.config
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000030
Denys Vlasenkoed2af2e2022-01-04 14:32:41 +010031od -v -b </dev/null >/dev/null
32if test $? != 0; then
33 echo 'od tool is not installed or cannot accept "-v -b" options'
34 exit 1
35fi
36bzip2 </dev/null >/dev/null
37if test $? != 0; then
38 echo 'bzip2 is not installed'
39 exit 1
40fi
41
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020042{
Denis Vlasenko45854b52007-02-04 02:38:21 +000043echo "\
44#ifndef _BBCONFIGOPTS_H
45#define _BBCONFIGOPTS_H
46/*
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000047 * busybox configuration settings.
48 *
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +020049 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000050 *
Denis Vlasenkoa5c5ae02007-02-03 12:50:41 +000051 * This file is generated automatically by scripts/mkconfigs.
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000052 * Do not edit.
Denis Vlasenko45854b52007-02-04 02:38:21 +000053 */
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020054static const char bbconfig_config[] ALIGN1 ="
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000055
Denys Vlasenkoe7212a42011-02-09 01:33:41 +010056grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020057| sed -e 's/\"/\\\"/g' -e 's/^/"/' -e 's/$/\\n"/'
Denis Vlasenko45854b52007-02-04 02:38:21 +000058
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000059echo ";"
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020060echo "#endif"
61} >"$1"
62
63{
64echo "\
65#ifndef _BBCONFIGOPTS_BZ2_H
66#define _BBCONFIGOPTS_BZ2_H
67/*
68 * busybox configuration settings.
69 *
70 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
71 *
72 * This file is generated automatically by scripts/mkconfigs.
73 * Do not edit.
74 */
75static const char bbconfig_config_bz2[] ALIGN1 = {"
76
Denys Vlasenko08caf092011-04-16 19:45:33 +020077grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \
Denys Vlasenkod493e932010-08-29 14:39:45 +020078| bzip2 -1 | dd bs=2 skip=1 2>/dev/null \
Denys Vlasenko195c4362013-11-26 14:56:29 +010079| od -v -b \
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020080| sed -e 's/^[^ ]*//' \
81 -e 's/ //g' \
82 -e '/^$/d' \
Denys Vlasenko195c4362013-11-26 14:56:29 +010083 -e 's/\(...\)/0\1,/g'
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020084
85echo "};"
86echo "#endif"
87} >"$2"