sync-headers.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. #
  3. # Copyright 2010, 2011 wkhtmltopdf authors
  4. #
  5. # This file is part of wkhtmltopdf.
  6. #
  7. # wkhtmltopdf is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU Lesser General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # wkhtmltopdf is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Lesser General Public License
  18. # along with wkhtmltopdf. If not, see <http:#www.gnu.org/licenses/>.
  19. mkdir -p include/wkhtmltox
  20. find src -iname '*.pro' -or -iname '*.pri' | while read name; do
  21. cat "$name" | sed -nre 's/PUBLIC_HEADERS \+=[ \t]*(.*[^\t ])[^\t ]*/\1/p' | sed -re 's/[\t ]+/\n/g' | sort -u | while read file; do
  22. path="$(dirname $name)/$file"
  23. [ -f "$path" ] || continue
  24. cat $path | sed -n '4,$p' | sed -e '1s/ \*/\/\*\n \*/'> tmpheader
  25. dst="include/wkhtmltox/$(basename $path)"
  26. [ -f "${dst}" ] && cmp -s "$dst" tmpheader && rm tmpheader && continue
  27. echo "$dst"
  28. mv tmpheader "$dst"
  29. done
  30. done