From c8492e8777ad04f9d8eb6a1cfea558718969372e Mon Sep 17 00:00:00 2001 From: jonas Date: Sun, 30 Sep 2018 16:53:14 +0000 Subject: --- Merging r39844 into '.': U utils/fpcmkcfg/fpcmkcfg.pp C utils/fpcmkcfg/fpccfg.inc U utils/fpcmkcfg/fpc.cft --- Recording mergeinfo for merge of r39844 into '.': U . git-svn-id: https://svn.freepascal.org/svn/fpc/branches/fixes_3_0@39845 3ad0048d-3df7-0310-abae-a5850022a9f2 --- utils/fpcmkcfg/fpc.cft | 8 +-- utils/fpcmkcfg/fpccfg.inc | 142 ++++++++++++++++++++++----------------------- utils/fpcmkcfg/fpcmkcfg.pp | 36 +++++++++++- 3 files changed, 108 insertions(+), 78 deletions(-) diff --git a/utils/fpcmkcfg/fpc.cft b/utils/fpcmkcfg/fpc.cft index 58c8a22155..19b9559a10 100644 --- a/utils/fpcmkcfg/fpc.cft +++ b/utils/fpcmkcfg/fpc.cft @@ -38,8 +38,6 @@ #ifdef darwin # use pipes instead of temporary files for assembling -ap -# path to Xcode 4.3+ utilities (no problem if it doesn't exist) --FD/Applications/Xcode.app/Contents/Developer/usr/bin #endif # ---------------- @@ -169,6 +167,9 @@ # searchpath for fppkg user-specific packages -Fu%localbasepath%/units/$FPCTARGET/* +# searchpath for tools +-FD%basepath%/bin/$FPCTARGET + # path to the gcclib %gcclibpath% @@ -177,9 +178,6 @@ #-Fl/lib;/usr/lib -Fl%basepath%/lib/$FPCTARGET -# searchpath for tools --FD%basepath%/bin/$FPCTARGET - %NEEDCROSSBINUTILSIFDEF% # never need cross-prefix when targeting the JVM diff --git a/utils/fpcmkcfg/fpccfg.inc b/utils/fpcmkcfg/fpccfg.inc index 4a5043f5d6..a790085673 100644 --- a/utils/fpcmkcfg/fpccfg.inc +++ b/utils/fpcmkcfg/fpccfg.inc @@ -45,77 +45,76 @@ const DefaultConfig : array[0..30,1..240] of char=( '#ifdef darwin'#010+ '# use pipes instead of temporary files for assembling'#010+ '-ap'#010+ - '# path to Xcode 4.3+ utilities (no problem if it doesn'#039't exist)'#010+ - '-FD/Applications/Xcode.app/Contents/Developer/usr/bin'#010+ '#endif'#010+ #010+ - '# ----------------',#010+ + '# ----------------'#010+ '# Parsing switches'#010+ '# ----------------'#010+ #010+ '# Pascal language mode'#010+ '# -Mfpc free pascal dialect (default)'#010+ - '# -Mobjfpc switch some Delphi 2 extensions on'#010+ + '# ','-Mobjfpc switch some Delphi 2 extensions on'#010+ '# -Mdelphi tries to be Delphi compatible'#010+ - '# -Mtp tries to b','e TP/BP 7.0 compatible'#010+ + '# -Mtp tries to be TP/BP 7.0 compatible'#010+ '# -Mgpc tries to be gpc compatible'#010+ - '# -Mmacpas tries to be compatible to the macintosh pascal diale'+ - 'cts'#010+ + '# -Mmacpas tries to be compatible to the ma','cintosh pascal dia'+ + 'lects'#010+ '#'#010+ '# Turn on Object Pascal extensions by default'#010+ '#-Mobjfpc'#010+ #010+ '# Assembler reader mode'#010+ - '# -Rdefaul','t use default assembler'#010+ + '# -Rdefault use default assembler'#010+ '# -Ratt read AT&T style assembler'#010+ '# -Rintel read Intel style assembler'#010+ '#'#010+ - '# All assembler blocks are AT&T styled by default'#010+ + '# ','All assembler blocks are AT&T styled by default'#010+ '#-Ratt'#010+ #010+ '# Semantic checking'#010+ '# -S2 same as -Mobjfpc'#010+ - '# -Sc ',' supports operators like C (*=,+=,/= and -=)'#010+ + '# -Sc supports operators like C (*=,+=,/= and -=)'#010+ '# -Sa include assertion code.'#010+ - '# -Sd same as -Mdelphi'#010+ + '# -Sd same as',' -Mdelphi'#010+ '# -Se error options. is a combination of the following'+ ':'#010+ - '# : compiler stops after ',' errors (default is 1)'#010+ + '# : compiler stops after errors (default is 1)'#010+ '# w : compiler stops also after warnings'#010+ - '# n : compiler stops also after notes'#010+ + '# n : compiler stops also after no','tes'#010+ '# h : compiler stops also after hints'#010+ '# -Sg allow LABEL and GOTO'#010+ - '# -Sh Use ansistrin','gs'#010+ + '# -Sh Use ansistrings'#010+ '# -Si support C++ styled INLINE'#010+ '# -Sk load fpcylix unit'#010+ - '# -SI set interface style to '#010+ + '# -SI set interface sty','le to '#010+ '# -SIcom COM compatible interface (default)'#010+ '# -SIcorba CORBA compatible interface'#010+ - '# -Sm',' support macros like C (global)'#010+ + '# -Sm support macros like C (global)'#010+ '# -So same as -Mtp'#010+ '# -Sp same as -Mgpc'#010+ - '# -Ss constructor name must be init (destructor must be do'+ - 'ne)'#010+ - '# -Sx enable exception keywords (default in Delphi/O','bjFP'+ - 'C modes)'#010+ + '# -Ss ',' constructor name must be init (destructor must be '+ + 'done)'#010+ + '# -Sx enable exception keywords (default in Delphi/ObjFPC '+ + 'modes)'#010+ '#'#010+ '# Allow goto, inline, C-operators, C-vars'#010+ '-Sgic'#010+ #010+ '# ---------------'#010+ '# Code generation'#010+ - '# ---------------'#010+ + '# ---------------'#010, #010+ '# Uncomment the next line if you always want static/dynamic units by d'+ 'efault'#010+ - '# (can be overruled with -CD, -CS at the com','mandline)'#010+ + '# (can be overruled with -CD, -CS at the commandline)'#010+ '#-CS'#010+ '#-CD'#010+ #010+ '# Set the default heapsize to 8Mb'#010+ '#-Ch8000000'#010+ #010+ - '# Set default codegeneration checks (iocheck, overflow, range, stack)'#010+ + '# Set default codegeneration checks (iocheck, over','flow, range, stack'+ + ')'#010+ '#-Ci'#010+ '#-Co'#010+ '#-Cr'#010+ @@ -123,18 +122,18 @@ const DefaultConfig : array[0..30,1..240] of char=( #010+ '# Optimizer switches'#010+ '# -Os generate smaller code'#010+ - '# -Oa=N set alignmen','t to N'#010+ + '# -Oa=N set alignment to N'#010+ '# -O1 level 1 optimizations (quick optimizations, debuggable)'#010+ - '# -O2 level 2 optimizations (-O1 + optimizations which make deb'+ - 'ugging more difficult)'#010+ + '# -O2 level 2 optimizations (-O1 + ','optimizations which make d'+ + 'ebugging more difficult)'#010+ '# -O3 level 3 optimizations (-O2 + optimizations which also may'+ - ' ','make the program slower rather than faster)'#010+ + ' make the program slower rather than faster)'#010+ '# -Oo switch on optimalization x. See fpc -i for possible value'+ 's'#010+ - '# -OoNO switch off optimalization x. See fpc -i for possible valu'+ - 'es'#010+ - '# -Op set target cpu for optimizing, see fpc',' -i for possible '+ - 'values'#010+ + '# ','-OoNO switch off optimalization x. See fpc -i for possible va'+ + 'lues'#010+ + '# -Op set target cpu for optimizing, see fpc -i for possible va'+ + 'lues'#010+ #010+ '#ifdef darwin'#010+ '#ifdef cpui386'#010+ @@ -143,68 +142,68 @@ const DefaultConfig : array[0..30,1..240] of char=( '#endif'#010+ '#endif'#010+ #010+ - '# -----------------------'#010+ + '# -----------------------',#010+ '# Set Filenames and Paths'#010+ '# -----------------------'#010+ #010+ '# Both slashes and backslashes are allowed in paths'#010+ #010+ - '# path to the m','essagefile, not necessary anymore but can be used to '+ - 'override'#010+ + '# path to the messagefile, not necessary anymore but can be used to ov'+ + 'erride'#010+ '# the default language'#010+ '#-Fr%basepath%/msg/errore.msg'#010+ - '#-Fr%basepath%/msg/errorn.msg'#010+ + '#-F','r%basepath%/msg/errorn.msg'#010+ '#-Fr%basepath%/msg/errores.msg'#010+ '#-Fr%basepath%/msg/errord.msg'#010+ '#-Fr%basepath%/msg/errorr.msg'#010+ #010+ - '# s','earch path for unicode binary files (FPC 2.x does not know this s'+ - 'witch)'#010+ + '# search path for unicode binary files (FPC 2.x does not know this swi'+ + 'tch)'#010+ '#ifndef VER2'#010+ '-FM%sharepath%/unicode/'#010+ '#endif'#010+ #010+ - '# searchpath for units and other system dependent things'#010+ + '#',' searchpath for units and other system dependent things'#010+ '-Fu%basepath%/units/$fpctarget'#010+ '-Fu%basepath%/units/$fpctarget/*'#010+ - '-F','u%basepath%/units/$fpctarget/rtl'#010+ + '-Fu%basepath%/units/$fpctarget/rtl'#010+ #010+ '#ifdef cpui8086'#010+ '-Fu%basepath%/units/$fpctarget/$fpcsubarch-$fpcmemorymodel'#010+ - '-Fu%basepath%/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/*'#010+ + '-Fu%basep','ath%/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/*'#010+ '-Fu%basepath%/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/rtl'#010+ - '#endif'#010, + '#endif'#010+ #010+ '#IFDEF FPCAPACHE_1_3'#010+ '-Fu%basepath%/units/$fpctarget/httpd13/'#010+ '#ELSE'#010+ '#IFDEF FPCAPACHE_2_0'#010+ - '-Fu%basepath%/units/$fpctarget/httpd20'#010+ + '-Fu%basepath%/units/$fpctarge','t/httpd20'#010+ '#ELSE'#010+ '-Fu%basepath%/units/$fpctarget/httpd22'#010+ '#ENDIF'#010+ '#ENDIF'#010+ #010+ '# searchpath for fppkg user-specific packages'#010+ - '-Fu%lo','calbasepath%/units/$FPCTARGET/*'#010+ + '-Fu%localbasepath%/units/$FPCTARGET/*'#010+ + #010+ + '# searchpath for tools'#010+ + '-FD%basepath%/bin/$FPCTARGET'#010+ #010+ '# path to the gcclib'#010+ - '%gcclibpath%'#010+ + '%gcclibpath','%'#010+ #010+ '# searchpath for libraries'#010+ '#-Fl%basepath%/lib'#010+ '#-Fl/lib;/usr/lib'#010+ '-Fl%basepath%/lib/$FPCTARGET'#010+ #010+ - '# searchpath for tools'#010+ - '-FD%basepath%/bin/$FPCTARGET'#010+ - #010+ - '%NEEDCROSSBINUTILSIFDEF%'#010, + '%NEEDCROSSBINUTILSIFDEF%'#010+ #010+ '# never need cross-prefix when targeting the JVM'#010+ '# (no native compiler, always cross-compiling)'#010+ '#ifdef cpujvm'#010+ - '#undef NEEDCROSSBINUTILS'#010+ + '#undef ','NEEDCROSSBINUTILS'#010+ '#endif'#010+ #010+ '# for android cross-prefix is set by compiler'#010+ @@ -212,21 +211,21 @@ const DefaultConfig : array[0..30,1..240] of char=( '#undef NEEDCROSSBINUTILS'#010+ '#endif'#010+ #010+ - '# ','never need cross-prefix when targeting the i8086'#010+ + '# never need cross-prefix when targeting the i8086'#010+ '# (no native compiler, always cross-compiling)'#010+ '#ifdef cpui8086'#010+ - '#undef NEEDCROSSBINUTILS'#010+ + '#undef',' NEEDCROSSBINUTILS'#010+ '#endif'#010+ #010+ '# never need cross-prefix when targeting the i8086'#010+ - '# (no native compiler, always cross-compilin','g)'#010+ + '# (no native compiler, always cross-compiling)'#010+ '#ifdef cpujvm'#010+ '#undef NEEDCROSSBINUTILS'#010+ '#endif'#010+ #010+ '# binutils prefix for cross compiling'#010+ '#IFDEF FPC_CROSSCOMPILING'#010+ - '#IFDEF NEEDCROSSBINUTILS'#010+ + '#IFD','EF NEEDCROSSBINUTILS'#010+ ' -XP$FPCTARGET-'#010+ '#ENDIF'#010+ '#ENDIF'#010+ @@ -236,29 +235,28 @@ const DefaultConfig : array[0..30,1..240] of char=( '# Linking'#010+ '# -------------'#010+ #010+ - '# generate always debuggi','ng information for GDB (slows down the comp'+ - 'iling'#010+ + '# generate always debugging information for GDB (slows down the compil'+ + 'ing'#010+ '# process)'#010+ '# -gc generate checks for pointers'#010+ - '# -gd use dbx'#010+ + '# -gd ',' use dbx'#010+ '# -gg use gsym'#010+ '# -gh use heap trace unit (for memory leak debugging)'#010+ - '# -gl ',' use line info unit to show more info for backtrace'+ - 's'#010+ + '# -gl use line info unit to show more info for backtraces'#010+ '# -gv generates programs tracable with valgrind'#010+ - '# -gw generate dwarf debugging info'#010+ + '# ',' -gw generate dwarf debugging info'#010+ '#'#010+ '# Enable debuginfo and use the line info unit by default'#010+ '#-gl'#010+ #010+ - '# always pa','ss an option to the linker'#010+ + '# always pass an option to the linker'#010+ '#-k-s'#010+ #010+ '# Always strip debuginfo from the executable'#010+ '-Xs'#010+ #010+ - '# Always use smartlinking on i8086, because the system unit exceeds th'+ - 'e 64kb'#010+ + '# Always use smartlinking on i8086',', because the system unit exceeds '+ + 'the 64kb'#010+ '# code limit'#010+ '#ifdef cpui8086'#010+ '-CX'#010+ @@ -268,30 +266,30 @@ const DefaultConfig : array[0..30,1..240] of char=( #010+ '# -------------'#010+ '# Miscellaneous'#010+ - '#',' -------------'#010+ + '# -------------'#010+ #010+ '# Write always a nice FPC logo ;)'#010+ '-l'#010+ #010+ '# Verbosity'#010+ - '# e : Show errors (default) d : Show debug info'#010+ + '# e : Show errors (default) d : Show debu','g info'#010+ '# w : Show warnings u : Show unit info'#010+ - '# n : Show notes t : Show tried/use','d files'#010+ + '# n : Show notes t : Show tried/used files'#010+ '# h : Show hints s : Show time stamps'#010+ - '# i : Show general info q : Show message numbers'#010+ + '# i : Show general info q : Show me','ssage numbers'#010+ '# l : Show linenumbers c : Show conditionals'#010+ - '# a : Show everything 0 : Show',' nothing (except erro'+ - 'rs)'#010+ + '# a : Show everything 0 : Show nothing (except errors'+ + ')'#010+ '# b : Write file names messages r : Rhide/GCC compatibility mod'+ 'e'#010+ - '# with full path x : Executable info (Win32 only'+ - ')'#010+ + '# with full ','path x : Executable info (Win32 on'+ + 'ly)'#010+ '# v : write fpcdebug.txt with p : Write tree.log with parse t'+ - 'r','ee'#010+ + 'ree'#010+ '# lots of debugging info'#010+ '#'#010+ '# Display Info, Warnings and Notes'#010+ '-viwn'#010+ - '# If you don'#039't want so much verbosity use'#010+ + '# If you don'#039't want so much verbosity ','use'#010+ '#-vw'#010 ); diff --git a/utils/fpcmkcfg/fpcmkcfg.pp b/utils/fpcmkcfg/fpcmkcfg.pp index 1bd671dd6a..1c1fdc810b 100644 --- a/utils/fpcmkcfg/fpcmkcfg.pp +++ b/utils/fpcmkcfg/fpcmkcfg.pp @@ -215,7 +215,41 @@ begin AddConditionalLinkerPath('cpux86_64', x86_64, result); AddConditionalLinkerPath('cpupowerpc', powerpc, result); AddConditionalLinkerPath('cpupowerpc64', powerpc64, result); - end + { macOS 10.14 or later: + 1) command line tools are installed under /Library/Developer/CommandLineTools + 2) the system libraries still contain i386 code, but the 10.14 sdk doesn't + (-> only use the 10.14 sdk when targeting x86_64 or unknown architectures ) + 3) crt1.o is no longer installed under /usr -> add its directory explicitly via + -Fl + + We can't detect the macOS version inside fpc.cfg, unfortunately, so we can only + insert this while generating the configuration file. + + This will stop working when macOS 10.15 is released without i386 support, but then + users will be responsible for supplying their own i386 SDK anyway. + } + if DirectoryExists('/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk') then + begin + result:=result + LineEnding + + '-FD/Library/Developer/CommandLineTools/usr/bin' + LineEnding + + '#ifdef cpui386' + LineEnding + + '-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib' + LineEnding + + '#endif' + LineEnding + + '#ifndef cpui386' + LineEnding + + '#ifndef cpupowerpc' + LineEnding + + '#ifndef cpupowerpc64' + LineEnding + + '-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' + LineEnding + + '#endif' + LineEnding + + '#endif' + LineEnding + + '#endif'; + end + else + begin + { add Xcode.app binutils to search path} + result:=result + LineEnding + + '-FD/Applications/Xcode.app/Contents/Developer/usr/bin'; + end; + end; end; {case} end; -- cgit v1.2.1