1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Merge pull request #647 from jbcrail/fix-osx-stdbuf

Fix OS X build errors for stdbuf.
This commit is contained in:
Alex Lyon 2015-07-09 14:58:07 -07:00
commit 8f6d13df5f
3 changed files with 6 additions and 4 deletions

View file

@ -147,9 +147,11 @@ SYSTEM := $(shell uname)
DYLIB_EXT := DYLIB_EXT :=
ifeq ($(SYSTEM),Linux) ifeq ($(SYSTEM),Linux)
DYLIB_EXT := so DYLIB_EXT := so
DYLIB_FLAGS := -shared
endif endif
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
DYLIB_EXT := dylib DYLIB_EXT := dylib
DYLIB_FLAGS := -dynamiclib
endif endif
# Libaries to install # Libaries to install
@ -311,8 +313,8 @@ $(BUILDDIR)/uutils: $(SRCDIR)/uutils/uutils.rs $(BUILDDIR)/mkuutils $(RLIB_PATHS
$(BUILDDIR)/libstdbuf.$(DYLIB_EXT): $(SRCDIR)/stdbuf/libstdbuf.rs $(SRCDIR)/stdbuf/libstdbuf.c $(SRCDIR)/stdbuf/libstdbuf.h | $(BUILDDIR) $(BUILDDIR)/libstdbuf.$(DYLIB_EXT): $(SRCDIR)/stdbuf/libstdbuf.rs $(SRCDIR)/stdbuf/libstdbuf.c $(SRCDIR)/stdbuf/libstdbuf.h | $(BUILDDIR)
cd $(SRCDIR)/stdbuf && \ cd $(SRCDIR)/stdbuf && \
$(RUSTC) libstdbuf.rs && \ $(RUSTC) libstdbuf.rs && \
$(CC) -c -Wall -Werror -fpic libstdbuf.c -L. -llibstdbuf.a && \ $(CC) -c -Wall -Werror -fPIC libstdbuf.c && \
$(CC) -shared -o libstdbuf.$(DYLIB_EXT) -Wl,--whole-archive liblibstdbuf.a -Wl,--no-whole-archive libstdbuf.o -lpthread && \ $(CC) $(DYLIB_FLAGS) -o libstdbuf.$(DYLIB_EXT) liblibstdbuf.a libstdbuf.o && \
mv *.$(DYLIB_EXT) $(BUILDDIR) && $(RM) *.o && $(RM) *.a mv *.$(DYLIB_EXT) $(BUILDDIR) && $(RM) *.o && $(RM) *.a
$(BUILDDIR)/stdbuf: $(BUILDDIR)/libstdbuf.$(DYLIB_EXT) $(BUILDDIR)/stdbuf: $(BUILDDIR)/libstdbuf.$(DYLIB_EXT)

View file

@ -33,7 +33,7 @@ fn set_buffer(stream: *mut FILE, value: &str) {
(_IOFBF, buff_size as size_t) (_IOFBF, buff_size as size_t)
} }
}; };
let mut res: c_int; let res: c_int;
unsafe { unsafe {
let buffer: *mut c_char = ptr::null_mut(); let buffer: *mut c_char = ptr::null_mut();
assert!(buffer.is_null()); assert!(buffer.is_null());

View file

@ -59,7 +59,7 @@ fn preload_strings() -> (&'static str, &'static str) {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
fn preload_strings() -> (&'static str, &'static str) { fn preload_strings() -> (&'static str, &'static str) {
("DYLD_INSERT_LIBRARIES", ".dylib") ("DYLD_LIBRARY_PATH", ".dylib")
} }
#[cfg(not(any(target_os = "linux", target_os = "macos")))] #[cfg(not(any(target_os = "linux", target_os = "macos")))]