Merge 59dd9c919162402aacf46eeef34d9c4c97bb63be into 049d591d294e2a43cb32b97a0bb018c2093e5beb

This commit is contained in:
Fijxu 2026-09-06 01:41:08 +08:00 committed by GitHub
commit d6352cd2ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 6 deletions

View File

@ -6,6 +6,7 @@ RELEASE := 1
STATIC := 0
NO_DBG_SYMBOLS := 0
SKIP_VERSION_CHECK := 0
FLAGS ?=
@ -27,6 +28,9 @@ ifeq ($(API_ONLY), 1)
FLAGS += -Dapi_only
endif
ifeq ($(SKIP_VERSION_CHECK), 1)
FLAGS += -Dskip_version_check
endif
# -----------------------
# Main
@ -103,11 +107,12 @@ help:
@echo ""
@echo "Build options available for this Makefile:"
@echo ""
@echo " RELEASE Make a release build (Default: 1)"
@echo " STATIC Link libraries statically (Default: 0)"
@echo " RELEASE Make a release build (Default: 1)"
@echo " STATIC Link libraries statically (Default: 0)"
@echo ""
@echo " API_ONLY Build invidious without a GUI (Default: 0)"
@echo " NO_DBG_SYMBOLS Strip debug symbols (Default: 0)"
@echo " API_ONLY Build invidious without a GUI (Default: 0)"
@echo " NO_DBG_SYMBOLS Strip debug symbols (Default: 0)"
@echo " SKIP_VERSION_CHECK Skips the Crystal compiler version check (Default: 0)"

View File

@ -10,7 +10,7 @@ targets:
main: src/invidious.cr
description: |
Invidious is an alternative front-end to YouTube
Invidious is an alternative front-end to YouTube
dependencies:
pg:
@ -40,7 +40,7 @@ development_dependencies:
github: crystal-ameba/ameba
version: ~> 1.6.1
crystal: ">= 1.10.0, < 2.0.0"
crystal: ">= 1.14.1, < 2.0.0"
license: AGPL-3.0-only

View File

@ -50,6 +50,27 @@ require "./invidious/routes/**"
require "./invidious/jobs/base_job"
require "./invidious/jobs/*"
# Show a nice message in case the current Crystal compiler version is unsupoported```
# encouraging the user compiling Invidious to update it```
# version.
{% begin %}
# `-Dskip_version_check` compile-time flag, for development purposes
# or weird installations that lack the `shard.yml` file when compiling
# Invidious.
{% if !flag?(:skip_version_check) %}
{% if file_exists?("#{__DIR__}/../shard.yml") %}
{% shard_yml = read_file("#{__DIR__}/../shard.yml") %}
{% crystal_constraint = shard_yml.split('\n').find(&.starts_with?("crystal:")) %}
{% minimum_version = crystal_constraint.split('"')[1].split(",").first.split(">=").last.strip %}
{% if compare_versions(Crystal::VERSION, minimum_version) < 0 %}
{{ raise "Crystal version #{minimum_version} or newer is required to build Invidious. \
You currently have Crystal version #{Crystal::VERSION} installed. \
We recommend that you install it following the way that the team behind the Crystal compiler itself recommend for your OS, see: https://crystal-lang.org/install/" }}
{% end %}
{% end %}
{% end %}
{% end %}
# Declare the base namespace for invidious
module Invidious
end