1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
9 inherit autotools distutils-r1 linux-info perl-functions systemd user
13 DESCRIPTION="Access 1-Wire devices like a filesystem"
14 SRC_URI="mirror://sourceforge/owfs/${MY_P}.tar.gz"
15 HOMEPAGE="http://owfs.org/ https://sourceforge.net/projects/owfs/"
16 KEYWORDS="amd64 arm x86"
18 # Upstream uses crazy SONAME, https://github.com/owfs/owfs/commit/c696fa9b9b44f49c96b9f1c2b3159d277e0c1273
22 IUSE="debug ftdi ftpd fuse httpd parport perl python tcl usb zeroconf"
23 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
26 ftdi? ( dev-embedded/libftdi:0 )
27 fuse? ( sys-fs/fuse:0= )
28 perl? ( dev-lang/perl:= )
29 parport? ( sys-kernel/linux-headers )
30 python? ( ${PYTHON_DEPS} )
31 tcl? ( dev-lang/tcl:0= )
32 usb? ( virtual/libusb:0 )
33 zeroconf? ( net-dns/avahi[mdnsresponder-compat] )
37 perl? ( dev-lang/swig )
38 python? ( dev-lang/swig )
42 "${FILESDIR}"/${PN}-3.1-vendordir.patch
43 "${FILESDIR}"/${PN}-3.1p4-sysmacros.patch
46 S="${WORKDIR}/${MY_P}"
48 OWUID="${OWUID:-owfs}"
49 OWGID="${OWGID:-owfs}"
52 if use kernel_linux; then
55 if linux_config_exists; then
56 if ! linux_chkconfig_present W1; then
57 ewarn "CONFIG_W1 isn't set. You will not be able to use 1-wire bus on this system!"
60 elog "Cannot find a linux kernel configuration. Continuing anyway."
64 use perl && perl_set_version
66 enewgroup ${OWGID} 150
67 enewuser ${OWUID} 150 -1 -1 ${OWGID}
73 # Support user's CFLAGS and LDFLAGS.
74 sed -i "s/@CPPFLAGS@/@CPPFLAGS@ ${CFLAGS}/" \
75 module/swig/perl5/OW/Makefile.linux.in || die
76 sed -i "s/@LIBS@/@LIBS@ ${LDFLAGS}/" \
77 module/swig/perl5/OW/Makefile.linux.in || die
83 # disable owpython since we can build python anyway
84 # and without it, we don't have to fix the build ;)
85 # disable owphp because it is not compatible with PHP-7, bug #651106
88 $(use_enable fuse owfs)
90 $(use_enable ftpd owftpd)
91 $(use_enable httpd owhttpd)
93 $(use_enable perl owperl)
96 $(use_enable tcl owtcl)
97 $(use_enable zeroconf avahi)
98 $(use_enable zeroconf zero)
100 --with-systemdsystemunitdir=$(systemd_get_systemunitdir)
103 if use httpd || use ftpd || use fuse; then
104 myeconf+=( --enable-owserver )
106 myeconf+=( --disable-owserver )
116 local CFLAGS="${CFLAGS} -fno-strict-aliasing"
118 pushd module/ownet/python > /dev/null || die
119 distutils-r1_src_compile
120 popd > /dev/null || die
122 pushd module/swig/python > /dev/null || die
124 distutils-r1_src_compile
125 popd > /dev/null || die
134 if use httpd || use ftpd || use fuse; then
135 newinitd "${FILESDIR}"/owserver.initd-r1 owserver
136 newconfd "${FILESDIR}"/owserver.confd owserver
138 for i in httpd ftpd; do
140 newinitd "${FILESDIR}"/ow${i}.initd-r1 ow${i}
141 newconfd "${FILESDIR}"/ow${i}.confd ow${i}
147 dodir /var/lib/owfs/mnt
148 newinitd "${FILESDIR}"/owfs.initd-r1 owfs
149 newconfd "${FILESDIR}"/owfs.confd owfs
153 use perl && perl_delete_localpod
156 pushd module/ownet/python > /dev/null || die
157 distutils-r1_src_install
158 popd > /dev/null || die
160 pushd module/swig/python > /dev/null || die
161 distutils-r1_src_install
162 popd > /dev/null || die
165 find "${D}" -name '*.la' -delete || die
169 if use httpd || use ftpd || use fuse; then
171 if [[ ${OWUID} != root ]]; then
173 ewarn "In order to allow the OWFS daemon user '${OWUID}' to read"
174 ewarn "from and/or write to a 1 wire bus controller device, make"
175 ewarn "sure the user has appropriate permission to access the"
176 ewarn "corresponding device node/path (e.g. /dev/ttyS0), for example"
177 ewarn "by adding the user to the group 'uucp' (for serial devices)"
178 ewarn "or 'usb' (for USB devices accessed via usbfs on /proc/bus/usb),"
179 ewarn "or install an appropriate UDEV rules (see http://owfs.org/index.php?page=udev-and-usb"
180 ewarn "for more information)."
183 ewarn "In order to allow regular users to read from and/or write to"
184 ewarn "1 wire bus devices accessible via the owfs FUSE filesystem"
185 ewarn "client and its filesystem mountpoint, make sure the user is"
186 ewarn "a member of the group '${OWGID}'."