# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils java-utils DESCRIPTION="TinyOS: an open-source OS designed for wireless embedded sensor networks" HOMEPAGE="http://www.tinyos.net/" SRC_URI="mirror://sourceforge/tinyos/${P}.tar.gz" LICENSE="Intel" SLOT="0" KEYWORDS="~x86" IUSE="javacomm" RESTRICT="maketest" # WARNING: If somebody knows TinyOS better than me, please read carefully this ebuild # and correct it as soon as possible. The java-team and the dev-embedded team # should review this. #From the install instructions: # * Download and install IBMs 1.4 JDK and javax.comm # avarice-2.0.20030825cvs-1.i386.rpm # avr-binutils-2.13.2.1-1.i386.rpm # avr-gcc-3.3tinyos-1.i386.rpm # avr-insight-pre6.0cvs.tinyos-1.3.i386.rpm # avr-libc-20030512cvs-1.i386.rpm # graphviz-1.10-1.i386.rpm # nesc-1.1-1.i386.rpm # tinyos-tools-1.1.0-1.i386.rpm #Most of them are not really required in order to build this package, but it's better have them here. DEPEND=">=dev-java/ibm-jdk-bin-1.4 >=sys-devel/crossdev-0.9.5 >=cross-avr/binutils-2.13.2.1 >=cross-avr/gcc-3.3 >=cross-avr/avr-libc-1.2 >=media-gfx/graphviz-1.10" RDEPEND=">=dev-embedded/avarice-2.0 >=dev-embedded/avr-insight-6.0 >=dev-embedded/nesc-1.1 >=dev-embedded/tinyos-tools-1.1.0 >=dev-java/ibm-jdk-bin-1.4 >=cross-avr/binutils-2.13.2.1 >=cross-avr/gcc-3.3 >=cross-avr/avr-libc-1.2 >=media-gfx/graphviz-1.10" PDEPEND=">=dev-embedded/tinyos-tools-1.1.0 >=dev-embedded/nesc-1.1" S=${WORKDIR}/${P} pkg_setup() { java-utils_setup-vm java-utils_ensure-vm-version-ge 1 4 0 local vendor=`java-utils_get-vm-vendor` einfo "${vendor} vm detected." if ! [[ ${vendor} = "ibm-jdk-bin" ]]; then eerror "ibm-jdk-bin is required!" eerror "Please use java-config -S to set your system vm to a ibm-jdk." die "setup failed due to missing prerequisite: ibm-jdk-bin" fi if ! useq javacomm ; then eerror "javacomm is required! Add javacomm to your use flag then re-emerge ibm-jdk-bin." eerror "Then re-emerge this package." die "setup failed due to missing prerequisite: javacomm" fi } src_unpack() { unpack ${A} || die "unpack failed" cd ${S}/tools/src/uisp/src epatch ${FILESDIR}/uisp-gcc34.patch || die "patching uisp failed" einfo "Setting up virtual machine" java-utils_setup-vm } src_compile() { make prefix=/opt/tinyos-1.x all || die "make all failed" } src_install() { # The build system of this package is totally crippled / non-existing. # We'll just correct the mistakes afterwards (much less work). cd tools make prefix=${D}/opt/tinyos-1.x install || die "make install failed" cd ${S} # make sure only regular files are in there if [ `find apps tos ! -type d ! -type f -printf x` ]; then die "non-regular files in apps or tos directory found!"; fi # correct file modes chown -R root:root apps tos doc tools\ && find apps tos doc tools -type d ! -perm 755 -exec chmod 755 \{\} \; \ && find apps tos doc -type f ! -perm 644 -exec chmod 644 \{\} \; \ || die "correcting filemodes failed" # install them mv apps tos INTEL-LICENSE.txt Makefile doc tools ${D}/opt/tinyos-1.x \ || die "moving apps & tos directories failed" #Ok, now do some black magic... tinyos.sh.in may be ignored with this. dodir /etc/profile.d echo "TOSROOT=\"/opt/tinyos-1.x\"" >${D}/etc/profile.d/tinyos.sh echo "export TOSROOT" >>${D}/etc/profile.d/tinyos.sh echo "TOSDIR=\"$TOSROOT/tos\"" >>${D}/etc/profile.d/tinyos.sh echo "export TOSDIR" >>${D}/etc/profile.d/tinyos.sh echo "CLASSPATH=\`$TOSROOT/tools/java/javapath\`" >>${D}/etc/profile.d/tinyos.sh echo "export CLASSPATH" >>${D}/etc/profile.d/tinyos.sh #Gentoo already set the PATH for java and javac. chmod 755 ${D}/etc/profile.d/tinyos.sh } pkg_postinst() { einfo "If you want to use the uisp version bundled with TinyOS be sure to" einfo "include /opt/tinyos-1.x/bin in your PATH." einfo "----------------------------------------------------------------------" ewarn "You should probably also change the permissions on /dev/ttyS to 666" ewarn "for all serial ports that you will use, and on /dev/parport0 if you're" ewarn "programming via the parallel port. This will allow you to access these" ewarn "devices, and hence run uisp and SerialForwarder, as a normal user." ewarn "--------------------------------------------------------------------- " ewarn "Now you've to emerge dev-embedded/nesc then do:" ewarn "\"ebuild /var/db/pkg/dev-db/${PF}/${PF}.ebuild config\"" } pkg_config() { einfo "Compiling TinyOS java tools" java-utils_setup-vm java-utils_ensure-vm-version-ge 1 4 0 local vendor=`java-utils_get-vm-vendor` einfo "${vendor} vm detected." if ! [[ ${vendor} = "ibm-jdk-bin" ]]; then eerror "ibm-jdk-bin is required!" eerror "Please use java-config -S to set your system vm to a ibm-jdk." die "setup failed due to missing prerequisite: ibm-jdk-bin" fi source /etc/profile.d/tinyos.sh cd $TOSROOT/tools/java make || die "make TinyOS java tools failed." einfo "Now TinyOS is fully compiled." }