Skip to content

Commit b166075

Browse files
authored
Allow to specify custom CRYSTAL_REPO for forks (#273)
1 parent 535aedb commit b166075

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

darwin/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Build everything
44
## $ make
55

6+
CRYSTAL_REPO ?= https://github.com/crystal-lang/crystal ## Allow to override the official repo with fork or local
67
CRYSTAL_VERSION ?= ## How the binaries should be branded
78
CRYSTAL_SHA1 ?= $(CRYSTAL_VERSION) ## Git tag/branch/sha1 to checkout and build source
89
PACKAGE_ITERATION ?= 1
@@ -52,7 +53,7 @@ $(CURDIR)/../omnibus/crystal-darwin-x86_64/embedded/bin/crystal:
5253
$(OUTPUT_DIR)/$(DARWIN_NAME) $(OUTPUT_DIR)/$(DARWIN_PKG_NAME): ## Build omnibus crystal project
5354
ifeq ($(FORCE_GIT_TAGGED), 0)
5455
rm -Rf $(CURDIR)/tmp && mkdir -p $(CURDIR)/tmp && cd $(CURDIR)/tmp \
55-
&& git clone https://github.com/crystal-lang/crystal \
56+
&& git clone "$(CRYSTAL_REPO)" \
5657
&& cd crystal \
5758
&& git checkout $(CRYSTAL_SHA1) \
5859
&& git checkout -b $(CRYSTAL_VERSION)

docs/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ RUN crystal --version
55

66
ARG output_docs_base_name
77
ARG crystal_sha1
8-
RUN git clone https://github.com/crystal-lang/crystal \
8+
ARG crystal_repo=https://github.com/crystal-lang/crystal
9+
RUN git clone "${crystal_repo}" \
910
&& cd crystal \
1011
&& git checkout ${crystal_sha1} \
1112
\

docs/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
CRYSTAL_REPO ?= https://github.com/crystal-lang/crystal ## Allow to override the official repo with fork or local
12
CRYSTAL_VERSION ?= ## How the binaries should be branded
23
CRYSTAL_SHA1 ?= $(CRYSTAL_VERSION) ## Git tag/branch/sha1 to checkout and build source (default: `$(CRYSTAL_VERSION)`)
34
CRYSTAL_DOCKER_IMAGE ?= crystallang/crystal:$(CRYSTAL_VERSION)-build ## Which crystal docker build image to use (default: `$(CRYSTAL_VERSION)-build`)
@@ -9,7 +10,7 @@ AWS_CLI = docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -v $$(pw
910
S3_ENDPOINT = s3://$(AWS_BUCKET)/api
1011
AWS_BUCKET = crystal-api
1112

12-
BUILD_ARGS = --build-arg crystal_docker_image=$(CRYSTAL_DOCKER_IMAGE) --build-arg output_docs_base_name=$(OUTPUT_DOCS_BASE_NAME) --build-arg crystal_sha1=$(CRYSTAL_SHA1)
13+
BUILD_ARGS = --build-arg crystal_docker_image=$(CRYSTAL_DOCKER_IMAGE) --build-arg output_docs_base_name=$(OUTPUT_DOCS_BASE_NAME) --build-arg crystal_repo=$(CRYSTAL_REPO) --build-arg crystal_sha1=$(CRYSTAL_SHA1)
1314

1415
.PHONY: all
1516
all: $(OUTPUT_DIR)/$(OUTPUT_DOCS_BASE_NAME).tar.gz ## Build docs tarball

linux/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ RUN mkdir -p /tmp/crystal \
6060
&& shards --version
6161

6262
# Build crystal
63+
ARG crystal_repo=https://github.com/crystal-lang/crystal
6364
ARG crystal_version
6465
ARG crystal_sha1
6566
ARG gnu_target
66-
RUN git clone https://github.com/crystal-lang/crystal \
67+
RUN git clone ${crystal_repo} \
6768
&& cd crystal \
6869
&& git checkout ${crystal_sha1} \
6970
\

linux/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ no_cache ?= ## Disable the docker build cache
1111
pull_images ?= ## Always pull docker images to ensure they're up to date
1212
release ?= ## Create an optimized build for the final release
1313

14+
CRYSTAL_REPO ?= https://github.com/crystal-lang/crystal ## Allow to override the official repo with fork or local
1415
CRYSTAL_VERSION ?= ## How the binaries should be branded
1516
CRYSTAL_SHA1 ?= $(CRYSTAL_VERSION) ## Git tag/branch/sha1 to checkout and build source
1617
PACKAGE_ITERATION ?= 1
@@ -32,6 +33,7 @@ DOCKER_BUILD_ARGS = $(if $(no_cache),--no-cache )$(if $(pull_images),--pull )
3233

3334
BUILD_ARGS_COMMON = $(DOCKER_BUILD_ARGS) \
3435
$(if $(release),--build-arg release=true) \
36+
--build-arg crystal_repo=$(CRYSTAL_REPO) \
3537
--build-arg crystal_version=$(CRYSTAL_VERSION) \
3638
--build-arg crystal_sha1=$(CRYSTAL_SHA1) \
3739
--build-arg shards_version=$(SHARDS_VERSION) \

0 commit comments

Comments
 (0)