Current section
Files
Jump to
Current section
Files
nerves_system_iot_gate_imx8plus
mix.exs
mix.exs
defmodule NervesSystemIotGateIMX8Plus.MixProject do
use Mix.Project
@github_organization "redwirelabs"
@app :nerves_system_iot_gate_imx8plus
@source_url "https://github.com/#{@github_organization}/#{@app}"
@version Path.join(__DIR__, "VERSION")
|> File.read!()
|> String.trim()
def project do
[
app: @app,
version: @version,
elixir: "~> 1.17",
compilers: Mix.compilers() ++ [:nerves_package],
nerves_package: nerves_package(),
description: description(),
package: package(),
deps: deps(),
aliases: [loadconfig: [&bootstrap/1]],
docs: docs(),
preferred_cli_env: %{
docs: :docs,
"hex.build": :docs,
"hex.publish": :docs
}
]
end
def application do
[]
end
defp bootstrap(args) do
set_target()
Application.start(:nerves_bootstrap)
Mix.Task.run("loadconfig", args)
end
defp nerves_package do
[
type: :system,
artifact_sites: [
{:github_releases, "#{@github_organization}/#{@app}"}
],
build_runner_opts: build_runner_opts(),
platform: Nerves.System.BR,
platform_config: [
defconfig: "nerves_defconfig"
],
env: [
{"TARGET_ARCH", "aarch64"},
{"TARGET_CPU", "cortex_a53"},
{"TARGET_OS", "linux"},
{"TARGET_ABI", "gnu"}
],
checksum: package_files()
]
end
defp deps do
[
{:nerves, "~> 1.11", runtime: false},
{:nerves_system_br, "1.28.2", runtime: false},
{:nerves_toolchain_aarch64_nerves_linux_gnu, "~> 13.2.0", runtime: false},
{:nerves_system_linter, "~> 0.4", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.34", only: :docs, runtime: false}
]
end
defp description do
"Nerves System - Compulab IoT Gate IMX8Plus"
end
defp docs do
[
extras: ["README.md", "CHANGELOG.md"],
main: "readme",
assets: "assets",
source_ref: "v#{@version}",
source_url: @source_url,
skip_undefined_reference_warnings_on: ["CHANGELOG.md"]
]
end
defp package do
[
files: package_files(),
licenses: ["Apache-2.0"],
links: %{"GitHub" => @source_url}
]
end
defp package_files do
[
"CHANGELOG.md",
"LICENSE",
"README.md",
"VERSION",
"assets/images",
"fwup-ops.conf",
"fwup.conf",
"fwup_include",
"linux",
"mix.exs",
"nerves_defconfig",
"post-build.sh",
"post-createfs.sh",
"rootfs_overlay",
"uboot"
]
end
defp build_runner_opts() do
# Download source files first to get download errors right away.
[make_args: primary_site() ++ ["source", "all", "legal-info"]]
end
defp primary_site() do
case System.get_env("BR2_PRIMARY_SITE") do
nil -> []
primary_site -> ["BR2_PRIMARY_SITE=#{primary_site}"]
end
end
defp set_target() do
if function_exported?(Mix, :target, 1) do
apply(Mix, :target, [:target])
else
System.put_env("MIX_TARGET", "target")
end
end
end