diff --git a/.gitattributes b/.gitattributes index 24ef7a4a4d..2c93844be5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4416,6 +4416,7 @@ tools/install/macosx/makelazsnapshot.sh svneol=native#text/plain tools/install/macosx/uninstall.sh svneol=native#text/plain tools/install/patches/fpc-fixes_2_2.patch svneol=native#text/plain tools/install/patches/readme.txt svneol=native#text/plain +tools/install/patches/windres-2.2.2.patch svneol=native#text/plain tools/install/replace_in_files.pl -text svneol=native#application/x-perl tools/install/rpm/create_gtk1_links.sh svneol=native#text/plain tools/install/rpm/create_nonroot_rpmmacros.sh svneol=native#text/plain diff --git a/tools/install/patches/readme.txt b/tools/install/patches/readme.txt index c069f8ae12..dd8f8ff610 100644 --- a/tools/install/patches/readme.txt +++ b/tools/install/patches/readme.txt @@ -9,3 +9,5 @@ The file fpc-fixes_2_2.patch is a patch for the fixes_2_2 branch Details about this patch can be found at http://wiki.lazarus.freepascal.org/Useful_changes_not_in_the_fixes_branch#Description_of_the_fixes_2_2_patch +The file windres-2.2.2.patch contains a patch for calling windres in the fpc 2.2.2 compiler, so that the compiler can compile projects with .rc files in directories with spaces. Basically this is a backport of r12545. + diff --git a/tools/install/patches/windres-2.2.2.patch b/tools/install/patches/windres-2.2.2.patch new file mode 100644 index 0000000000..535edf5b6f --- /dev/null +++ b/tools/install/patches/windres-2.2.2.patch @@ -0,0 +1,91 @@ +Index: compiler/comprsrc.pas +=================================================================== +--- compiler/comprsrc.pas (revision 12548) ++++ compiler/comprsrc.pas (working copy) +@@ -110,16 +110,31 @@ + else + SelectBin:=Bin2; + end; +- ++ ++ function WindresFileName(filename: TCmdStr): TCmdStr; ++ // to be on the safe side, only give short file names with forward slashes to ++ // windres ++ var ++ i: longint; ++ begin ++ Result := GetShortName(filename); ++ for I:=1 to Length(Result) do ++ if Result[I] in AllowDirectorySeparators then ++ Result[i]:='/'; ++ end; ++ + var + respath, + srcfilepath, + preprocessorbin, + s, + bin, +- resbin : TCmdStr; ++ resbin, ++ fnameparam : TCmdStr; ++ usewindres, + resfound, + objused : boolean; ++ + begin + if output=roRES then + Bin:=SelectBin(RCCompiler,target_res.rcbin) +@@ -128,6 +143,7 @@ + if bin='' then + exit; + resfound:=false; ++ usewindres:= bin='windres'; + if utilsdirectory<>'' then + resfound:=FindFile(utilsprefix+bin+source_info.exeext,utilsdirectory,false,resbin); + if not resfound then +@@ -140,11 +156,15 @@ + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; + end; + srcfilepath:=ExtractFilePath(current_module.mainsource^); ++ if usewindres then ++ fnameparam:=WindresFileName(fname) ++ else ++ fnameparam:=maybequoted(fname); + if output=roRES then + begin + s:=target_res.rccmd; + Replace(s,'$RES',maybequoted(OutName)); +- Replace(s,'$RC',maybequoted(fname)); ++ Replace(s,'$RC',fnameparam); + ObjUsed:=False; + end + else +@@ -152,20 +172,23 @@ + s:=target_res.rescmd; + ObjUsed:=(pos('$OBJ',s)>0); + Replace(s,'$OBJ',maybequoted(OutName)); +- Replace(s,'$RES',maybequoted(fname)); ++ Replace(s,'$RES',fnameparam); + end; + { windres doesn't like empty include paths } + if respath='' then + respath:='.'; +- Replace(s,'$INC',maybequoted(respath)); ++ if usewindres then ++ Replace(s,'$INC',WindresFileName(respath)) ++ else ++ Replace(s,'$INC',maybequoted(respath)); + if (target_res.resbin='windres') then + begin + if (srcfilepath<>'') then +- s:=s+' --include '+maybequoted(srcfilepath); ++ s:=s+' --include '+WindresFileName(srcfilepath); + { try to find a preprocessor } + preprocessorbin := respath+'cpp'+source_info.exeext; + if FileExists(preprocessorbin,true) then +- s:=s+' --preprocessor='+preprocessorbin; ++ s:=s+' --preprocessor='+maybequoted(preprocessorbin); + end; + { Execute the command } + if not (cs_link_nolink in current_settings.globalswitches) then