| 1 |
# vim: ft=make ts=4 sw=4 noet |
| 2 |
.DEFAULT_GOAL := all |
| 3 |
|
| 4 |
NAME = libuv |
| 5 |
VERSION = 1.52.1 |
| 6 |
GARTYPE = v2 |
| 7 |
|
| 8 |
DESCRIPTION = Async I/O library |
| 9 |
define BLURB |
| 10 |
libuv is a multi-platform asynchronous I/O library. |
| 11 |
Used by Node.js, BIND 9, and others. On Solaris it uses |
| 12 |
event ports (port_create/port_get) for async I/O. |
| 13 |
endef |
| 14 |
|
| 15 |
MASTER_SITES = https://dist.libuv.org/dist/v$(VERSION)/ |
| 16 |
DISTFILES += $(NAME)-v$(VERSION)-dist.tar.gz |
| 17 |
DISTNAME = $(NAME)-$(VERSION) |
| 18 |
|
| 19 |
LICENSE = LICENSE |
| 20 |
|
| 21 |
# ----------------------------------------------------------------------- |
| 22 |
# OZSWlibuv — shared library + headers |
| 23 |
# ----------------------------------------------------------------------- |
| 24 |
PACKAGES += OZSWlibuv |
| 25 |
SPKG_DESC_OZSWlibuv = Async I/O library (libuv $(VERSION)) |
| 26 |
CATALOGNAME_OZSWlibuv = libuv |
| 27 |
|
| 28 |
# ----------------------------------------------------------------------- |
| 29 |
# Build configuration |
| 30 |
# ----------------------------------------------------------------------- |
| 31 |
|
| 32 |
EXTENSIONS = 1 |
| 33 |
|
| 34 |
CONFIGURE_ARGS = --prefix=$(prefix) |
| 35 |
CONFIGURE_ARGS += --enable-shared |
| 36 |
CONFIGURE_ARGS += --disable-static |
| 37 |
# Solaris: socket/nsl/rt/pthread/sendfile are separate libraries. |
| 38 |
# SUNOS_NO_IFADDRS: libuv 1.52 already has #ifdef SUNOS_NO_IFADDRS stub in |
| 39 |
# sunos.c; defining it disables the getifaddrs path (absent on snv_111b). |
| 40 |
CONFIGURE_ARGS += CFLAGS="-D_XOPEN_SOURCE=600 -D__EXTENSIONS__ -DSUNOS_NO_IFADDRS" |
| 41 |
CONFIGURE_ARGS += LDFLAGS="-L$(BUILD_PREFIX)/lib -Wl,-R,$(BUILD_PREFIX)/lib -lsocket -lnsl -lrt -lpthread -lsendfile" |
| 42 |
|
| 43 |
post-extract: |
| 44 |
@echo "==> Patching src/unix/fs.c: futimens/utimensat absent on OpenSolaris snv_111b" |
| 45 |
@# The 4-space-indented '|| defined(__sun)' lines appear only in the futimens/utimensat |
| 46 |
@# #if chains (uv__fs_to_timespec, uv__fs_futime, uv__fs_utime, uv__fs_lutime). |
| 47 |
@# The fdatasync __sun check on a '#if' line (no indent) is left untouched. |
| 48 |
@gsed -i '/^ || defined(__sun)/d' $(WORKSRC)/src/unix/fs.c |
| 49 |
@# Guard the unconditional futimens() call in uv__fs_copyfile |
| 50 |
@/opt/ozsw/bin/python3 -c "\ |
| 51 |
path='$(WORKSRC)/src/unix/fs.c'; \ |
| 52 |
c=open(path).read(); \ |
| 53 |
old=' if (futimens(dstfd, times) == -1) {\n err = UV__ERR(errno);\n goto out;\n }'; \ |
| 54 |
new='#if !defined(__sun) /* futimens absent on OpenSolaris snv_111b */\n if (futimens(dstfd, times) == -1) {\n err = UV__ERR(errno);\n goto out;\n }\n#endif'; \ |
| 55 |
open(path,'w').write(c.replace(old,new))" |
| 56 |
@echo "==> Patching src/unix/tcp.c: no ifaddrs.h on Solaris; use AIX-style fallback" |
| 57 |
@gsed -i 's/#if !defined(_AIX)/#if !defined(_AIX) \&\& !defined(__sun)/' \ |
| 58 |
$(WORKSRC)/src/unix/tcp.c |
| 59 |
@gsed -i 's/#if defined(_AIX)/#if defined(_AIX) || defined(__sun)/' \ |
| 60 |
$(WORKSRC)/src/unix/tcp.c |
| 61 |
@echo "==> Patching src/unix/thread.c: pthread_setname_np/getname_np absent on OpenSolaris snv_111b" |
| 62 |
@# Setname guard is single-line #if; add __sun to get ENOSYS stub |
| 63 |
@gsed -i 's/^#if defined(_AIX) || defined(__MVS__) || defined(__PASE__)$$/#if defined(_AIX) || defined(__MVS__) || defined(__PASE__) || defined(__sun)/' \ |
| 64 |
$(WORKSRC)/src/unix/thread.c |
| 65 |
@# Getname guard last continuation line (indented, only in getname block); add __sun |
| 66 |
@gsed -i 's/^ defined(__PASE__)$$/ defined(__PASE__) || \\\n defined(__sun)/' \ |
| 67 |
$(WORKSRC)/src/unix/thread.c |
| 68 |
@$(MAKECOOKIE) |
| 69 |
|
| 70 |
# Fix libtool ECHO="print -r --" (ksh93 builtin, fails under bash) |
| 71 |
post-configure: |
| 72 |
@if [ -f $(WORKSRC)/libtool ]; then \ |
| 73 |
find $(WORKSRC) -name "libtool" -type f -exec \ |
| 74 |
gsed -i 's/ECHO="print -r --"/ECHO="printf %s\\n"/g' {} \; ; \ |
| 75 |
fi |
| 76 |
@$(MAKECOOKIE) |
| 77 |
|
| 78 |
include gar/category.mk |