mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
704 B

  1. #!/bin/sh
  2. incdir=${1:-/usr/include}
  3. incdir=${incdir%/}
  4. echo 'Created by architecture/share/copy-inc.sh.' > README
  5. find . -type f -name '*.h' | xargs rm -fv
  6. find . -type d -empty | xargs rmdir -p 2> /dev/null
  7. files="stdio.h string.h stdlib.h unistd.h errno.h limits.h fcntl.h
  8. signal.h sys/socket.h sys/un.h sys/ucontext.h sys/syslog.h"
  9. for file in $files ; do
  10. mkdir -p `dirname $file`
  11. [ -f "$file" ] || cp -v "$incdir/$file" "$file"
  12. egrep '^# *(include|define.*_H)' < $file > temp.h
  13. cpp -w -D_GNU_SOURCE -M -I "$incdir" temp.h |
  14. tr ' ' '\n' | grep "^$incdir/" | while read fn ; do
  15. xfn=${fn#$incdir/}
  16. mkdir -p `dirname $xfn`
  17. [ -f "$xfn" ] || cp -v $fn $xfn
  18. done
  19. done
  20. rm -f temp.h