-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
149 lines (128 loc) · 5.52 KB
/
Makefile
File metadata and controls
149 lines (128 loc) · 5.52 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
.PHONY: help build build-windows build-macos build-linux clean-build clean check-env install-deps show-config
# Color codes for help output
BLUE := \033[36m
RESET := \033[0m
# Detect OS
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
DETECTED_OS = Linux
DETECTED_ARCH = $(shell uname -m)
endif
ifeq ($(UNAME_S),Darwin)
DETECTED_OS = macOS
DETECTED_ARCH = $(shell uname -m)
endif
# Normalize architecture names
ifeq ($(DETECTED_ARCH),aarch64)
DETECTED_ARCH = arm64
endif
ifeq ($(DETECTED_ARCH),x86_64)
DETECTED_ARCH = x86_64
endif
default: help
# ============================================================================
# HELP
# ============================================================================
help tasks: ## Display this help message
@echo "$(BLUE)FrostWire FWPlayer Build System$(RESET)"
@echo ""
@echo "$(BLUE)Detected Environment:$(RESET) $(DETECTED_OS) ($(DETECTED_ARCH))"
@echo ""
@echo "$(BLUE)Available Commands:$(RESET)"
@grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf " $(BLUE)%-25s$(RESET) %s\n", $$1, $$2}'
@echo ""
@echo "$(BLUE)Quick Start:$(RESET)"
@echo " make setup # Install build dependencies"
@echo " make build # Build for current platform"
@echo " make clean # Clean all build artifacts"
@echo ""
# ============================================================================
# CONFIGURATION & CHECKS
# ============================================================================
check-env: ## Check if required build tools are available
@echo "$(BLUE)✓$(RESET) Build environment detected: $(DETECTED_OS) ($(DETECTED_ARCH))"
show-config: ## Show build configuration
@echo "$(BLUE)Build Configuration:$(RESET)"
@echo " Operating System: $(DETECTED_OS)"
@echo " Architecture: $(DETECTED_ARCH)"
@echo " MPlayer Status: $(if $(shell [ -d mplayer-trunk ] && echo yes),$(BLUE)✓$(RESET) Present,$(BLUE)✗$(RESET) Not cloned)"
@echo " FFmpeg Status: $(if $(shell [ -d mplayer-trunk/ffmpeg ] && echo yes),$(BLUE)✓$(RESET) Present,$(BLUE)✗$(RESET) Not cloned)"
# ============================================================================
# PLAYER BUILDS
# ============================================================================
build: check-env ## Build fwplayer for current platform (native)
ifeq ($(DETECTED_OS),Linux)
@echo "$(BLUE)Building fwplayer_linux.$(DETECTED_ARCH)...$(RESET)"
@./build_linux.sh
else ifeq ($(DETECTED_OS),macOS)
@echo "$(BLUE)Building fwplayer_macos.$(DETECTED_ARCH)...$(RESET)"
@./build_macos.sh
else
@echo "$(BLUE)Error:$(RESET) Unsupported platform: $(DETECTED_OS)"
@exit 1
endif
build-windows: check-env ## Build fwplayer.exe for Windows (Docker wrapper)
@echo "$(BLUE)Building fwplayer.exe for Windows x86_64 via Docker...$(RESET)"
@./docker_build_windows.sh
build-macos: check-env ## Build fwplayer_macos for macOS (x86_64 or arm64)
ifeq ($(DETECTED_OS),macOS)
@echo "$(BLUE)Building fwplayer_macos.$(DETECTED_ARCH)...$(RESET)"
@./build_macos.sh
else
@echo "$(BLUE)Error:$(RESET) macOS builds only supported on macOS"
@exit 1
endif
build-linux: check-env ## Build fwplayer_linux for Linux (x86_64 or arm64)
ifeq ($(DETECTED_OS),Linux)
@echo "$(BLUE)Building fwplayer_linux.$(DETECTED_ARCH)...$(RESET)"
@./build_linux.sh
else
@echo "$(BLUE)Error:$(RESET) Linux builds only supported on Linux"
@exit 1
endif
# ============================================================================
# SETUP & INITIALIZATION
# ============================================================================
setup: ## Install system dependencies for building
ifeq ($(DETECTED_OS),Linux)
@echo "$(BLUE)Installing Linux build dependencies for $(DETECTED_ARCH)...$(RESET)"
@if [ "$(DETECTED_ARCH)" = "x86_64" ]; then \
if [ -f ./prepare-x86_64-ubuntu-environment.sh ]; then ./prepare-x86_64-ubuntu-environment.sh; fi; \
elif [ "$(DETECTED_ARCH)" = "arm64" ]; then \
if [ -f ./prepare-arm64-ubuntu-environment.sh ]; then ./prepare-arm64-ubuntu-environment.sh; fi; \
else \
echo "$(BLUE)Error:$(RESET) No setup script available for Linux $(DETECTED_ARCH)"; \
exit 1; \
fi
else ifeq ($(DETECTED_OS),macOS)
@echo "$(BLUE)Installing macOS build dependencies...$(RESET)"
@if [ -f ./prepare-macos-environment.sh ]; then ./prepare-macos-environment.sh; fi
else
@echo "$(BLUE)Error:$(RESET) Unsupported platform: $(DETECTED_OS)"
@exit 1
endif
# ============================================================================
# CLEANING
# ============================================================================
clean: ## Clean MPlayer and FFmpeg build artifacts
@echo "$(BLUE)Cleaning build artifacts...$(RESET)"
@bash -c 'source build-functions.sh && clean_build_artifacts'
@echo "$(BLUE)✓$(RESET) Build artifacts cleaned"
@echo "$(BLUE)✓$(RESET) Clean complete"
# ============================================================================
# INFORMATION & TROUBLESHOOTING
# ============================================================================
info: ## Show build information and status
@echo "$(BLUE)FrostWire JMPlayer Build Information$(RESET)"
@echo ""
@make show-config
@echo ""
@echo "$(BLUE)Quick Commands:$(RESET)"
@echo " Setup: make setup # First time setup"
@echo " Build: make build # Build for current platform"
@echo " Clean: make clean # Clean build artifacts"
@echo ""
version: ## Show script versions
@echo "$(BLUE)Component Versions:$(RESET)"
@echo " MPlayer: 1.5"
@echo " FFmpeg: Git latest"