提交 e9906ea2 编写于 作者: O ohair

6611629: Avoid hardcoded cygwin paths for memory detection

Summary: Use free with sygwin, mem or systeminfo otherwise, to get MB_OF_MEMORY on windows.
Reviewed-by: tbell
上级 13b39503
...@@ -270,7 +270,7 @@ ifeq ($(SYSTEM_UNAME), Linux) ...@@ -270,7 +270,7 @@ ifeq ($(SYSTEM_UNAME), Linux)
REQUIRED_ALSA_VERSION = ^((0[.]9[.][1-9])|(1[.]0[.][0-9]))[0-9]* REQUIRED_ALSA_VERSION = ^((0[.]9[.][1-9])|(1[.]0[.][0-9]))[0-9]*
endif endif
# How much RAM does this machine have: # How much RAM does this machine have:
MB_OF_MEMORY := $(shell free -m | fgrep Mem: | sed -e 's@\ \ *@ @g' | cut -d' ' -f2) MB_OF_MEMORY := $(shell free -m | fgrep Mem: | awk '{print $$2;}' )
endif endif
# Windows with and without CYGWIN will be slightly different # Windows with and without CYGWIN will be slightly different
...@@ -374,45 +374,35 @@ ifeq ($(PLATFORM), windows) ...@@ -374,45 +374,35 @@ ifeq ($(PLATFORM), windows)
REQUIRED_DXSDK_VER = 0x0700 REQUIRED_DXSDK_VER = 0x0700
OS_VENDOR = Microsoft OS_VENDOR = Microsoft
# How much RAM does this machine have: # How much RAM does this machine have:
MB_OF_MEMORY := $(shell \ ifeq ($(USING_CYGWIN),true)
if [ -f "C:/cygwin/bin/free.exe" ] ; then \ # CYGWIN has the 'free' utility
( C:/cygwin/bin/bash.exe -c "C:/cygwin/bin/free.exe -m" ) | \ _MB_OF_MEMORY := \
grep Mem: | \ $(shell free -m | grep Mem: | awk '{print $$2;}' )
sed -e 's@\ \ *@ @g' | cut -d' ' -f2 ; \ else
else \ # Windows 2000 has the mem utility, but two memory areas
echo "512"; \ # extended memory is what is beyond 1024M
fi) _B_OF_EXT_MEMORY := \
endif $(shell mem 2> $(DEV_NULL) | grep 'total contiguous extended memory' | awk '{print $$1;}')
ifeq ($(_B_OF_EXT_MEMORY),)
# Machines with 512Mb or less of real memory are considered low memory _B_OF_MEMORY := \
# build machines and adjustments will be made to prevent excessing $(shell mem 2> $(DEV_NULL) | grep 'total conventional memory' | awk '{print $$1;}')
# system swapping during the build. else
# If we don't know, assume 512. Subtract 128 from MB for VM MAX. _B_OF_MEMORY := \
# Don't set VM max over 1024-128=896. $(shell expr 1048576 '+' $(_B_OF_EXT_MEMORY) 2> $(DEV_NULL))
ifneq ($(MB_OF_MEMORY),) endif
LOW_MEMORY_MACHINE := $(shell \ ifeq ($(_B_OF_MEMORY),)
if [ $(MB_OF_MEMORY) -le 512 ] ; then \ # Windows 2003 has the systeminfo utility use it if mem doesn't work
echo "true"; \ _MB_OF_MEMORY := \
else \ $(shell systeminfo 2> $(DEV_NULL) | grep 'Total Physical Memory:' | awk '{print $$4;}' | sed -e 's@,@@')
echo "false"; \ else
fi) _MB_OF_MEMORY := $(shell expr $(_B_OF_MEMORY) '/' 1024 2> $(DEV_NULL))
MAX_VM_MEMORY := $(shell \ endif
if [ $(MB_OF_MEMORY) -le 1024 ] ; then \ endif
expr $(MB_OF_MEMORY) '-' 128 ; \ ifeq ($(shell expr $(_MB_OF_MEMORY) '+' 0 2> $(DEV_NULL)), $(_MB_OF_MEMORY))
else \ MB_OF_MEMORY := $(_MB_OF_MEMORY)
echo "896"; \ else
fi) MB_OF_MEMORY := 512
MIN_VM_MEMORY := $(shell \ endif
if [ $(MAX_VM_MEMORY) -le 128 ] ; then \
expr $(MAX_VM_MEMORY) '-' 8 ; \
else \
echo "128"; \
fi)
else
MB_OF_MEMORY := unknown
LOW_MEMORY_MACHINE := true
MAX_VM_MEMORY := 384
MIN_VM_MEMORY := 128
endif endif
REQUIRED_ZIP_VER = 2.2 REQUIRED_ZIP_VER = 2.2
...@@ -452,6 +442,37 @@ ifneq ($(PLATFORM), windows) ...@@ -452,6 +442,37 @@ ifneq ($(PLATFORM), windows)
ARCH_VM_SUBDIR=jre/lib/$(LIBARCH) ARCH_VM_SUBDIR=jre/lib/$(LIBARCH)
endif endif
# Machines with 512Mb or less of real memory are considered low memory
# build machines and adjustments will be made to prevent excessing
# system swapping during the build.
# If we don't know, assume 512. Subtract 128 from MB for VM MAX.
# Don't set VM max over 1024-128=896.
ifneq ($(MB_OF_MEMORY),)
LOW_MEMORY_MACHINE := $(shell \
if [ $(MB_OF_MEMORY) -le 512 ] ; then \
echo "true"; \
else \
echo "false"; \
fi)
MAX_VM_MEMORY := $(shell \
if [ $(MB_OF_MEMORY) -le 1024 ] ; then \
expr $(MB_OF_MEMORY) '-' 128 2> $(DEV_NULL) ; \
else \
echo "896"; \
fi)
MIN_VM_MEMORY := $(shell \
if [ $(MAX_VM_MEMORY) -le 128 ] ; then \
expr $(MAX_VM_MEMORY) '-' 8 2> $(DEV_NULL) ; \
else \
echo "128"; \
fi)
else
MB_OF_MEMORY := unknown
LOW_MEMORY_MACHINE := true
MAX_VM_MEMORY := 384
MIN_VM_MEMORY := 128
endif
# If blanks in the username, use the first 4 words and pack them together # If blanks in the username, use the first 4 words and pack them together
_USER1:=$(subst ', ,$(_USER)) _USER1:=$(subst ', ,$(_USER))
_USER2:=$(subst ", ,$(_USER1)) _USER2:=$(subst ", ,$(_USER1))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册