Fix ruby installation in comedilib-9999.ebuild.
authorW. Trevor King <wking@drexel.edu>
Sat, 11 Dec 2010 12:21:17 +0000 (07:21 -0500)
committerW. Trevor King <wking@drexel.edu>
Sat, 11 Dec 2010 12:21:17 +0000 (07:21 -0500)
Also:
* Move assorted /usr/share/doc/${PF}/*.conf into /usr/share/doc/${PF}/etc/
* Remove /usr/share/doc/${PF}/ if the doc USE flag is not set
* Only run distutils_pkg_postinst if the python USE flag is set

Manifest
comedilib-9999.ebuild
files/comedilib-9999-setup.rb.patch [new file with mode: 0644]

index 6e2f4e1a87e00d00203c5c08f0365f219c68020f..e7af2f928a5acb5a61ee3a80e8b27667f1efa38d 100644 (file)
--- a/Manifest
+++ b/Manifest
@@ -1,4 +1,5 @@
 AUX comedilib-9999-setup.py.patch 956 RMD160 721be9715cf1058fb2e9407f36da04fa6cb8b95f SHA1 56c894ed915b29ab9f91fd327bd8b5c932c12161 SHA256 74f03d023d93c0cebb7e0463146e95a5abe5140501472fc2fca2ef36cb11e207
-EBUILD comedilib-9999.ebuild 2209 RMD160 6454a93a3a758d82cdaf34d45e776d55a80c901c SHA1 1f9d4ef91344d2af0571488e1b43ab02a01dd620 SHA256 cea8907d05d70865e4d76672e1a445af04357f312c380618e47aea8632e6965d
+AUX comedilib-9999-setup.rb.patch 318 RMD160 c9bcd07119fb7c2c92ce9c133947f51a3bd85c51 SHA1 8e213fdc3c319b611e23a98fe0844db55ef28aed SHA256 afb1fa061a2b703a66e09c408b21a337592d519ead51984f78f7b64dbc74c5a9
+EBUILD comedilib-9999.ebuild 3338 RMD160 c178bb3448961a54d64a6dc7e00407d2c4a1277c SHA1 6e6718ebfc9184cb07129551ad94651429b151d5 SHA256 4e253bea2ef22a046cc501f6a2eaffe6c12596edbf1ac19c2c7e607b5cd64331
 MISC ChangeLog 1168 RMD160 62c9992630de85e02a25d5a4cc077386211b8859 SHA1 bc9d91fff9c4f05804d564f5e55fd63ed99c3426 SHA256 6766a0d3f76055ed559975a91df6f2876289f129248fa739853da0d2606bec9f
 MISC metadata.xml 247 RMD160 6735f3a5dd2d7a2b70589d1693f35d54291b7147 SHA1 c015969fe50967340dd050a44cb9f8a30b5e34a5 SHA256 9e65060e5f9d0a50d28c7a69d9c27fed6c3037fdd3e420cc276627fde2794f72
index aa4cf91e1ab58bc4de07440507f9d25475b836c3..b5bea7ddd21e05e3ba21c86ee9881296288a8326 100644 (file)
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: $
 
-EAPI="2"
+EAPI="3"
 
 PYTHON_DEPEND="python? 2"
 RESTRICT_PYTHON_ABIS="3.*"
@@ -40,6 +40,7 @@ DEPEND=">=sci-misc/comedi-headers-${PV}
        ruby? (
                dev-lang/swig
                dev-lang/ruby
+               app-admin/chrpath
        )
        doc? ( app-text/xmlto )"
 RDEPEND=""
@@ -50,21 +51,28 @@ src_prepare()
        if [ "${PV}" == "9999" ] ; then
                ./autogen.sh
        fi
-  if use python ; then
+       if use python ; then
                epatch "${FILESDIR}/${P}"-setup.py.patch
                cd "${S}/swig/python"
                ln -s ../comedi.i
                distutils_src_prepare
                cd "${S}"
        fi
+       if use ruby ; then
+               epatch "${FILESDIR}/${P}"-setup.rb.patch
+       fi
 }
 
 src_configure()
 {
-  #$(use_enable python python-binding)
+       # handle binding compilation and installation ourselves
+       #$(use_enable python python-binding)
+       #$(use_enable ruby ruby-binding)
        econf \
+               --sysconfdir="/usr/share/doc/${PF}/etc" \
+               --docdir="/usr/share/doc/${PF}" \
                --disable-python-binding \
-               $(use_enable ruby ruby-binding) \
+               --disable-ruby-binding \
                $(use_enable doc docbook) \
                || die "econf failed"
 }
@@ -77,27 +85,52 @@ src_compile()
                distutils_src_compile
                cd "${S}"
        fi
+       if use ruby ; then
+               cd "${S}/swig/ruby"
+               swig -ruby -o ext/comedi_ruby_wrap.c -I${S}/include ../comedi.i \
+                       || die "swigging ruby binding failed"
+               DESTDIR="${D}" ruby setup.rb config --prefix="${D}/usr" \
+                       -- \
+                       --with-comedilib-include="${S}/include" \
+                       --with-comedilib-lib="${S}/lib/.libs" \
+                       || die "ruby setup.rb config failed"
+               ruby setup.rb setup || die "ruby setup.rb setup failed"
+               chrpath -d ext/comedi.so || die "chrpath -d failed"
+               cd "${S}"
+       fi
 }
 
 src_install()
 {
        emake DESTDIR="${D}" install || die "emake install failed"
        keepdir /var/calibrations
+       local DOCINTO="/usr/share/doc/${PF}"
+       local DDOCINTO="${D}${DOCINTO}"
        if use doc ; then
-               local DOCINTO="/usr/share/doc/${PF}"
-               local DDOCINTO="${D}${DOCINTO}"
+               mv ${DOCINTO}/*.conf "${DOCINTO}/etc/" || die || 'moving *.conf failed'
                insinto ${DOCINTO}/demo
                doins demo/Makefile demo/README demo/*.c demo/*.h || die "doins failed"
                if use python ; then
                        insinto ${DOCINTO}/demo/python
                        doins demo/python/README demo/python/*.py || die "doins failed"
                fi
+               if use ruby ; then
+                       insinto ${DOCINTO}/demo/ruby
+                       doins swig/ruby/README swig/ruby/demo/*.rb swig/ruby/demo/{cmd,inp,outp} || die "doins failed"
+               fi
+       else
+               rm -rf "${DDOCINTO}"
        fi
        if use python ; then
                cd "${S}/swig/python"
                distutils_src_install
                cd "${S}"
        fi
+       if use ruby ; then
+               cd "${S}/swig/ruby"
+               ruby setup.rb install || die "ruby setup.rb install failed"
+               cd "${S}"
+       fi
        # comedi.h already installed by sci-misc/comedi-headers
        rm ${D}/usr/include/comedi.h || die "failed to remove comedi.h"
        # comedi_calibrate is a separate package
@@ -106,7 +139,9 @@ src_install()
 
 pkg_postinst()
 {
-       distutils_pkg_postinst
+       if use python ; then
+               distutils_pkg_postinst
+       fi
 }
 
 pkg_postrm()
diff --git a/files/comedilib-9999-setup.rb.patch b/files/comedilib-9999-setup.rb.patch
new file mode 100644 (file)
index 0000000..9f6a6da
--- /dev/null
@@ -0,0 +1,14 @@
+diff --git a/swig/ruby/setup.rb b/swig/ruby/setup.rb
+index 424a5f3..228ec2e 100644
+--- a/swig/ruby/setup.rb
++++ b/swig/ruby/setup.rb
+@@ -41,6 +41,9 @@ def File.dir?(path)
+   File.directory?((path[-1,1] == '/') ? path : path + '/')
+ end
++if ENV['DESTDIR'] then
++  DESTDIR = ENV['DESTDIR']
++end
+ class ConfigTable