Sisyphus repository
Last update: 3 march 2021 | SRPMs: 17840 | Visits: 20390647
en ru br
ALT Linux repos
S:78.8.0-alt1
5.0: 2.0.0.21-alt0.M50.3
4.1: 2.0.0.21-alt0.M41.1
4.0: 2.0.0.21-alt0.M40.1
3.0: 1.0.6-alt2.1
+updates:1.0.8-alt0.M30.1

Group :: Networking/Mail
RPM: thunderbird

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

#!/bin/sh -euf

PROG="${0##*/}"

usage() {
[ "$1" = 0 ] || exec >&2
cat <<EOF

Program to correct headers at mozilla-based projects.

Usage: $PROG <include_dir> <project_include_dir> <prefix>

include_dir - system includes location
project_include_dir - project includes
prefix - ??

Examle:
$PROG '/usr/include' '/usr/src/RPM/BUILD/firefox-1.5/dist/include' 'firefox'

EOF
[ -n "$1" ] && exit "$1" || exit
}

msg() {
printf %s\\n "$@"
}

find_header() {
local path="$1" && shift
local fn="$1" && shift
while [ -n "$path" ]; do
[ -f "$path/$fn" ] && break
path="${path%/*}"
done
[ -f "$path/$fn" ] && msg "$path/$fn" || return 1
}

[ "$#" -eq 3 ] || usage 1
include_dir="$1" && shift
indir="$1" && shift
my_place="$1" && shift

find "$indir/" -name '*.h' |
while read h; do
sed -ne 's|^[[:space:]]*#[[:space:]]*include[[:space:]]\+"\([^"]\+\)".*$|\1|p' -- "$h" | sort -u |
while read ih; do
ih_name="${ih##*/}"
eh="$(find "$include_dir" -name "$ih_name")" || msg "Error: $h: '$ih'"
if [ -z "$eh" ]; then
if ! eh="$(find_header "${h%/*}" "$ih")"; then
eh="$(find "$indir/" -name "$ih_name")" || msg "Error: $h: '$ih'"
[ "$(printf %s\\n "$eh" |wc -l)" = "1" ] || { msg "Error: $h: '$(msg "$eh" |tr \\n \ )'"; continue; }
fi
[ -n "$eh" ] || { echo "Error: not found: $h: '$ih'"; continue; }
subst "s%^\([[:space:]]*#[[:space:]]*include\)[[:space:]]\+\"$ih\"%\1 <$my_place/${eh#$indir/}>%" -- "$h" ||
msg "Error: $h"
continue
fi
nh="${eh#$include_dir/}"

# check nss/nspr
nh="${nh#*nspr/}"
nh="${nh#*nss/}"

subst "s%^\([[:space:]]*#[[:space:]]*include\)[[:space:]]\+\"$ih\"%\1 <$nh>%" -- "$h" ||
echo "Error: $h: 's%^\([[:space:]]*#[[:space:]]*include\)[[:space:]]\+\"$ih\"%\1 <$nh>%'"
done
done
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin