Patchwork [meta-oe,4/4] llvm: split packages a bit more

login
register
mail settings
Submitter Martin Jansa
Date July 6, 2013, 7:33 p.m.
Message ID <12e6a8a7f368c9228b2625d42a5973dc48186721.1373139082.git.Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/53229/
State Accepted, archived
Commit b95f9d5f5821162cf40e915a0e35a94a605b744e
Headers show

Comments

Martin Jansa - July 6, 2013, 7:33 p.m.
* use split for llvm3.* like we did for llvm2.*
* use PACKAGESPLITFUNCS instead of populate_packages_prepend
* improve regexp in PACKAGES_DYNAMIC
* append ${LLVM_RELEASE} to split package name, otherwise sstate
  will complain about multiple recipes trying to install pkgdata
* split also -staticdev and -dbg libs, PN-dbg and PN-staticdev
  were huge, let old PN-dbg/PN-staticdev to RDEPEND on splitted
  packages
* mesa packages libegl-gallium, libgbm-gallium, mesa-driver-pipe-swrast,
  mesa-driver-pipe-vmwgfx, mesa-driver-swrast, mesa-driver-vmwgfx are
  now depending only on libllvm3.2-llvm-3.2 (>= 3.2) instead of main
  llvm3.2 package, but for llvm-3* it's not big improvement
  (installed size wise), because libLLVM-3.2.so was creating 99% of that
  size.
* there are still some huge packages:
  llvm2.8-dbg is huge because BUILD_SHARED_LIBS is disabled for 2.8
              causing all binaries in ${bindir}/.debug to contain big
              static libs
  llvm2.9 is missing, because it has BUILD_SHARED_LIBS enabled and
          unlike 3.* it doesn't build static versions at all unless
          explicitly requested

  51M     llvm-test/llvm3.2/3.2-r0/packages-split/libllvm3.2-llvmselectiondag-staticdev
  53M     llvm-test/llvm2.8/2.8-r3/packages-split/llvm2.8-dev
  54M     llvm-test/llvm2.8/2.8-r3/packages-split/libllvm2.8-llvmanalysis-staticdev
  55M     llvm-test/llvm3.3/3.3-r0/packages-split/libllvm3.3-llvmselectiondag-staticdev
  62M     llvm-test/llvm3.2/3.2-r0/packages-split/libllvm3.2-llvmanalysis-staticdev
  63M     llvm-test/llvm3.3/3.3-r0/packages-split/libllvm3.3-llvmanalysis-staticdev
  67M     llvm-test/llvm2.9/2.9-r3/packages-split/llvm2.9-dbg
  90M     llvm-test/llvm3.2/3.2-r0/packages-split/llvm3.2-dbg
  92M     llvm-test/llvm3.3/3.3-r0/packages-split/llvm3.3-dbg
  102M    llvm-test/llvm2.8/2.8-r3/packages-split/libllvm2.8-llvmcodegen-staticdev
  127M    llvm-test/llvm3.2/3.2-r0/packages-split/libllvm3.2-llvmcodegen-staticdev
  133M    llvm-test/llvm3.3/3.3-r0/packages-split/libllvm3.3-llvmcodegen-staticdev
  190M    llvm-test/llvm3.2/3.2-r0/packages-split/libllvm3.2-llvm-3.2-dbg
  207M    llvm-test/llvm3.3/3.3-r0/packages-split/libllvm3.3-llvm-3.3-dbg
  628M    llvm-test/llvm2.8/2.8-r3/packages-split/llvm2.8-dbg

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta-oe/recipes-core/llvm/llvm.inc  | 30 ++++++++++++++++++++++++++----
 meta-oe/recipes-core/llvm/llvm2.inc | 14 --------------
 meta-oe/recipes-core/llvm/llvm3.inc |  4 ----
 3 files changed, 26 insertions(+), 22 deletions(-)

Patch

diff --git a/meta-oe/recipes-core/llvm/llvm.inc b/meta-oe/recipes-core/llvm/llvm.inc
index 20588f3..c0d6b6e 100644
--- a/meta-oe/recipes-core/llvm/llvm.inc
+++ b/meta-oe/recipes-core/llvm/llvm.inc
@@ -32,11 +32,33 @@  inherit perlnative pythonnative
 LLVM_RELEASE = "${PV}"
 LLVM_DIR = "llvm${LLVM_RELEASE}"
 
-FILES_${PN}-dbg += "${bindir}/${LLVM_DIR}/.debug \
-                    ${libdir}/${LLVM_DIR}/.debug \
+ALLOW_EMPTY_${PN} = "1"
+ALLOW_EMPTY_${PN}-staticdev = "1"
+FILES_${PN} = ""
+FILES_${PN}-staticdev = ""
+DOTDEBUG-dbg = " ${bindir}/${LLVM_DIR}/.debug \
+                 ${libdir}/${LLVM_DIR}/.debug/BugpointPasses.so \
+                 ${libdir}/${LLVM_DIR}/.debug/LLVMHello.so \
+                 /usr/src/debug \
 "
-FILES_${PN}-dev += "${bindir} \
+
+FILES_${PN}-dev += "${bindir}/${LLVM_DIR} \
                     ${libdir}/${LLVM_DIR}/BugpointPasses.so \
                     ${libdir}/${LLVM_DIR}/LLVMHello.so \
 "
-FILES_${PN}-staticdev = "${libdir}/${LLVM_DIR}/*.a"
+
+PACKAGES_DYNAMIC = "^libllvm-.*$"
+
+python llvm_populate_packages() {
+    libllvm_libdir = bb.data.expand('${libdir}/${LLVM_DIR}', d)
+    split_packages = do_split_packages(d, libllvm_libdir, '^lib(.*)\.so$', 'libllvm${LLVM_RELEASE}-%s', 'Split package for %s', allow_dirs=True)
+    split_dbg_packages = do_split_packages(d, libllvm_libdir+'/.debug', '^lib(.*)\.so$', 'libllvm${LLVM_RELEASE}-%s-dbg', 'Split debug package for %s', allow_dirs=True)
+    split_staticdev_packages = do_split_packages(d, libllvm_libdir, '^lib(.*)\.a$', 'libllvm${LLVM_RELEASE}-%s-staticdev', 'Split staticdev package for %s', allow_dirs=True)
+    if split_packages:
+        pn = d.getVar('PN', True)
+        d.appendVar('RDEPENDS_' + pn, ' '+' '.join(split_packages))
+        d.appendVar('RDEPENDS_' + pn + '-dbg', ' '+' '.join(split_dbg_packages))
+        d.appendVar('RDEPENDS_' + pn + '-staticdev', ' '+' '.join(split_staticdev_packages))
+}
+
+PACKAGESPLITFUNCS_prepend = "llvm_populate_packages "
diff --git a/meta-oe/recipes-core/llvm/llvm2.inc b/meta-oe/recipes-core/llvm/llvm2.inc
index b239d30..8765a76 100644
--- a/meta-oe/recipes-core/llvm/llvm2.inc
+++ b/meta-oe/recipes-core/llvm/llvm2.inc
@@ -53,8 +53,6 @@  EXTRA_OECMAKE = "\
 # We need to reset this to avoid breakage as we build out of tree
 TOOLCHAIN_OPTIONS = ""
 
-PACKAGES_DYNAMIC = "llvm-*"
-
 # the difference to the non-native build is that we do not need
 # to declare the location of the tblgen executable.
 EXTRA_OECMAKE_class-native = "\
@@ -68,18 +66,6 @@  EXTRA_OECMAKE_class-native = "\
     -DNM_PATH:FILEPATH=${NM} \
 "
 
-PACKAGES_class-native = ""
-
-PACKAGES_DYNAMIC_class-native = ""
-
-python populate_packages_prepend () {
-    libllvm_libdir = bb.data.expand('${libdir}/${LLVM_DIR}', d)
-    do_split_packages(d, libllvm_libdir, '^lib(.*)\.so$', 'libllvm-%s', 'Split package for %s', allow_dirs=True)
-}
-
-FILES_${PN} = ""
-ALLOW_EMPTY_${PN} = "1"
-
 base_do_compile_prepend() {
     # Avoid *** No rule to make target `native/bin/tblgen', needed by `include/llvm/Intrinsics.gen.tmp'
     oe_runmake tblgen
diff --git a/meta-oe/recipes-core/llvm/llvm3.inc b/meta-oe/recipes-core/llvm/llvm3.inc
index b04fe24..798d4a2 100644
--- a/meta-oe/recipes-core/llvm/llvm3.inc
+++ b/meta-oe/recipes-core/llvm/llvm3.inc
@@ -18,10 +18,6 @@  EXTRA_OECONF += "--disable-assertions \
                  --enable-shared \
                  --enable-targets=host-only"
 EXTRA_OEMAKE += "REQUIRES_RTTI=1 VERBOSE=1"
-FILES_${PN} = "${libdir}/lib*.so \
-               ${libdir}/${LLVM_DIR}/*"
-FILES_SOLIBSDEV = ""
-INSANE_SKIP_${PN} = "dev-so"
 
 do_configure_prepend() {
     # Remove RPATHs