Skip to content

Commit

Permalink
Only download tzdata to avoid lzip; clean Makefile
Browse files Browse the repository at this point in the history
This caches the zic.c source code (it's public domain) and switches to
download the tzdata archive from IANA. This is done solely to avoid lzip
which people don't seem to have installed on their machines or on CI.

I also renamed and cleaned up quite a bit of tzdb.mk to be consistent
with tzdata and tzcode references.
  • Loading branch information
fhunleth committed Mar 11, 2021
1 parent 91efe67 commit 279252e
Show file tree
Hide file tree
Showing 12 changed files with 5,155 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ install_system_deps: &install_system_deps
run:
name: Install system dependencies
command: |
apk add build-base lzip
apk add build-base
jobs:
build_elixir_1_11_otp_23:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ nerves_time_zones-*.tar
# Temporary files for e.g. tests
/tmp

/tzdb-*.tar.lz
/tzdata*.tar.gz
/tzcode/version.h
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ OBJ = $(SRC:c_src/%.c=$(BUILD)/%.o)
calling_from_make:
mix compile

all: install tzdb
all: install tzdata

install: $(PREFIX) $(BUILD) $(NIF)

tzdb:
$(MAKE) -f tzdb.mk all
tzdata:
$(MAKE) -f tzdata.mk all

$(OBJ): $(HEADERS) Makefile

Expand All @@ -64,4 +64,4 @@ $(PREFIX) $(BUILD):
clean:
$(RM) $(NIF) $(OBJ)

.PHONY: all clean calling_from_make install
.PHONY: all clean calling_from_make install tzdata
13 changes: 7 additions & 6 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ defmodule NervesTimeZones.MixProject do

@version "0.1.0"
@source_url "https://github.com/nerves-time/nerves_time_zones"
@tzdb_version "2020f"
@tzdb_earliest_date to_string(System.os_time(:second) - 86400)
@tzdb_latest_date to_string(System.os_time(:second) + 10 * 365 * 86400)
@tzdata_version "2020f"
@tzdata_earliest_date to_string(System.os_time(:second) - 86400)
@tzdata_latest_date to_string(System.os_time(:second) + 10 * 365 * 86400)

def project do
[
Expand All @@ -17,10 +17,11 @@ defmodule NervesTimeZones.MixProject do
source_url: @source_url,
compilers: [:elixir_make | Mix.compilers()],
make_env: %{
"TZDB_VERSION" => @tzdb_version,
"TZDB_EARLIEST_DATE" => @tzdb_earliest_date,
"TZDB_LATEST_DATE" => @tzdb_latest_date
"TZDATA_VERSION" => @tzdata_version,
"TZDATA_EARLIEST_DATE" => @tzdata_earliest_date,
"TZDATA_LATEST_DATE" => @tzdata_latest_date
},
make_error_message: "",
make_targets: ["all"],
make_clean: ["clean"],
docs: docs(),
Expand Down
6 changes: 6 additions & 0 deletions tzcode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# tzcode

See https://www.iana.org/time-zones for code archives. These are cached here
since the combined time zone code+data archive is lzip'd and many people don't
have lzip installed. The data-only database is only gzipped.

Loading

0 comments on commit 279252e

Please sign in to comment.