Skip to content

Commit

Permalink
Merge branch 'xmlrpc-c'
Browse files Browse the repository at this point in the history
  • Loading branch information
dfateyev committed Mar 30, 2012
2 parents 8c6447b + c365174 commit d0bc07d
Show file tree
Hide file tree
Showing 8 changed files with 2,971 additions and 0 deletions.
104 changes: 104 additions & 0 deletions specs/xmlrpc-c/dfs.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/* --*- c++ -*--
* Copyright (C) 2010 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
*
* 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; version 3 of the License.
*
* 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/>.
*/

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <string>
#include <list>
#include <map>
#include <iostream>

class node {
public:
node(std::string const &name) : name_(name) {}
void add_child(class node *n)
{
children_.push_back(n);
}

void dfs(std::list<std::string> &res);
bool visited;

private:
std::string const name_;
std::list<class node *> children_;
};

void node::dfs(std::list<std::string> &res)
{
std::list<class node *>::iterator i;

visited = true;

for (i = children_.begin(); i != children_.end(); ++i) {
if ((*i)->visited)
continue;

(*i)->dfs(res);
}

res.push_front(name_);
}

int main(void)
{
std::map<std::string, class node *> nodes;

for (;;) {
std::string name;
class node *cur_node;

std::cin >> name;
if (!std::cin.good())
break;

if (nodes.find(name) == nodes.end())
nodes[name] = new node(name);

cur_node = nodes[name];

while (std::cin.good()) {
std::cin >> name;

if (name == "##")
break;

if (nodes.find(name) == nodes.end())
nodes[name] = new node(name);

cur_node->add_child(nodes[name]);
}
}

typedef std::map<std::string, class node *>::iterator node_iterator;

for (node_iterator n = nodes.begin(); n != nodes.end(); ++n) {
for (node_iterator m = nodes.begin();
m != nodes.end(); ++m)
m->second->visited = false;

std::list<std::string> res(nodes.size());
n->second->dfs(res);

for (std::list<std::string>::const_iterator i = res.begin();
i != res.end(); ++i)
std::cout << *i << " ";

std::cout << std::endl;
}
}
57 changes: 57 additions & 0 deletions specs/xmlrpc-c/dso-fixup
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#! /bin/bash
# Copyright (C) 2010 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
#
# 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; version 3 of the License.
#
# 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/>.


## Usage: dso-fixup <build-root> <libdir> <pattern> <libs>*

BR=$1
LIBDIR=$2
PATTERN=$3
shift 3

for i; do
echo -n $(basename "$i")' '
readelf -d $i | sed "\\!(NEEDED).*${PATTERN}!"'s/[^:]\+: \[\(.*\)\]/\1/p;d' | xargs echo -n
echo " ##"
done | ./depsort | while read lib deps; do
link=$BR$LIBDIR/${lib%.so.*}.so
test -L "$link" || {
echo "bad file '$link'" >&2
exit 1
}

set -- $deps
test $# -ne 0 || continue

rm -f $link


{
echo '/* GNU ld script */'
echo -n "INPUT($LIBDIR/$lib"
d=
if test "$#" -gt 0; then
echo -n " AS_NEEDED("
for i; do
echo -n "$d$LIBDIR/$i"
d=' '
done
echo -n ")"
fi
echo ")"
} > "$link"

chmod 0644 "$link"
done
Loading

0 comments on commit d0bc07d

Please sign in to comment.