Skip to content

Commit

Permalink
Removed '.nostrip' file support
Browse files Browse the repository at this point in the history
Defining whether or not a Buildfile is stripped or not using the
.nostrip file is now deprecated.

Instead the nostrip feature can now be defined in the Buildfile itself
in either of two ways:

1. Disable strip entirely

   Adding a 'nostrip' option to the 'options' list like so:

   options=(nostrip)

   Will disable any strip of the build entirely.

2. Selective nostrip

   It is possible to select which files will not be stripped by adding a
   nostrip array. For example:

   nostrip=(/usr/lib/libtest.so /usr/lib/libtest.a)

   Entries in the nostrip array are treated as regular expressions (as
   used by grep).

Note: (2) will have no effect if (1) is used.

Note: By default all executables and .so and .a files are stripped.

This change is part of a plan to consolidate all settings inside the
Buildfile to make the Buildfile more precise to avoid that the user
overlooks any settings.
  • Loading branch information
lundmar committed Sep 2, 2014
1 parent cbff162 commit f1667fc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
8 changes: 7 additions & 1 deletion src/buildfile.cc
Expand Up @@ -49,6 +49,7 @@ CBuildFile::CBuildFile(string filename)
CBuildFile::url = "";
CBuildFile::license = "";
CBuildFile::options.build_lock = false;
CBuildFile::options.nostrip = "no";
}

string CBuildFile::GetLocation()
Expand Down Expand Up @@ -215,11 +216,16 @@ void CBuildFile::Parse(void)
check_function = value;
if (key == KEY_OPTIONS_)
{
// Parse options field
// Parse options array

// Check for "build-lock"
if (value.find("build-lock") < value.length())
options.build_lock = true;

// Check for "nostrip"
if (value.find("nostrip") < value.length())
options.nostrip = "yes";

}
if (key == KEY_LAYER)
layer_name = value;
Expand Down
16 changes: 8 additions & 8 deletions src/buildgear.sh
Expand Up @@ -248,20 +248,20 @@ do_build()

do_strip()
{
local FILE FILTER

if [ -f $BG_BUILD_NOSTRIP ] && [ ! -s $BG_BUILD_NOSTRIP ]; then
return
fi
local FILE FILTER EXPR

log_action "Strip "

cd $PKG

if [ -f $BG_BUILD_NOSTRIP ]; then
FILTER="grep -v -f $BG_BUILD_NOSTRIP"
else
if [ -z $nostrip ]; then
FILTER="cat"
else
for i in "${nostrip[@]}"
do
EXPR+="-e $i "
done
FILTER="grep -v $EXPR"
fi

if [ "$BG_BUILD_TYPE" = "cross" ]; then
Expand Down
12 changes: 9 additions & 3 deletions src/buildmanager.cc
Expand Up @@ -268,8 +268,11 @@ void CBuildManager::Do(string action, CBuildFile* buildfile)
arguments += " --BG_BUILD_BUILD '" + build + "'";
arguments += " --BG_UPDATE_CHECKSUM '" + Config.update_checksum + "'";
arguments += " --BG_UPDATE_FOOTPRINT '" + Config.update_footprint + "'";
arguments += " --BG_NO_STRIP '" + Config.no_strip + "'";
arguments += " --BG_KEEP_WORK '" + Config.keep_work + "'";
if (Config.no_strip == "yes")
arguments += " --BG_NO_STRIP '" + Config.no_strip + "'";
else
arguments += " --BG_NO_STRIP '" + buildfile->options.nostrip + "'";
} else
{
// Apply settings to main build
Expand All @@ -278,16 +281,19 @@ void CBuildManager::Do(string action, CBuildFile* buildfile)
arguments += " --BG_BUILD_BUILD '" + build + "'";
arguments += " --BG_UPDATE_CHECKSUM '" + Config.update_checksum + "'";
arguments += " --BG_UPDATE_FOOTPRINT '" + Config.update_footprint + "'";
arguments += " --BG_NO_STRIP '" + Config.no_strip + "'";
arguments += " --BG_KEEP_WORK '" + Config.keep_work + "'";
if (Config.no_strip == "yes")
arguments += " --BG_NO_STRIP '" + Config.no_strip + "'";
else
arguments += " --BG_NO_STRIP '" + buildfile->options.nostrip + "'";
} else
{
// Apply default settings to the build dependencies
arguments += " --BG_BUILD_BUILD '" + build + "'";
arguments += " --BG_UPDATE_CHECKSUM 'no'";
arguments += " --BG_UPDATE_FOOTPRINT 'no'";
arguments += " --BG_NO_STRIP 'no'";
arguments += " --BG_KEEP_WORK 'no'";
arguments += " --BG_NO_STRIP '" + buildfile->options.nostrip + "'";
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/include/buildgear/buildfile.h
Expand Up @@ -46,9 +46,10 @@ class CBuildFile : public CUtility
string depends;

struct
{
bool build_lock;
} options;
{
bool build_lock;
string nostrip;
} options;

string missing_depends;
string type;
Expand Down

0 comments on commit f1667fc

Please sign in to comment.