synched with trunk at revision 34793
authorNick Samarin <nicks1987@bigmir.net>
Wed, 16 Feb 2011 16:46:29 +0000 (16:46 +0000)
committerNick Samarin <nicks1987@bigmir.net>
Wed, 16 Feb 2011 16:46:29 +0000 (16:46 +0000)
1  2 
build_files/cmake/cmake_consistency_check.py
build_files/cmake/example_scripts/make_quiet.sh
build_files/package_spec/build_debian.sh
build_files/package_spec/pacman/PKGBUILD
build_files/package_spec/pacman/blender.install

index 0000000,87bbc92..a34f21d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,229 +1,229 @@@
 -# $Id$
+ #!/usr/bin/env python
++# $Id: cmake_consistency_check.py 34636 2011-02-04 09:27:25Z campbellbarton $
+ # ***** BEGIN GPL LICENSE BLOCK *****
+ #
+ # 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; either version 2
+ # of the License, or (at your option) any later version.
+ #
+ # 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, write to the Free Software Foundation,
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+ # Contributor(s): Campbell Barton
+ #
+ # ***** END GPL LICENSE BLOCK *****
+ # <pep8 compliant>
+ IGNORE = \
+     "/test/",\
+     "/decimate_glut_test/",\
+     "/BSP_GhostTest/",\
+     "/release/",\
+     "/xembed/",\
+     "/decimation/intern/future/",\
+     "/TerraplayNetwork/",\
+     "/ik_glut_test/"
+ import os
+ from os.path import join, dirname, normpath, abspath
+ base = join(os.path.dirname(__file__), "..", "..")
+ base = normpath(base)
+ base = abspath(base)
+ print("Scanning:", base)
+ global_h = set()
+ global_c = set()
+ import os
+ from os.path import  splitext
+ def source_list(path, filename_check=None):
+     for dirpath, dirnames, filenames in os.walk(path):
+         # skip '.svn'
+         if dirpath.startswith("."):
+             continue
+         for filename in filenames:
+             if filename_check is None or filename_check(filename):
+                 yield os.path.join(dirpath, filename)
+ # extension checking
+ def is_c_header(filename):
+     ext = splitext(filename)[1]
+     return (ext in (".h", ".hpp", ".hxx"))
+ def is_cmake(filename):
+     ext = splitext(filename)[1]
+     return (ext == ".cmake") or (filename == "CMakeLists.txt")
+ def is_c_header(filename):
+     ext = splitext(filename)[1]
+     return (ext in (".h", ".hpp", ".hxx"))
+ def is_c(filename):
+     ext = splitext(filename)[1]
+     return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
+ def is_c_any(filename):
+     return is_c(filename) or is_c_header(filename)
+ def cmake_get_src(f):
+     sources_h = []
+     sources_c = []
+     filen = open(f, "r", encoding="utf8")
+     it = iter(filen)
+     found = False
+     i = 0
+     # print(f)
+     while it is not None:
+         while it is not None:
+             i += 1
+             try:
+                 l = next(it)
+             except StopIteration:
+                 it = None
+                 break
+             l = l.strip()
+             if not l.startswith("#"):
+                 if 'set(SRC' in l or ('set(' in l and l.endswith("SRC")):
+                     if len(l.split()) > 1:
+                         raise Exception("strict formatting not kept 'set(SRC*' %s:%d" % (f, i))
+                     found = True
+                     break
+                 if "list(APPEND SRC" in l:
+                     if l.endswith(")"):
+                         raise Exception("strict formatting not kept 'list(APPEND SRC...)' on 1 line %s:%d" % (f, i))
+                     found = True
+                     break
+         if found:
+             cmake_base = dirname(f)
+             while it is not None:
+                 i += 1
+                 try:
+                     l = next(it)
+                 except StopIteration:
+                     it = None
+                     break
+                 l = l.strip()
+                 if not l.startswith("#"):
+                     if ")" in l:
+                         if l.strip() != ")":
+                             raise Exception("strict formatting not kept '*)' %s:%d" % (f, i))
+                         break
+                     # replace dirs
+                     l = l.replace("${CMAKE_CURRENT_SOURCE_DIR}", cmake_base)
+                     if not l:
+                         pass
+                     elif l.startswith("$"):
+                         print("Cant use var '%s' %s:%d" % (l, f, i))
+                     elif len(l.split()) > 1:
+                         raise Exception("Multi-line define '%s' %s:%d" % (l, f, i))
+                     else:
+                         new_file = normpath(join(cmake_base, l))
+                         if is_c_header(new_file):
+                             sources_h.append(new_file)
+                         elif is_c(new_file):
+                             sources_c.append(new_file)
+                         elif l in ("PARENT_SCOPE", ):
+                             # cmake var, ignore
+                             pass
+                         else:
+                             raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file))
+                         # print(new_file)
+             global_h.update(set(sources_h))
+             global_c.update(set(sources_c))
+             '''
+             if not sources_h and not sources_c:
+                 raise Exception("No sources %s" % f)
+             sources_h_fs = list(source_list(cmake_base, is_c_header))
+             sources_c_fs = list(source_list(cmake_base, is_c))
+             '''
+             # find missing C files:
+             '''
+             for ff in sources_c_fs:
+                 if ff not in sources_c:
+                     print("  missing: " + ff)
+             '''
+     filen.close()
+ for cmake in source_list(base, is_cmake):
+     cmake_get_src(cmake)
+ def is_ignore(f):
+     for ig in IGNORE:
+         if ig in f:
+             return True
+     return False
+ # First do stupid check, do these files exist?
+ for f in (global_h | global_c):
+     if f.endswith("dna.c"):
+         continue
+     if not os.path.exists(f):
+         raise Exception("CMake referenced file missing: " + f)
+ # now check on files not accounted for.
+ print("\nC/C++ Files CMake doesnt know about...")
+ for cf in sorted(source_list(base, is_c)):
+     if not is_ignore(cf):
+         if cf not in global_c:
+             print("missing_c: ", cf)
+ print("\nC/C++ Headers CMake doesnt know about...")
+ for hf in sorted(source_list(base, is_c_header)):
+     if not is_ignore(hf):
+         if hf not in global_h:
+             print("missing_h: ", hf)
+ # test encoding
+ import traceback
+ for files in (global_c, global_h):
+     for f in sorted(files):
+         if os.path.exists(f):
+             # ignore outside of our source tree
+             if "extern" not in f:
+                 i = 1
+                 try:
+                     for l in open(f, "r", encoding="utf8"):
+                         i += 1
+                 except:
+                     print("Non utf8: %s:%d" % (f, i))
+                     if i > 1:
+                         traceback.print_exc()
@@@ -1,48 -1,50 +1,50 @@@
--# Maintainer: Campbell Barton <ideasman42 at gmail dot com>
--
--# custom blender vars
- blender_srcdir=$srcdir/../../../..
 -blender_srcdir=$(dirname $srcdir)"/../../.."
 -blender_revision=$(svnversion $blender_srcdir)
--blender_version=$(grep BLENDER_VERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9)
- blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9)
- blender_ver_string=$(expr $blender_version / 100).$(expr $blender_version % 100).$blender_subversion
 -# blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9)
 -blender_ver_string=$(expr $blender_version / 100).$(expr $blender_version % 100)+svn$blender_revision
--
--pkgname=blender-beta
--pkgver=$blender_ver_string
--pkgrel=1
--pkgdesc="A fully integrated 3D graphics creation suite"
--arch=('i686' 'x86_64')
--url="www.blender.org"
--license=('GPL')
--groups=()
- depends=('libjpeg' 'libpng' 'openexr'  'python3>=3.1' 'gettext' 'libxi' 'libxmu' 'mesa' 'freetype2' 'openal' 'sdl' 'libsndfile' 'libsamplerate' 'ffmpeg')
 -depends=('libjpeg' 'libpng' 'openexr'  'python>=3.1' 'gettext' 'libxi' 'libxmu' 'mesa' 'freetype2' 'openal' 'sdl' 'libsndfile' 'libsamplerate' 'ffmpeg')
--makedepends=('cmake' 'svn')
--optdepends=()
--provides=('blender')
--conflicts=('blender')
--replaces=()
--backup=()
--options=()
--install=blender.install
--# use current svn to make the package.
--# source=(http://download.blender.org/source/$pkgname-$pkgver.tar.gz)
--# md5sums=('27edb80c82c25252d43d6a01980d953a') #generate with 'makepkg -g'
--source=()
--md5sums=()
--noextract=()
--
--build() {
--  mkdir -p $srcdir/build
--  cd $srcdir/build
--  cmake $blender_srcdir \
--    -DCMAKE_INSTALL_PREFIX:PATH=/usr \
--    -DCMAKE_BUILD_TYPE:STRING=Release \
--    -DWITH_PYTHON_INSTALL:BOOL=OFF \
--    -DWITH_OPENCOLLADA:BOOL=OFF
--
--  make
--}
--
--package() {
--  cd $srcdir/build
--  make DESTDIR="$pkgdir" install
 -  python -m compileall $pkgdir/usr/share/blender
--}
++# Maintainer: Campbell Barton <ideasman42 at gmail dot com>\r
++\r
++# custom blender vars\r
++blender_srcdir=$(dirname $srcdir)"/../../.."\r
++blender_revision=$(svnversion $blender_srcdir)\r
++blender_version=$(grep BLENDER_VERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9)\r
++# blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9)\r
++blender_ver_string=$(expr $blender_version / 100).$(expr $blender_version % 100)+svn$blender_revision\r
++\r
++pkgname=blender-beta\r
++pkgver=$blender_ver_string\r
++pkgrel=1\r
++pkgdesc="A fully integrated 3D graphics creation suite"\r
++arch=('i686' 'x86_64')\r
++url="www.blender.org"\r
++license=('GPL')\r
++groups=()\r
++depends=('libjpeg' 'libpng' 'openexr'  'python>=3.1' 'gettext' 'libxi' 'libxmu' 'mesa' 'freetype2' 'openal' 'sdl' 'libsndfile' 'libsamplerate' 'ffmpeg')\r
++makedepends=('cmake' 'svn')\r
++optdepends=()\r
++provides=('blender')\r
++conflicts=('blender')\r
++replaces=()\r
++backup=()\r
++options=()\r
++install=blender.install\r
++# use current svn to make the package.\r
++# source=(http://download.blender.org/source/$pkgname-$pkgver.tar.gz)\r
++# md5sums=('27edb80c82c25252d43d6a01980d953a') #generate with 'makepkg -g'\r
++source=()\r
++md5sums=()\r
++noextract=()\r
++\r
++build() {\r
++  mkdir -p $srcdir/build\r
++  cd $srcdir/build\r
++  cmake $blender_srcdir \\r
++    -DCMAKE_INSTALL_PREFIX:PATH=/usr \\r
++    -DCMAKE_BUILD_TYPE:STRING=Release \\r
++    -DWITH_PYTHON_INSTALL:BOOL=OFF \\r
++    -DWITH_OPENCOLLADA:BOOL=OFF\r
++\r
++  make\r
++}\r
++\r
++package() {\r
++  cd $srcdir/build\r
++  make DESTDIR="$pkgdir" install\r
++  python -m compileall $pkgdir/usr/share/blender\r
++}\r
@@@ -1,29 -1,29 +1,29 @@@
--post_install() {
--  cat << EOF
--
--NOTE
------
--Happy blending!
--
--EOF
--  echo "update desktop mime database..."
--  update-desktop-database
--}
--
--post_upgrade() {
--  post_install $1
--}
--
--pre_remove() {
--  /bin/true
--}
--
--post_remove() {
--  echo "update desktop mime database..."
--  update-desktop-database
--}
--
--op=$1
--shift
--
--$op $*
++post_install() {\r
++  cat << EOF\r
++\r
++NOTE\r
++----\r
++Happy blending!\r
++\r
++EOF\r
++  echo "update desktop mime database..."\r
++  update-desktop-database\r
++}\r
++\r
++post_upgrade() {\r
++  post_install $1\r
++}\r
++\r
++pre_remove() {\r
++  /bin/true\r
++}\r
++\r
++post_remove() {\r
++  echo "update desktop mime database..."\r
++  update-desktop-database\r
++}\r
++\r
++op=$1\r
++shift\r
++\r
++$op $*\r