2021-11-15 23:08:48 +01:00
|
|
|
# -----------------------
|
|
|
|
# Compilation options
|
|
|
|
# -----------------------
|
|
|
|
|
|
|
|
RELEASE := 1
|
|
|
|
STATIC := 0
|
|
|
|
|
|
|
|
NO_DBG_SYMBOLS := 0
|
|
|
|
|
2024-10-09 18:07:04 +02:00
|
|
|
# Enable multi-threading.
|
|
|
|
# Warning: Experimental feature!!
|
|
|
|
# invidious is not stable when MT is enabled.
|
|
|
|
MT := 0
|
|
|
|
|
2021-11-15 23:08:48 +01:00
|
|
|
|
|
|
|
FLAGS ?=
|
|
|
|
|
|
|
|
|
|
|
|
ifeq ($(RELEASE), 1)
|
|
|
|
FLAGS += --release
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(STATIC), 1)
|
|
|
|
FLAGS += --static
|
|
|
|
endif
|
|
|
|
|
2024-10-09 18:07:04 +02:00
|
|
|
ifeq ($(MT), 1)
|
|
|
|
FLAGS += -Dpreview_mt
|
|
|
|
endif
|
|
|
|
|
2021-11-15 23:08:48 +01:00
|
|
|
|
|
|
|
ifeq ($(NO_DBG_SYMBOLS), 1)
|
|
|
|
FLAGS += --no-debug
|
|
|
|
else
|
|
|
|
FLAGS += --debug
|
|
|
|
endif
|
|
|
|
|
2023-06-08 23:45:11 +02:00
|
|
|
ifeq ($(API_ONLY), 1)
|
|
|
|
FLAGS += -Dapi_only
|
|
|
|
endif
|
|
|
|
|
2021-11-15 23:08:48 +01:00
|
|
|
|
|
|
|
# -----------------------
|
|
|
|
# Main
|
|
|
|
# -----------------------
|
|
|
|
|
|
|
|
all: invidious
|
|
|
|
|
|
|
|
get-libs:
|
|
|
|
shards install --production
|
|
|
|
|
|
|
|
# TODO: add support for ARM64 via cross-compilation
|
|
|
|
invidious: get-libs
|
|
|
|
crystal build src/invidious.cr $(FLAGS) --progress --stats --error-trace
|
|
|
|
|
|
|
|
|
|
|
|
run: invidious
|
|
|
|
./invidious
|
|
|
|
|
|
|
|
|
|
|
|
# -----------------------
|
|
|
|
# Development
|
|
|
|
# -----------------------
|
|
|
|
|
|
|
|
|
|
|
|
format:
|
|
|
|
crystal tool format
|
|
|
|
|
|
|
|
test:
|
|
|
|
crystal spec
|
|
|
|
|
|
|
|
verify:
|
2022-02-08 03:05:49 +01:00
|
|
|
crystal build src/invidious.cr -Dskip_videojs_download \
|
2022-02-07 22:45:08 +01:00
|
|
|
--no-codegen --progress --stats --error-trace
|
2021-11-15 23:08:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
# -----------------------
|
|
|
|
# (Un)Install
|
|
|
|
# -----------------------
|
|
|
|
|
|
|
|
# TODO
|
|
|
|
|
|
|
|
|
|
|
|
# -----------------------
|
|
|
|
# Cleaning
|
|
|
|
# -----------------------
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm invidious
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -rf libs
|
2023-07-05 15:13:05 +02:00
|
|
|
rm -rf ~/.cache/{crystal,shards}
|
2021-11-15 23:08:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
# -----------------------
|
|
|
|
# Help page
|
|
|
|
# -----------------------
|
|
|
|
|
|
|
|
help:
|
2022-02-23 00:18:48 +01:00
|
|
|
@echo "Targets available in this Makefile:"
|
|
|
|
@echo ""
|
|
|
|
@echo " get-libs Fetch Crystal libraries"
|
|
|
|
@echo " invidious Build Invidious"
|
|
|
|
@echo " run Launch Invidious"
|
|
|
|
@echo ""
|
|
|
|
@echo " format Run the Crystal formatter"
|
|
|
|
@echo " test Run tests"
|
|
|
|
@echo " verify Just make sure that the code compiles, but without"
|
|
|
|
@echo " generating any binaries. Useful to search for errors"
|
|
|
|
@echo ""
|
|
|
|
@echo " clean Remove build artifacts"
|
|
|
|
@echo " distclean Remove build artifacts and libraries"
|
|
|
|
@echo ""
|
|
|
|
@echo ""
|
|
|
|
@echo "Build options available for this Makefile:"
|
|
|
|
@echo ""
|
2023-06-08 23:45:11 +02:00
|
|
|
@echo " RELEASE Make a release build (Default: 1)"
|
|
|
|
@echo " STATIC Link libraries statically (Default: 0)"
|
2022-02-23 00:18:48 +01:00
|
|
|
@echo ""
|
2023-06-08 23:45:11 +02:00
|
|
|
@echo " API_ONLY Build invidious without a GUI (Default: 0)"
|
|
|
|
@echo " NO_DBG_SYMBOLS Strip debug symbols (Default: 0)"
|
2021-11-15 23:08:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# No targets generates an output named after themselves
|
2021-11-15 23:36:52 +01:00
|
|
|
.PHONY: all get-libs build amd64 run
|
|
|
|
.PHONY: format test verify clean distclean help
|