From 67cf1f1be7fd514a819a11c31352e2bc249ff3e6 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Thu, 9 Apr 2009 18:32:01 +0000 Subject: [PATCH] * Changed a few version(linux) blocks to version(Posix). * Changed some declarations from explicit to auto. * Changed "mkdir --parents" in Makefile to "mkdir -p" since OSX doesn't support the long version. * REMAINING ISSUE: The "ln -sf" for installing the libraries at the end will fail if the DMD installation point is not owned by the user performing the build. A "sudo ln..." fixes this, but it still may not be ideal to have a system-level link to a user-level file. This should probably simply be copied instead. Also, this copy should perhaps be done manually or in an "install" step, since a user may want to build Phobos and test it out without affecting other users. --- Makefile | 8 ++++---- std/mmfile.d | 6 +++--- std/stdio.d | 2 +- std/stream.d | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 3235680bd..1e37673f0 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ DOCDIR = ../web/phobos DOC_OUTPUT_DIR = ../web/phobos DRUNTIMEDIR = ../druntime/lib -PRODUCTIONLIBDIR = $(dir $(shell which dmd))/../lib +PRODUCTIONLIBDIR = $(dir $(shell which dmd))../lib OBJDIR = obj DOCSRC = ../docsrc STDDOC = $(DOCSRC)/std.ddoc @@ -45,7 +45,7 @@ STD_MODULES = $(addprefix std/, algorithm array atomics base64 bigint \ stdio stdiobase stream string syserror system traits typecons \ typetuple uni uri utf variant xml zip zlib) EXTRA_MODULES = $(addprefix std/c/, stdarg stdio) $(addprefix etc/c/, \ -zlib) etc/algorithm etc/random +zlib) EXTRA_MODULES_posix = $(addprefix std/c/linux/, linux socket) EXTRA_MODULES_win32 = $(addprefix std/c/windows/, com stat windows winsock) \ $(addprefix std/windows/, charset iunknown syserror) @@ -92,7 +92,7 @@ SRC2LIB_$1 = $$(addsuffix .d,crc32 $(STD_MODULES) $(EXTRA_MODULES) \ $(EXTRA_MODULES_$1)) $$(OBJDIR)/$1/$2/%$$(OBJSUFFIX_$1) : %.c $$(OBJDIR)/$1/$2/.directory - @mkdir --parents $$(dir $$@) + @mkdir -p $$(dir $$@) $(CC_$1) -c $(CFLAGS_$1_$2) -o$$@ $$< $$(OBJDIR)/$1/$2/unittest/std/% : std/%.d \ @@ -129,7 +129,7 @@ $(LIBDRUNTIME_$1) @$(DMD_$1) $(DFLAGS_$2) -lib -of$$@ $$^ $$(OBJDIR)/$1/$2/.directory : - mkdir --parents $$@ + mkdir -p $$@ $1/$2/unittest : $1/$2 $$(addprefix $$(OBJDIR)/$1/$2/unittest/,$(STD_MODULES)) diff --git a/std/mmfile.d b/std/mmfile.d index 89c1eb996..682a941c0 100644 --- a/std/mmfile.d +++ b/std/mmfile.d @@ -314,7 +314,7 @@ class MmFile errnoEnforce(false); } - else version (linux) + else version (Posix) { auto namez = toStringz(filename); void* p; @@ -445,7 +445,7 @@ class MmFile { FlushViewOfFile(data.ptr, data.length); } - else version (linux) + else version (Posix) { int i; i = msync(cast(void*)data, data.length, MS_SYNC); // sys/mman.h @@ -616,7 +616,7 @@ private: HANDLE hFileMap = null; uint dwDesiredAccess; } - else version (linux) + else version (Posix) { int fd; int prot; diff --git a/std/stdio.d b/std/stdio.d index d8465f110..24a0cf751 100644 --- a/std/stdio.d +++ b/std/stdio.d @@ -864,7 +864,7 @@ $(D Range that locks the file and allows fast writing to it. */ handle); } } - else version (linux) + else version (Posix) { FPUTWC(c, handle); } diff --git a/std/stream.d b/std/stream.d index e778de754..2d0f7c217 100644 --- a/std/stream.d +++ b/std/stream.d @@ -1813,7 +1813,7 @@ class File: Stream { version(Windows) { seekable = GetFileType(hFile) == 1; // FILE_TYPE_DISK } else { - ulong result = lseek(hFile, 0, 0); + auto result = lseek(hFile, 0, 0); seekable = (result != ~0); } } @@ -1982,12 +1982,12 @@ class File: Stream { throw new SeekException("unable to move file pointer"); ulong result = (cast(ulong)hi << 32) + low; } else version (Posix) { - ulong result = lseek(hFile, cast(int)offset, rel); - if (result == 0xFFFFFFFF) + auto result = lseek(hFile, cast(int)offset, rel); + if (result == cast(typeof(result))-1) throw new SeekException("unable to move file pointer"); } readEOF = false; - return result; + return cast(ulong)result; } /***