# vim: ft=make ts=4 sw=4 noet
.DEFAULT_GOAL := all

NAME    = userspace-rcu
VERSION = 0.14.2
GARTYPE = v2

DESCRIPTION = Userspace RCU library
define BLURB
  liburcu is a userspace Read-Copy-Update library. Required by BIND 9.18+.
  Uses GCC atomic builtins on x86; includes Concurrent Data Structures (CDS).
endef

MASTER_SITES = https://lttng.org/files/urcu/
DISTFILES   += $(NAME)-$(VERSION).tar.bz2

LICENSE = LICENSE

PACKAGES              += OZSWliburcu
SPKG_DESC_OZSWliburcu  = Userspace RCU library (liburcu $(VERSION))
CATALOGNAME_OZSWliburcu = liburcu

CONFIGURE_ARGS  = --prefix=$(prefix)
CONFIGURE_ARGS += --enable-shared
CONFIGURE_ARGS += --disable-static
CONFIGURE_ARGS += --disable-dependency-tracking
CONFIGURE_ARGS += CFLAGS="-D_XOPEN_SOURCE=600 -D__EXTENSIONS__"
CONFIGURE_ARGS += LDFLAGS="-L$(BUILD_PREFIX)/lib -Wl,-R,$(BUILD_PREFIX)/lib -lpthread"

# Fix libtool ECHO="print -r --" (ksh93 builtin, fails under bash)
post-configure:
	@if [ -f $(WORKSRC)/libtool ]; then \
	    find $(WORKSRC) -name "libtool" -type f -exec \
	        gsed -i 's/ECHO="print -r --"/ECHO="printf %s\\n"/g' {} \; ; \
	fi
	@$(MAKECOOKIE)

include gar/category.mk
