diff --git a/srcpkgs/nocache/patches/musl.patch b/srcpkgs/nocache/patches/musl.patch new file mode 100644 index 0000000000..731181fbb9 --- /dev/null +++ b/srcpkgs/nocache/patches/musl.patch @@ -0,0 +1,141 @@ +diff --git nocache.c nocache.c +index 6f8c60d..fa4abff 100644 +--- nocache.c ++++ nocache.c +@@ -25,31 +25,47 @@ static void store_pageinfo(int fd); + static void free_unclaimed_pages(int fd); + + int open(const char *pathname, int flags, mode_t mode); ++#if defined(__GLIBC__) + int open64(const char *pathname, int flags, mode_t mode); ++#endif + int creat(const char *pathname, int flags, mode_t mode); ++#if defined(__GLIBC__) + int creat64(const char *pathname, int flags, mode_t mode); ++#endif + int openat(int dirfd, const char *pathname, int flags, mode_t mode); ++#if defined(__GLIBC__) + int openat64(int dirfd, const char *pathname, int flags, mode_t mode); ++#endif + int __openat_2(int dirfd, const char *pathname, int flags, mode_t mode) + __attribute__ ((alias ("openat"))); + int dup(int oldfd); + int dup2(int oldfd, int newfd); + int close(int fd); + FILE *fopen(const char *path, const char *mode); ++#if defined(__GLIBC__) + FILE *fopen64(const char *path, const char *mode); ++#endif + int fclose(FILE *fp); + + int (*_original_open)(const char *pathname, int flags, mode_t mode); ++#if defined(__GLIBC__) + int (*_original_open64)(const char *pathname, int flags, mode_t mode); ++#endif + int (*_original_creat)(const char *pathname, int flags, mode_t mode); ++#if defined(__GLIBC__) + int (*_original_creat64)(const char *pathname, int flags, mode_t mode); ++#endif + int (*_original_openat)(int dirfd, const char *pathname, int flags, mode_t mode); ++#if defined(__GLIBC__) + int (*_original_openat64)(int dirfd, const char *pathname, int flags, mode_t mode); ++#endif + int (*_original_dup)(int fd); + int (*_original_dup2)(int newfd, int oldfd); + int (*_original_close)(int fd); + FILE *(*_original_fopen)(const char *path, const char *mode); ++#if defined(__GLIBC__) + FILE *(*_original_fopen64)(const char *path, const char *mode); ++#endif + int (*_original_fclose)(FILE *fp); + + +@@ -82,16 +98,24 @@ static void init(void) + assert(fds != NULL); + + _original_open = (int (*)(const char *, int, mode_t)) dlsym(RTLD_NEXT, "open"); ++#if defined(__GLIBC__) + _original_open64 = (int (*)(const char *, int, mode_t)) dlsym(RTLD_NEXT, "open64"); ++#endif + _original_creat = (int (*)(const char *, int, mode_t)) dlsym(RTLD_NEXT, "creat"); ++#if defined(__GLIBC__) + _original_creat64 = (int (*)(const char *, int, mode_t)) dlsym(RTLD_NEXT, "creat64"); ++#endif + _original_openat = (int (*)(int, const char *, int, mode_t)) dlsym(RTLD_NEXT, "openat"); ++#if defined(__GLIBC__) + _original_openat64 = (int (*)(int, const char *, int, mode_t)) dlsym(RTLD_NEXT, "openat64"); ++#endif + _original_dup = (int (*)(int)) dlsym(RTLD_NEXT, "dup"); + _original_dup2 = (int (*)(int, int)) dlsym(RTLD_NEXT, "dup2"); + _original_close = (int (*)(int)) dlsym(RTLD_NEXT, "close"); + _original_fopen = (FILE *(*)(const char *, const char *)) dlsym(RTLD_NEXT, "fopen"); ++#if defined(__GLIBC__) + _original_fopen64 = (FILE *(*)(const char *, const char *)) dlsym(RTLD_NEXT, "fopen64"); ++#endif + _original_fclose = (int (*)(FILE *)) dlsym(RTLD_NEXT, "fclose"); + + if ((error = dlerror()) != NULL) { +@@ -165,6 +189,7 @@ int open(const char *pathname, int flags, mode_t mode) + return fd; + } + ++#if defined(__GLIBC__) + int open64(const char *pathname, int flags, mode_t mode) + { + int fd; +@@ -177,6 +202,7 @@ int open64(const char *pathname, int flags, mode_t mode) + store_pageinfo(fd); + return fd; + } ++#endif + + int creat(const char *pathname, int flags, mode_t mode) + { +@@ -191,6 +217,7 @@ int creat(const char *pathname, int flags, mode_t mode) + return fd; + } + ++#if defined(__GLIBC__) + int creat64(const char *pathname, int flags, mode_t mode) + { + int fd; +@@ -203,6 +230,7 @@ int creat64(const char *pathname, int flags, mode_t mode) + store_pageinfo(fd); + return fd; + } ++#endif + + int openat(int dirfd, const char *pathname, int flags, mode_t mode) + { +@@ -217,6 +245,7 @@ int openat(int dirfd, const char *pathname, int flags, mode_t mode) + return fd; + } + ++#if defined(__GLIBC__) + int openat64(int dirfd, const char *pathname, int flags, mode_t mode) + { + int fd; +@@ -229,6 +258,7 @@ int openat64(int dirfd, const char *pathname, int flags, mode_t mode) + store_pageinfo(fd); + return fd; + } ++#endif + + int dup(int oldfd) + { +@@ -288,6 +318,7 @@ FILE *fopen(const char *path, const char *mode) + return fp; + } + ++#if defined(__GLIBC__) + FILE *fopen64(const char *path, const char *mode) + { + int fd; +@@ -304,6 +335,7 @@ FILE *fopen64(const char *path, const char *mode) + + return fp; + } ++#endif + + int fclose(FILE *fp) + { diff --git a/srcpkgs/nocache/template b/srcpkgs/nocache/template new file mode 100644 index 0000000000..acc6abb7ed --- /dev/null +++ b/srcpkgs/nocache/template @@ -0,0 +1,23 @@ +# Template file for 'nocache' +pkgname=nocache +version=0.9 +revision=1 +build_style=gnu-makefile +short_desc="Minimize filesystem caching effects" +maintainer="Duncaen " +license="BSD" +homepage="https://github.com/Feh/nocache" +distfiles="https://github.com/Feh/nocache/archive/v${version}.tar.gz" +checksum=a5d790b77dc9e0c8e1241f99a9f31a088d02956a6a4c40dd17ddaa887b2bc33a + +pre_build() { + sed -i -e '/^GCC/d' -e 's/$(GCC)/$(GCC) $(CFLAGS)/g' Makefile + sed -i -e '/#include /d' cachedel.c cachestats.c + sed -i -e 's;/usr/local;/usr;g' nocache.global +} + +do_install() { + vinstall nocache.so 644 usr/lib + vbin nocache.global nocache + vlicense COPYING +}