summaryrefslogtreecommitdiff
path: root/x11/eaglemode/files/patch-makers_unicc_plugins_unicc__gnu.pm
blob: 9c5260d7a10858fd062178eca8fb310fa15b0313 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Note that this plugin is used for both gnu and clang build.

--- makers/unicc/plugins/unicc_gnu.pm.orig	2021-07-11 05:50:52 UTC
+++ makers/unicc/plugins/unicc_gnu.pm
@@ -35,7 +35,7 @@ my $IsWinOrCygwin;
 my $IsDarwin;
 
 {
-	my $s=`gcc -dumpversion`; # Examples: "4.3", "2.95.3"
+	my $s=`$ENV{'CC'} -dumpversion`; # Examples: "4.3", "2.95.3"
 	if ($? != 0) { exit(1); }
 	for (;; $s=substr($s,1)) {
 		if (length($s)==0) { die("Cannot determine GCC version, stopped"); }
@@ -112,9 +112,9 @@ sub Compile
 		push(@args,("-o",GetObjFiles->[$index]));
 	}
 	else {
-		push(@args,"gcc");
+		push(@args,$isCpp ? $ENV{'CXX'} : $ENV{'CC'});
 		if (HaveDebug) { push(@args,"-g"); }
-		push(@args,"-O2");
+		push(@args,grep /./, split(/\s+/, $isCpp ? $ENV{'CXXFLAGS'} : $ENV{'CFLAGS'}));
 		if ($isCpp && $GccVersion>=4.7 && $GccVersion<6.1) {
 			push(@args,"-std=c++11");
 		}
@@ -166,7 +166,8 @@ sub Link
 		push(@args,(@{GetObjFiles()}));
 	}
 	else {
-		push(@args,"gcc");
+		push(@args,HaveCppLib ? $ENV{'CXX'} : $ENV{'CC'});
+		push(@args,grep /./, split(/\s+/, $ENV{'LDFLAGS'}));
 		if (HaveDebug) { push(@args,"-g"); }
 		if ($type eq 'dynlib') {
 			push(@args,$IsDarwin ? "-dynamiclib" : "-shared");
@@ -182,7 +183,6 @@ sub Link
 		foreach my $s (@{GetLinkNames()}) { push(@args,"-l$s"); }
 		if ($IsCygwin && -e "/lib/libcygipc.a") { push(@args,"-lcygipc"); }
 		if (HaveMath) { push(@args,"-lm"); }
-		if (HaveCppLib) { push(@args,"-lstdc++"); }
 		push(@args,"-o");
 		push(@args,GetTgtFile);
 		if ($IsWinOrCygwin and $type eq "dynlib") {