GithubHelp home page GithubHelp logo

olsonjeffery / cargo-lite Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emberian/cargo-lite

0.0 3.0 0.0 196 KB

cargo-lite, a dirt simple package manager for Rust

License: Other

Python 100.00%

cargo-lite's Introduction

cargo-lite v0.2.0

cargo-lite is an interim package manager for Rust that is sloppily designed and implemented, intended to have something that "just works" until there is a package manager that works reliably and well. It depends on sh, docopt, and toml. This isn't intended to grow into a production-quality package manager.

What does it do? It fetches dependencies and builds them. Eventually it will be able to update deps by fetching from hg/git, and also when rustc version changes. That's it. That's all it does. No fancy configurable package script (a la rustpkg), no fancy only-rebuild-what-is-necessary, no handling of cyclic dependencies, etc.

Installation

Install using distutils:

git clone https://github.com/cmr/cargo-lite.git
cd cargo-lite
sudo python setup.py install

That should pull in the dependencies for you. Otherwise, copy cargo-lite into a directory in your PATH and make sure you have the deps installed.

Getting Help

You can find me on irc.mozilla.org as cmr. It's probably best to ask for help in #rust-gamedev, since that's mostly what has spurred me to work on this project.

How To Use cargo-lite

First, you need a cargo-lite.conf in the top-level directory of your repository. In it you will list your dependencies. You do this with a nested list:

deps = [
    ["--git", "http://github.com/bjz/gl-rs.git"]
,   ["--git", "http://github.com/bjz/glfw-rs.git"] # bjz so amaze?
]

This specifies two dependencies: gl-rs and glfw-rs. It specifies that they should be cloned with git. cargo-lite install will read their top-level cargo-lite.conf, install all of their dependencies, and then build them, copying their build artifacts into the package depository (currently hardcoded as ~/.rust). To build your own crate, you need an additional section in the cargo-lite.conf:

[build]
crate_root = "src/main.rs"

This tells cargo-lite to run rustc on src/main.rs. It will pass it the proper -L to link to its dependencies. You can add an additional directive to the build section to add flags:

[build]
crate_root = "src/main.rs"
rustc_args = ["-C", "prefer-dynamic"]

And that's it, for simple crates! You can use cargo-lite build to build your crate. It will output the build artifacts in the same place as running rustc src/main.rs would. For building a library, you need to do:

[build]
crate_root = "src/lib.rs"
crate_type = "library"

For more complex projects, cargo-lite accepts the following directives:

subpackages = ["src/foo", "src/examples"]
[build]
build_cmd = "./build.sh"

cargo-lite.py will first recurse into the subpackages, installing those, and will then run the build_cmd with the system's shell. Two environment variables will be added, which the build_cmd is expected to respect: CARGO_OUT_DIR, which is where artifacts that to be installed must be copied to, and CARGO_RUSTFLAGS, which should be passed to rustc for all artifacts that are copied into CARGO_OUT_DIR. The CARGO_RUSTFLAGS will include things like -L /path/where/cargo-lite/libs/are/stored and optimization options.

FAQ

why python?

Because it's simple and easy to write incorrect software that works (ie, this)

wow this sucks

Yup! I don't handle versioning, intelligent rebuilding, or anything of that sort. Pull requests accepted. Its design revolves around "I want to release this today".

todo

  • store rustc version lib built with
  • configurable repodir + libdir
  • per-project repos (like rustpkg's workspaces)
  • rebuild deps when they change (generate make files? see https://gist.github.com/csherratt/8627881)

non-goals

  • versioning of dependencies
  • build system beyond simply running rustc or a single shell command
  • rustc integration beyond what is already present (no hooking into libsyntax etc)
  • rust rewrite, or a rewrite into any other language

cargo-lite's People

Contributors

derekchiang avatar emberian avatar kokakiwi avatar tomassedovic avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.