Created
July 7, 2019 14:44
-
-
Save nyaray/b500f1225ce863db0b534cb3d26d0f14 to your computer and use it in GitHub Desktop.
tft_rpi3 mix files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule TftRpi3.MixProject do | |
use Mix.Project | |
@app :tft_rpi3 | |
@version Path.join(__DIR__, "VERSION") | |
|> File.read!() | |
|> String.trim() | |
def project do | |
[ | |
app: @app, | |
version: @version, | |
elixir: "~> 1.6", | |
compilers: Mix.compilers() ++ [:nerves_package], | |
nerves_package: nerves_package(), | |
description: description(), | |
package: package(), | |
deps: deps(), | |
aliases: [loadconfig: [&bootstrap/1], docs: ["docs", ©_images/1]], | |
docs: [extras: ["README.md"], main: "readme"] | |
] | |
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, "nerves-project/#{@app}"} | |
{:github_releases, "nyaray/#{@app}"} | |
], | |
build_runner_opts: build_runner_opts(), | |
platform: Nerves.System.BR, | |
platform_config: [ | |
defconfig: "nerves_defconfig" | |
], | |
checksum: package_files() | |
] | |
end | |
defp deps do | |
[ | |
{:nerves, "~> 1.3", runtime: false}, | |
{:nerves_system_br, "1.7.2", runtime: false}, | |
{:nerves_toolchain_arm_unknown_linux_gnueabihf, "1.1.0", runtime: false}, | |
{:nerves_system_linter, "~> 0.3.0", runtime: false}, | |
{:ex_doc, "~> 0.18", only: [:dev, :test], runtime: false} | |
] | |
end | |
defp description do | |
""" | |
Nerves System - Raspberry Pi 3 B / B+ | |
""" | |
end | |
defp package do | |
[ | |
maintainers: ["Emilio Nyaray Valenzuela"], | |
files: package_files(), | |
licenses: ["Apache 2.0"], | |
links: %{"GitHub" => "https://github.com/nyaray/#{@app}"} | |
] | |
end | |
defp package_files do | |
[ | |
"fwup_include", | |
"rootfs_overlay", | |
"CHANGELOG.md", | |
"cmdline.txt", | |
"config.txt", | |
"fwup-revert.conf", | |
"fwup.conf", | |
"LICENSE", | |
"linux-4.19.defconfig", | |
"mix.exs", | |
"nerves_defconfig", | |
"post-build.sh", | |
"post-createfs.sh", | |
"ramoops.dts", | |
"README.md", | |
"VERSION" | |
] | |
end | |
# Copy the images referenced by docs, since ex_doc doesn't do this. | |
defp copy_images(_) do | |
File.cp_r("assets", "doc/assets") | |
end | |
defp build_runner_opts() do | |
if primary_site = System.get_env("BR2_PRIMARY_SITE") do | |
[make_args: ["BR2_PRIMARY_SITE=#{primary_site}"]] | |
else | |
[] | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Tfttest.MixProject do | |
use Mix.Project | |
@all_targets [:rpi3, :tft_rpi3] | |
def project do | |
[ | |
app: :tfttest, | |
version: "0.1.0", | |
elixir: "~> 1.8", | |
archives: [nerves_bootstrap: "~> 1.5"], | |
start_permanent: Mix.env() == :prod, | |
build_embedded: true, | |
aliases: [loadconfig: [&bootstrap/1]], | |
deps: deps() | |
] | |
end | |
# Starting nerves_bootstrap adds the required aliases to Mix.Project.config() | |
# Aliases are only added if MIX_TARGET is set. | |
def bootstrap(args) do | |
Application.start(:nerves_bootstrap) | |
Mix.Task.run("loadconfig", args) | |
end | |
# Run "mix help compile.app" to learn about applications. | |
def application do | |
[ | |
mod: {Tfttest.Application, []}, | |
extra_applications: [:logger, :runtime_tools] | |
] | |
end | |
# Run "mix help deps" to learn about dependencies. | |
defp deps do | |
[ | |
# Dependencies for all targets | |
{:nerves, "~> 1.4", runtime: false}, | |
{:shoehorn, "~> 0.4"}, | |
{:ring_logger, "~> 0.6"}, | |
{:toolshed, "~> 0.2"}, | |
# Dependencies for all targets except :host | |
{:nerves_runtime, "~> 0.6", targets: @all_targets}, | |
{:nerves_init_gadget, "~> 0.4", targets: @all_targets}, | |
# Dependencies for specific targets | |
{:nerves_system_rpi3, "~> 1.6", runtime: false, targets: :rpi3}, | |
{:tft_rpi3, | |
path: "../tft_rpi3", nerves: [compile: true], runtime: false, targets: :tft_rpi3} | |
# {:tft_rpi3, git: "git@github.com/nyaray/tft_rpi3.git", runtime: false, targets: :tft_rpi3} | |
] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment