-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
executable file
·95 lines (75 loc) · 2.61 KB
/
build.py
File metadata and controls
executable file
·95 lines (75 loc) · 2.61 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env python3
# Master Build Script for Integral Philosophy Publishing System
# ========================================================
import os
import sys
import argparse
import subprocess
from pathlib import Path
def run_command(cmd, description=""):
"""Run a command with error handling."""
print(f"🔧 {description}...")
try:
result = subprocess.run(
cmd, shell=True, check=True, capture_output=True, text=True
)
if result.stdout:
print(result.stdout)
return True
except subprocess.CalledProcessError as e:
print(f"❌ Error: {e}")
if e.stderr:
print(f"Error output: {e.stderr}")
return False
def build_with_scons(args):
"""Build using SCons."""
cmd = "cd build-systems/scons && python3 scons-helper"
if args.debug:
cmd += " build --debug"
else:
cmd += " build"
return run_command(cmd, "Building with SCons")
def build_with_cmake(args):
"""Build using CMake."""
run_command("mkdir -p cmake-build", "Creating build directory")
cmd = "cd cmake-build && cmake ../build-systems/cmake/ && make"
return run_command(cmd, "Building with CMake")
def build_with_autotools(args):
"""Build using Autotools."""
cmd = "cd build-systems/autotools && ./bootstrap && ./configure && make"
return run_command(cmd, "Building with Autotools")
def build_with_make(args):
"""Build using traditional Make."""
cmd = "make -C build-systems/make/"
return run_command(cmd, "Building with Make")
def main():
"""Main function."""
parser = argparse.ArgumentParser(
description="Master build script for Integral Philosophy Publishing System",
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument(
"--system",
choices=["scons", "cmake", "autotools", "make"],
default="scons",
help="Build system to use (default: scons)",
)
parser.add_argument("--debug", action="store_true", help="Enable debug build")
args = parser.parse_args()
print("🚀 Integral Philosophy Publishing System - Master Build")
success = False
if args.system == "scons":
success = build_with_scons(args)
elif args.system == "cmake":
success = build_with_cmake(args)
elif args.system == "autotools":
success = build_with_autotools(args)
elif args.system == "make":
success = build_with_make(args)
if success:
print("✅ Build completed successfully!")
else:
print("❌ Build failed!")
sys.exit(1)
if __name__ == "__main__":
main()