From 08427206c96b256196ab9021d53a0b4bc4df40c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Luc=20B=C3=A9chennec?= Date: Sat, 2 Dec 2023 11:32:58 +0100 Subject: [PATCH] [GOIL] build scripts for OS X --- goil/makefile-macosx/.gitignore | 3 +++ goil/makefile-macosx/build+debug.py | 28 +++++++++++++++++++++++ goil/makefile-macosx/build+lto.py | 28 +++++++++++++++++++++++ goil/makefile-macosx/build+release.py | 28 +++++++++++++++++++++++ goil/makefile-macosx/build.py | 32 +++++++++++++++++++++++++++ goil/makefile-macosx/clean.py | 28 +++++++++++++++++++++++ goil/makefile-macosx/verbose-build.py | 28 +++++++++++++++++++++++ 7 files changed, 175 insertions(+) create mode 100644 goil/makefile-macosx/.gitignore create mode 100755 goil/makefile-macosx/build+debug.py create mode 100755 goil/makefile-macosx/build+lto.py create mode 100755 goil/makefile-macosx/build+release.py create mode 100755 goil/makefile-macosx/build.py create mode 100755 goil/makefile-macosx/clean.py create mode 100755 goil/makefile-macosx/verbose-build.py diff --git a/goil/makefile-macosx/.gitignore b/goil/makefile-macosx/.gitignore new file mode 100644 index 000000000..707d7cacd --- /dev/null +++ b/goil/makefile-macosx/.gitignore @@ -0,0 +1,3 @@ +arm64 +universal +x86_64 diff --git a/goil/makefile-macosx/build+debug.py b/goil/makefile-macosx/build+debug.py new file mode 100755 index 000000000..219b3f6e3 --- /dev/null +++ b/goil/makefile-macosx/build+debug.py @@ -0,0 +1,28 @@ +#! /usr/bin/python3 +# -*- coding: UTF-8 -*- + +#----------------------------------------------------------------------------------------------------------------------- + +import sys, os, subprocess, atexit + +#----------------------------------------------------------------------------------------------------------------------- + +def cleanup(): + if childProcess.poll () == None : + childProcess.kill () + +#----------------------------------------------------------------------------------------------------------------------- + +#--- Register a function for killing subprocess +atexit.register (cleanup) +#--- Get script absolute path +scriptDir = os.path.dirname (os.path.abspath (sys.argv [0])) +#--- +childProcess = subprocess.Popen (["/usr/bin/python3", "build.py", "debug"], cwd=scriptDir) +#--- Wait for subprocess termination +if childProcess.poll () == None : + childProcess.wait () +if childProcess.returncode != 0 : + sys.exit (childProcess.returncode) + +#----------------------------------------------------------------------------------------------------------------------- diff --git a/goil/makefile-macosx/build+lto.py b/goil/makefile-macosx/build+lto.py new file mode 100755 index 000000000..d247c4823 --- /dev/null +++ b/goil/makefile-macosx/build+lto.py @@ -0,0 +1,28 @@ +#! /usr/bin/python3 +#! /usr/bin/python3 + +#----------------------------------------------------------------------------------------------------------------------- + +import sys, os, subprocess, atexit + +#----------------------------------------------------------------------------------------------------------------------- + +def cleanup(): + if childProcess.poll () == None : + childProcess.kill () + +#----------------------------------------------------------------------------------------------------------------------- + +#--- Register a function for killing subprocess +atexit.register (cleanup) +#--- Get script absolute path +scriptDir = os.path.dirname (os.path.abspath (sys.argv [0])) +#--- +childProcess = subprocess.Popen (["/usr/bin/python3", "build.py", "lto"], cwd=scriptDir) +#--- Wait for subprocess termination +if childProcess.poll () == None : + childProcess.wait () +if childProcess.returncode != 0 : + sys.exit (childProcess.returncode) + +#----------------------------------------------------------------------------------------------------------------------- diff --git a/goil/makefile-macosx/build+release.py b/goil/makefile-macosx/build+release.py new file mode 100755 index 000000000..476373b22 --- /dev/null +++ b/goil/makefile-macosx/build+release.py @@ -0,0 +1,28 @@ +#! /usr/bin/python3 +# -*- coding: UTF-8 -*- + +#----------------------------------------------------------------------------------------------------------------------- + +import sys, os, subprocess, atexit + +#----------------------------------------------------------------------------------------------------------------------- + +def cleanup(): + if childProcess.poll () == None : + childProcess.kill () + +#----------------------------------------------------------------------------------------------------------------------- + +#--- Register a function for killing subprocess +atexit.register (cleanup) +#--- Get script absolute path +scriptDir = os.path.dirname (os.path.abspath (sys.argv [0])) +#--- +childProcess = subprocess.Popen (["/usr/bin/python3", "build.py", "release"], cwd=scriptDir) +#--- Wait for subprocess termination +if childProcess.poll () == None : + childProcess.wait () +if childProcess.returncode != 0 : + sys.exit (childProcess.returncode) + +#----------------------------------------------------------------------------------------------------------------------- diff --git a/goil/makefile-macosx/build.py b/goil/makefile-macosx/build.py new file mode 100755 index 000000000..675763e2c --- /dev/null +++ b/goil/makefile-macosx/build.py @@ -0,0 +1,32 @@ +#! /usr/bin/python3 +# -*- coding: UTF-8 -*- + +#----------------------------------------------------------------------------------------------------------------------- + +import sys, os, json + +#----------------------------------------------------------------------------------------------------------------------- + +#----------------------------------------------------------------- Get script absolute path +scriptDir = os.path.dirname (os.path.abspath (sys.argv [0])) +os.chdir (scriptDir) +#----------------------------------------------------------------- Get goal as first argument +goal = "all" # Default goal +if len (sys.argv) > 1 : + goal = sys.argv [1] +#----------------------------------------------------------------- Get max parallel jobs as second argument +maxParallelJobs = 0 # 0 means use host processor count +if len (sys.argv) > 2 : + maxParallelJobs = int (sys.argv [2]) +#----------------------------------------------------------------- Get json description dictionary +jsonFilePath = os.path.normpath (scriptDir + "/../build/output/file-list.json") +with open (jsonFilePath) as f: + dictionary = json.loads (f.read ()) +LIBPM_DIRECTORY_PATH = dictionary ["LIBPM_DIRECTORY_PATH"] +#----------------------------------------------------------------- Import builder +sys.path.append (os.path.abspath (LIBPM_DIRECTORY_PATH + "/python-makefiles")) +from macosx_gcc_tools import buildForMacOS +#----------------------------------------------------------------- Build +buildForMacOS (dictionary, jsonFilePath, "goil", "build", goal, maxParallelJobs, maxParallelJobs == 1) + +#----------------------------------------------------------------------------------------------------------------------- diff --git a/goil/makefile-macosx/clean.py b/goil/makefile-macosx/clean.py new file mode 100755 index 000000000..7024c0796 --- /dev/null +++ b/goil/makefile-macosx/clean.py @@ -0,0 +1,28 @@ +#! /usr/bin/python3 +# -*- coding: UTF-8 -*- + +#----------------------------------------------------------------------------------------------------------------------- + +import sys, os, subprocess, atexit + +#----------------------------------------------------------------------------------------------------------------------- + +def cleanup(): + if childProcess.poll () == None : + childProcess.kill () + +#----------------------------------------------------------------------------------------------------------------------- + +#--- Register a function for killing subprocess +atexit.register (cleanup) +#--- Get script absolute path +scriptDir = os.path.dirname (os.path.abspath (sys.argv [0])) +#--- +childProcess = subprocess.Popen (["/usr/bin/python3", "build.py", "clean"], cwd=scriptDir) +#--- Wait for subprocess termination +if childProcess.poll () == None : + childProcess.wait () +if childProcess.returncode != 0 : + sys.exit (childProcess.returncode) + +#----------------------------------------------------------------------------------------------------------------------- diff --git a/goil/makefile-macosx/verbose-build.py b/goil/makefile-macosx/verbose-build.py new file mode 100755 index 000000000..646c41c87 --- /dev/null +++ b/goil/makefile-macosx/verbose-build.py @@ -0,0 +1,28 @@ +#! /usr/bin/python3 +# -*- coding: UTF-8 -*- + +#----------------------------------------------------------------------------------------------------------------------- + +import sys, os, subprocess, atexit + +#----------------------------------------------------------------------------------------------------------------------- + +def cleanup(): + if childProcess.poll () == None : + childProcess.kill () + +#----------------------------------------------------------------------------------------------------------------------- + +#--- Register a function for killing subprocess +atexit.register (cleanup) +#--- Get script absolute path +scriptDir = os.path.dirname (os.path.abspath (sys.argv [0])) +#--- +childProcess = subprocess.Popen (["/usr/bin/python3", "build.py", "all", "1"], cwd=scriptDir) +#--- Wait for subprocess termination +if childProcess.poll () == None : + childProcess.wait () +if childProcess.returncode != 0 : + sys.exit (childProcess.returncode) + +#-----------------------------------------------------------------------------------------------------------------------