From 2fdca9bd0a1333e5f0aa8b88ebc3616ca7c11bb0 Mon Sep 17 00:00:00 2001 From: Jeremy Soller <jeremy@system76.com> Date: Sun, 7 Apr 2019 10:11:05 -0600 Subject: [PATCH] Work around definition of O_NOFOLLOW, and add target for only building and installing headers --- Cargo.lock | 2 ++ Makefile | 10 ++++++++-- include/bits/fcntl.h | 4 ++++ src/header/fcntl/redox.rs | 4 +++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aca68310..229ac549 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "ansi_term" version = "0.11.0" diff --git a/Makefile b/Makefile index e00cde71..2ea04c3a 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ SRC=\ src/*/*/* \ src/*/*/*/* -.PHONY: all clean fmt include install libc libm test +.PHONY: all clean fmt headers install install-headers libc libm test all: | libc libm libpthread @@ -44,13 +44,17 @@ check: fmt: ./fmt.sh -install: all +headers: $(BUILD)/include + +install-headers: headers mkdir -pv "$(DESTDIR)/include" cp -rv "include"/* "$(DESTDIR)/include" cp -rv "$(BUILD)/include"/* "$(DESTDIR)/include" cp -v "openlibm/include"/*.h "$(DESTDIR)/include" cp -v "openlibm/src"/*.h "$(DESTDIR)/include" cp -v "pthreads-emb/"*.h "$(DESTDIR)/include" + +install-libs: all mkdir -pv "$(DESTDIR)/lib" cp -v "$(BUILD)/release/libc.a" "$(DESTDIR)/lib" cp -v "$(BUILD)/release/crt0.o" "$(DESTDIR)/lib" @@ -59,6 +63,8 @@ install: all cp -v "$(BUILD)/openlibm/libopenlibm.a" "$(DESTDIR)/lib/libm.a" cp -v "$(BUILD)/pthreads-emb/libpthread.a" "$(DESTDIR)/lib/libpthread.a" +install: install-headers install-libs + libc: $(BUILD)/release/libc.a $(BUILD)/release/crt0.o $(BUILD)/release/crti.o $(BUILD)/release/crtn.o $(BUILD)/include libm: $(BUILD)/openlibm/libopenlibm.a diff --git a/include/bits/fcntl.h b/include/bits/fcntl.h index 37764477..e0fcf8de 100644 --- a/include/bits/fcntl.h +++ b/include/bits/fcntl.h @@ -1,6 +1,10 @@ #ifndef _BITS_FCNTL_H #define _BITS_FCNTL_H +#if (defined(__redox__)) +#define O_NOFOLLOW 0x80000000 +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/src/header/fcntl/redox.rs b/src/header/fcntl/redox.rs index ddc189ba..7bc92a00 100644 --- a/src/header/fcntl/redox.rs +++ b/src/header/fcntl/redox.rs @@ -17,4 +17,6 @@ pub const O_EXCL: c_int = 0x0800_0000; pub const O_DIRECTORY: c_int = 0x1000_0000; pub const O_PATH: c_int = 0x2000_0000; pub const O_SYMLINK: c_int = 0x4000_0000; -pub const O_NOFOLLOW: c_int = 0x8000_0000; +// Negative to allow it to be used as int +// TODO: Fix negative values missing from includes +pub const O_NOFOLLOW: c_int = -0x8000_0000; -- GitLab