# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python import shutil DBUS_ARCH_DEPS_UNVERSAL='''\ #ifdef __i386__ #include "i386/dbus-arch-deps.h" #elif defined(__ppc__) #include "ppc/dbus-arch-deps.h" #elif defined(__x86_64__) #include "x86_64/dbus-arch-deps.h" #else #error "Unsupported Architecture" #endif ''' class Recipe(recipe.Recipe): name = 'dbus' version = '1.6.4' # either AFLv2.1 or or GPLv2+ licenses = [License.AFLv2_1] autoreconf = True deps = ['expat'] configure_options = '--disable-xml-docs --disable-doxygen-docs ' \ '--disable-selinux --disable-libaudit ' \ '--disable-launchd --disable-tests '\ '--disable-x11-autolaunch --disable-Werror ' files_libs = ['libdbus-1'] files_bins = ['dbus-launch', 'dbus-send', 'dbus-daemon', 'dbus-monitor'] files_devel = [ 'lib/pkgconfig/dbus-1.pc', 'include/dbus-1.0/dbus/dbus-address.h', 'include/dbus-1.0/dbus/dbus-bus.h', 'include/dbus-1.0/dbus/dbus-connection.h', 'include/dbus-1.0/dbus/dbus-errors.h', 'include/dbus-1.0/dbus/dbus-macros.h', 'include/dbus-1.0/dbus/dbus-memory.h', 'include/dbus-1.0/dbus/dbus-message.h', 'include/dbus-1.0/dbus/dbus-misc.h', 'include/dbus-1.0/dbus/dbus-pending-call.h', 'include/dbus-1.0/dbus/dbus-protocol.h', 'include/dbus-1.0/dbus/dbus-server.h', 'include/dbus-1.0/dbus/dbus-shared.h', 'include/dbus-1.0/dbus/dbus-signature.h', 'include/dbus-1.0/dbus/dbus-syntax.h', 'include/dbus-1.0/dbus/dbus-threads.h', 'include/dbus-1.0/dbus/dbus-types.h', 'include/dbus-1.0/dbus/dbus.h', 'lib/dbus-1.0/include/dbus/dbus-arch-deps.h', ] platform_files_bins = { Platform.LINUX: ['dbus-uuidgen', 'dbus-cleanup-sockets'], Platform.DARWIN: ['dbus-uuidgen', 'dbus-cleanup-sockets'], } platform_files_misc = { Platform.LINUX: ['libexec/dbus-daemon-launch-helper%(bext)s'], Platform.DARWIN: ['libexec/dbus-daemon-launch-helper%(bext)s'], } def prepare(self): if self.config.target_platform == Platform.LINUX: self.configure_options += ' --with-system-socket=/var/run/dbus/system_bus_socket' self.new_env['LIBS'] = '-lrt' if self.config.target_platform == Platform.DARWIN: arch = self.config.target_arch if arch == Architecture.X86: arch = 'i386' self.files_devel.append( os.path.join('lib', 'dbus-1.0', 'include', 'dbus', arch, 'dbus-arch-deps.h')) def post_install(self): if self.config.target_platform == Platform.DARWIN: # For the universal build we need to ship glibconfig.h of both # architectures ina subfolder and include the correct one depending # on the compiler architecture arch = self.config.target_arch if arch == Architecture.X86: arch = 'i386' incl_dir = os.path.join(self.config.prefix, 'lib', 'dbus-1.0', 'include', 'dbus') arch_dir = os.path.join(incl_dir, arch) if not os.path.exists(arch_dir): os.makedirs(arch_dir) shutil.copyfile(os.path.join(self.build_dir, 'dbus', 'dbus-arch-deps.h'), os.path.join(arch_dir, 'dbus-arch-deps.h')) with open(os.path.join(incl_dir, 'dbus-arch-deps.h'), 'w+') as f: f.write(DBUS_ARCH_DEPS_UNVERSAL)