Brucey преди 4 години
родител
ревизия
a59e246c19
променени са 9 файла, в които са добавени 76 реда и са изтрити 17 реда
  1. 9 2
      bmk_config.bmx
  2. 18 0
      bmk_cores_haiku.bmx
  3. 7 0
      bmk_cores_haiku.c
  4. 1 1
      bmk_make.bmx
  5. 8 0
      bmk_modutil.bmx
  6. 2 0
      bmk_ng.bmx
  7. 2 0
      bmk_ng_utils.bmx
  8. 24 11
      bmk_util.bmx
  9. 5 3
      make.bmk

+ 9 - 2
bmk_config.bmx

@@ -121,6 +121,10 @@ opt_arch="arm64"
 opt_arch="arm"
 ?raspberrypi64
 opt_arch="arm64"
+?haikux86
+opt_arch="x86"
+?haikux64
+opt_arch="x64"
 ?
 
 TStringBuffer.initialCapacity = 128
@@ -361,8 +365,8 @@ Function Usage:String(fullUsage:Int = False)
 		s:+ "~t~t~tiOS : x86, x64 (simulator), armv7, arm64~n"
 		s:+ "~t~t~tAndroid : x86, x64, arm, armeabi, armeabiv7a, arm64v8a~n"
 		s:+ "~t~t~tRaspberryPi : arm, arm64~n"
-		s:+ "~t~t~tEmscripten : js~n"
 		s:+ "~t~t~tnx : arm64~n"
+		s:+ "~t~t~thaiku : x86, x64~n"
 		s:+ "~n~n"
 		s:+ "~t-gdb~n"
 		s:+ "~t~tGenerates line mappings suitable for GDB debugging.~n"
@@ -386,7 +390,7 @@ Function Usage:String(fullUsage:Int = False)
 		s:+ "~n~n"
 		s:+ "~t-l <target platfom> | -platform <target platform>~n"
 		s:+ "~t~tCross-compiles to the specific target platform.~n"
-		s:+ "~t~tValid targets are win32, linux, macos, ios, android, raspberrypi and emscripten.~n"
+		s:+ "~t~tValid targets are win32, linux, macos, ios, android, raspberrypi and haiku.~n"
 		s:+ "~t~t(see documentation for full list of requirements)"
 		s:+ "~n~n"
 		s:+ "~t-musl~n"
@@ -482,6 +486,8 @@ Function VersionInfo(gcc:String, cores:Int, xcode:String)
 	s:+ "-android"
 ?raspberrypi
 	s:+ "-raspberrypi"
+?haiku
+	s:+ "haiku"
 ?emscripten
 	s:+ "-emscripten"
 ?
@@ -661,6 +667,7 @@ Function ValidatePlatform(platform:String)
 		Case "raspberrypi"
 		Case "emscripten"
 		Case "nx"
+		Case "haiku"
 		Default
 			' oops
 			CmdError "Not valid platform : '" + platform + "'"

+ 18 - 0
bmk_cores_haiku.bmx

@@ -0,0 +1,18 @@
+SuperStrict
+
+Import "bmk_cores_haiku.c"
+
+Extern
+	Function bmx_get_system_info_cpu_count:Int()
+End Extern
+
+Function GetCoreCount:Int()
+	Global count:Int
+
+	If Not count Then
+		count = bmx_get_system_info_cpu_count()
+	End If
+
+	Return count
+End Function
+

+ 7 - 0
bmk_cores_haiku.c

@@ -0,0 +1,7 @@
+#include <kernel/OS.h>
+
+int bmx_get_system_info_cpu_count() {
+	system_info info;
+	get_system_info(&info);
+	return info.cpu_count;
+}

+ 1 - 1
bmk_make.bmx

@@ -1842,7 +1842,7 @@ Type TArcTask
 			Next
 		End If
 		
-		If processor.Platform() = "linux" Or processor.Platform() = "raspberrypi" Or processor.Platform() = "android" Or processor.Platform() = "emscripten" Or processor.Platform() = "nx"
+		If processor.Platform() = "linux" Or processor.Platform() = "raspberrypi" Or processor.Platform() = "android" Or processor.Platform() = "emscripten" Or processor.Platform() = "nx" Or processor.Platform() = "haiku"
 			For Local t$=EachIn oobjs
 				If Len(cmd)+Len(t)>1000
 				

+ 8 - 0
bmk_modutil.bmx

@@ -679,6 +679,10 @@ Function ValidatePlatformArchitecture()
 			If arch = "arm64" Then
 				valid = True
 			End If
+		Case "haiku"
+			If arch = "x86" Or arch = "x64" Then
+				valid = True
+			End If
 	End Select
 	
 	If Not valid Then
@@ -743,6 +747,10 @@ Function SetCompilerValues()
 	compilerOptions.Add("raspberrypi", processor.Platform() = "raspberrypi")
 	compilerOptions.Add("raspberrypiarm", processor.Platform() = "raspberrypi" And processor.CPU()="arm")
 	compilerOptions.Add("raspberrypiarm64", processor.Platform() = "raspberrypi" And processor.CPU()="arm64")
+
+	compilerOptions.Add("haiku", processor.Platform() = "haiku")
+	compilerOptions.Add("haikux86", processor.Platform() = "haiku" And processor.CPU()="x86")
+	compilerOptions.Add("haikux64", processor.Platform() = "haiku" And processor.CPU()="x64")
 	
 	compilerOptions.Add("emscripten", processor.Platform() = "emscripten")
 	compilerOptions.Add("emscriptenjs", processor.Platform() = "emscripten" And processor.CPU()="js")

+ 2 - 0
bmk_ng.bmx

@@ -335,6 +335,8 @@ Type TBMK
 			Return "win32"
 ?emscripten
 			Return "emscripten"
+?haiku
+			Return "haiku"
 ?
 		Else
 			' the custom target platform

+ 2 - 0
bmk_ng_utils.bmx

@@ -14,6 +14,8 @@ Import "bmk_cores_linux.bmx"
 Import "bmk_cores_macos.bmx"
 ?win32
 Import "bmk_cores_win32.bmx"
+?haiku
+Import "bmk_cores_haiku.bmx"
 ?
 
 Global utils:TMaxUtils = New TMaxUtils

+ 24 - 11
bmk_util.bmx

@@ -447,10 +447,10 @@ Function LinkApp( path$,lnk_files:TList,makelib:Int,opts$ )
 		
 	End If
 	
-	If processor.Platform() = "linux" Or processor.Platform() = "raspberrypi"
+	If processor.Platform() = "linux" Or processor.Platform() = "raspberrypi" Or processor.Platform() = "haiku"
 		sb.Append(processor.Option(processor.BuildName("gpp"), "g++"))
 		'cmd:+" -m32 -s -Os -pthread"
-		If processor.Platform() <> "raspberrypi" Then
+		If processor.Platform() <> "raspberrypi" And processor.Platform() <> "haiku" Then
 			If processor.CPU() = "x86" Or processor.CPU() = "arm" Then
 				sb.Append(" -m32")
 			End If
@@ -461,21 +461,32 @@ Function LinkApp( path$,lnk_files:TList,makelib:Int,opts$ )
 		If opt_static Then
 			sb.Append(" -static")
 		End If
-		If Not opt_nopie Then
+		If processor.Platform() <> "haiku" And Not opt_nopie Then
 			sb.Append(" -no-pie -fpie")
 		End If
 		If opt_gprof Then
 			sb.Append(" -pg")
 		End If
-		sb.Append(" -pthread")
+		
+		If processor.Platform() <> "haiku" Then
+			sb.Append(" -pthread")
+		Else
+			sb.Append(" -lpthread")
+		End If
+		
 		sb.Append(" -o ").Append(CQuote( path ))
 		sb.Append(" ").Append(CQuote( tmpfile ))
-		If processor.CPU() = "x86" Then
-			sb.Append(" -L").Append(processor.Option(processor.BuildName("lib32"), "/usr/lib32"))
+		
+		If processor.Platform() <> "haiku" Then
+			If processor.CPU() = "x86" Then
+				sb.Append(" -L").Append(processor.Option(processor.BuildName("lib32"), "/usr/lib32"))
+			End If
+			sb.Append(" -L").Append(processor.Option(processor.BuildName("x11lib"), "/usr/X11R6/lib"))
+			sb.Append(" -L").Append(processor.Option(processor.BuildName("lib"), "/usr/lib"))
+		Else
+			sb.Append(" -L").Append(CQuote( "/boot/system/develop/lib" ))
+			sb.Append(" -L").Append(CQuote( BlitzMaxPath()+"/lib" ))
 		End If
-		sb.Append(" -L").Append(processor.Option(processor.BuildName("x11lib"), "/usr/X11R6/lib"))
-		sb.Append(" -L").Append(processor.Option(processor.BuildName("lib"), "/usr/lib"))
-		sb.Append(" -L").Append(CQuote( BlitzMaxPath()+"/lib" ))
 	
 		For Local t$=EachIn lnk_files
 			t=CQuote(t)
@@ -1882,7 +1893,7 @@ Function LoadBootstrapConfig:TBootstrapConfig()
 		'Local i:Int
 		For Local assetLine:String = EachIn assets
 			Local parts:String[] = assetLine.Split("~t")
-			If parts Then
+			If parts And parts.length > 1 Then
 				Select parts[0]
 					Case "t"
 						Local target:TBootstrapTarget = New TBootstrapTarget
@@ -1894,7 +1905,9 @@ Function LoadBootstrapConfig:TBootstrapConfig()
 						Local asset:TBootstrapAsset = New TBootstrapAsset
 						asset.assetType = parts[0]
 						asset.name = parts[1]
-						asset.parts = parts[2..]
+						If parts.length > 2 Then
+							asset.parts = parts[2..]
+						End If
 						
 						boot.assets :+ [asset]
 						

+ 5 - 3
make.bmk

@@ -184,7 +184,7 @@
 			cmd = bmk.Option("path_to_gpp", bmk.MinGWBinPath() .. "/g++.exe")
 		end
 		
-	elseif bmk.Platform() == "linux" or bmk.Platform() == "android" or bmk.Platform() == "raspberrypi" then
+	elseif bmk.Platform() == "linux" or bmk.Platform() == "android" or bmk.Platform() == "raspberrypi" or bmk.Platform() == "haiku" then
 		cmd = bmk.Option(bmk.BuildName("gcc"), "gcc")
 		
 		if bmk.Option("nopie", "") == "true" then
@@ -487,13 +487,15 @@
 
 		globals.SetOption("cc_opts", "fastmath", "-ffast-math")
 		
-	elseif bmk.Platform() == "linux" or bmk.Platform() == "android" or bmk.Platform() == "raspberrypi" or bmk.Platform() == "emscripten" then
+	elseif bmk.Platform() == "linux" or bmk.Platform() == "android" or bmk.Platform() == "raspberrypi" or bmk.Platform() == "emscripten" or bmk.Platform() == "haiku" then
 		globals.SetOption("cc_opts", "aliasing", "-fno-strict-aliasing")
 		if bmk.CPU() == "x86" then
 			globals.SetOption("cc_opts", "arch", "-m32")
 			globals.SetOption("cc_opts", "fancymath", "-mfancy-math-387")
 		end
-		globals.SetOption("cc_opts", "pie", "-fpie")
+		if bmk.Platform() ~= "haiku" then
+			globals.SetOption("cc_opts", "pie", "-fpie")
+		end
 	end
 
 	globals.SetOption("cc_opts", "exceptions", "-fno-exceptions")