Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • fabiao/cookbook
  • redox-os/cookbook
  • stratact/cookbook
  • carrot93/cookbook
  • microcolonel/cookbook
  • feliwir/cookbook
  • xTibor/cookbook
  • jD91mZM2/cookbook
  • mpajkowski/cookbook
  • rw_van/cookbook
  • athei/cookbook
  • kblobr/cookbook
  • VitalyAnkh/cookbook
  • sajattack/cookbook
  • sainath14/cookbook
  • ackxolotl/cookbook
  • AdminXVII/cookbook
  • coolreader18/cookbook
  • deepaksirone/cookbook
  • smckay/cookbook
  • 4lDO2/cookbook
  • tomasritter/cookbook
  • alfredoyang/cookbook
  • samuela/cookbook
  • andrewdavidmackenzie/cookbook
  • uuuvn/cookbook
  • josh_williams/cookbook
  • bjorn3/cookbook
  • ids1024/cookbook
  • Chocimier/cookbook
  • bpisch/cookbook
  • willnode/cookbook
  • grnmeira/cookbook
  • andrey.turkin/cookbook
  • cameronbraid/cookbook
  • kamirr/cookbook
  • freewilll/cookbook
  • kivimango/cookbook
  • rukai/cookbook
  • mattmadeofpasta/cookbook
  • jordan_mccallum/cookbook
  • dahc/cookbook
  • Forest0923/cookbook
  • LLeny/cookbook
  • doriancodes/cookbook
  • ashton/cookbook
  • gmacd/cookbook
  • mojo/cookbook
  • wt/cookbook
  • red15/cookbook
  • hasheddan/cookbook
  • dimymark/cookbook
  • andypython/cookbook
  • enygmator/cookbook
  • Ivan/cookbook
  • argslc/cookbook
  • adi-g15/cookbook
  • tfinnegan937/cookbook
  • raffaeleragni/cookbook
  • Lekkit/cookbook
  • bitstr0m/cookbook
  • josh/cookbook
  • zhaozhao/cookbook
  • blueskyson/cookbook
  • Xunjin/cookbook
  • StaringAtEditor/cookbook
  • monk_programmer/cookbook
  • DimitarGj/cookbook
  • njskalski/cookbook
  • DLC/cookbook
70 results
Show changes
Commits on Source (2170)
Showing with 3796 additions and 309 deletions
...@@ -2,6 +2,17 @@ ...@@ -2,6 +2,17 @@
linker = "aarch64-unknown-redox-gcc" linker = "aarch64-unknown-redox-gcc"
rustflags = [] rustflags = []
[target.i686-unknown-redox]
linker = "i686-unknown-redox-gcc"
rustflags = []
[target.x86_64-unknown-redox] [target.x86_64-unknown-redox]
linker = "x86_64-unknown-redox-gcc" linker = "x86_64-unknown-redox-gcc"
rustflags = [] rustflags = []
[target.riscv64gc-unknown-redox]
linker = "riscv64-unknown-redox-gcc"
rustflags = []
[env]
CFLAGS_riscv64gc_unknown_redox="-march=rv64gc -mabi=lp64d"
build /build
repo /repo
source source
source.tmp
source-new
source.tar source.tar
stage source.tar.tmp
stage.sig target
stage.tar
stage.tar.gz
stage.toml
sysroot
xargo
[submodule "docgen"] [submodule "docgen"]
path = docgen path = docgen
url = https://gitlab.redox-os.org/redox-os/docgen.git url = https://gitlab.redox-os.org/redox-os/docgen.git
[submodule "pkgutils"] branch = master
path = pkgutils [submodule "pkgar"]
url = https://gitlab.redox-os.org/redox-os/pkgutils.git path = pkgar
url = https://gitlab.redox-os.org/redox-os/pkgar.git
branch = master branch = master
This diff is collapsed.
[package]
name = "redox_cookbook"
version = "0.1.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
edition = "2018"
default-run = "cook"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "cook"
path = "src/bin/cook.rs"
[[bin]]
name = "cookbook_redoxer"
path = "src/bin/cookbook_redoxer.rs"
[lib]
name = "cookbook"
path = "src/lib.rs"
[dependencies]
blake3 = "=1.5.3" # 1.5.4 is incompatible with blake3 0.3 dependency from pkgar
object = { version = "0.36", features = ["build_core"] }
pbr = "1.0.2"
pkgar = { path = "pkgar/pkgar" }
pkgar-core = { path = "pkgar/pkgar-core" }
pkgar-keys = { path = "pkgar/pkgar-keys" }
redoxer = "0.2"
serde = { version = "=1.0.197", features = ["derive"] }
termion = "4"
toml = "0.8"
walkdir = "2.3.1"
# cookbook # Cookbook
A collection of package recipes for Redox.
Package system of Redox.
This repository contains the system source code and packages inside the `recipes` folder.
- A recipe can be a software port or system package (they use `pkgar` or `tar.gz` formats).
**Read [this](https://doc.redox-os.org/book/porting-applications.html) page before porting programs to Redox**
In order for this repository to be useful, it must be set up with an environment
from the [redox](https://gitlab.redox-os.org/redox-os/redox) repository.
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
## Setup - [Recipe Categories](#recipe-categories)
- [Search Recipes](#search-recipes)
- [Package Policy](#package-policy)
- [Cross-Compilation](#cross-compilation)
- [Library Linking](#library-linking)
- [ABI stability](#abi-stability)
- [Checksum](#checksum)
- [License](#license)
- [Testing Area](#testing-area)
- [Suggestions for TODOs](#suggestions-for-todos)
- [Repository Layout](#repository-layout)
- [TODO](#todo)
### Recipe Categories
The categories inside the `recipes` folder.
- `core` - System components
- `demos` - Programs with demos and examples
- `dev` - Programs used for development and programming languages, like compilers and dependency managers
- `doc` - Programs used for documentation
- `emulators` - Console emulators or compatibility layers
- `fonts` - Fonts and programs for fonts
- `games` - Any kind of game
- `graphics` - Programs used for graphics processing or production
- `gui` - Orbital
- `icons` - Icon packs
- `libs` - Software with functions for other softwares, like OpenSSL
- `math` - Programs used for calculations
- `net` - Networking tools
- `other` - Software that can't fit on other categories
- `shells` - Terminal interpreters and extensions
- `sound` - Software used for sound processing or production
- `tests` - Software used to test other softwares
- `tools` - Text editors, terminal tools and any other kind of tools
- `tui` - Programs with a [terminal user interface](https://en.wikipedia.org/wiki/Text-based_user_interface)
- `video` - Programs used for video playback, processing and production
- `web` - World Wide Web browsers and tools
- `wip` - Software that needs porting or incomplete recipes
### Search Recipes
Click in the button named "Find file" on the top of this repository to search for recipe names.
### Package Policy
Before sending your recipe to upstream (to become a public package), you must follow these rules:
#### Cross-Compilation
- All recipes must use our cross-compilers, a Cookbook [template](https://doc.redox-os.org/book/porting-applications.html#templates) does this automatically but it's not always possible, study the build system of your program or library to find these options or patch the configuration files.
- Don't hardcode the CPU architecture on the recipe script (this would break the multi-arch support).
#### Tarballs
- Don't use the auto-generated tarballs from GitHub, they aren't static and don't verify the archive integrity.
### Ubuntu and other Debian based systems #### Library Linking
To install the toolchain, run the following commands: - Keep the static linking of libraries to reduce the launch time and improve security.
```bash - If your package is bigger than 50MB, dynamic link big libraries until your package is equal or less than 50MB (to reduce the RAM usage).
# Get the Redox OS APT key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AA12E97F0881517F
# Install the APT repository #### ABI stability
sudo add-apt-repository 'deb https://static.redox-os.org/toolchain/apt /'
# Update your package lists - Respect the ABI separation of the libraries, for example, if `openssl1` is available and some program need `openssl3`, you will create a recipe for `openssl3` and not rename the `openssl1`, as it will break the dependent packages.
sudo apt update
# Install the cross compiler #### Checksum
sudo apt install x86-64-unknown-redox-gcc
```
### Arch Linux - If your recipe download a tarball, you will need to create a BLAKE3 hash for it. You can learn how to do it [here](https://doc.redox-os.org/book/porting-applications.html#create-a-blake3-hash-for-your-recipe).
To install the toolchain, run the following commands:
```bash
# Clone libc
git clone --recursive git@github.com:redox-os/libc
# Go to the packages #### License
cd libc/packages/arch
# Start with binutils - Don't package programs or libraries lacking a license.
cd binutils - Verify if the program has some license violation, in case of doubt ask us on the [chat](https://doc.redox-os.org/book/chat.html).
makepkg -si - Non-free programs and assets should go to a subcategory of the `nonfree` category and be approved per license.
# Then autoconf ### Testing Area
cd ../autoconf
makepkg -si
# Then gcc-freestanding Work-in-progress software ports goes to the `wip` category, be aware of these items during your packaging process:
cd ../gcc-freestanding
makepkg -si
# Then newlib - A recipe is considered ready if it's mostly working inside of Redox.
cd ../newlib - All WIP recipes must have a `#TODO` on the beginning of the `recipe.toml` and explain what is missing.
makepkg -si - BLAKE3 hashes for tarballs are optional (quick testing workflow)
- Try to keep the recipe with the latest stable version of the program (the porting process can take months).
- Once the recipe is ready, add the BLAKE3 hash if needed and move the folder to the appropriate category.
# Finally gcc #### Suggestions for TODOs
cd ../gcc
makepkg -si
```
### Gentoo Linux These TODOs improve the packagers cooperation and understanding.
```bash
# Clone libc
git clone --recursive git@github.com:redox-os/libc
# Install needed tools - `not compiled or tested` - It means that your recipe is fully configured and don't lack necessary dependencies.
emerge -a =sys-devel/autoconf-2.64 =sys-devel/automake-1.11.6-r2 - `missing script for x, see insert-the-link-for-build-instructions-here` - It means that your recipe is lacking the cross-compilation script for some build system, where `x` is the build system name. After `see` you will insert the link for the build instructions of the program or library, it will help other packagers to insert the script for you.
- `missing dependencies, see insert-the-link-for-required-dependencies-here` - It means that the `dependencies = []` section is incomplete.
- `probably wrong script, see insert-the-link-for-build-instructions-here` - It means that you don't know if your script will work.
- `probably wrong template, see insert-the-link-for-build-instructions-here` - It means that you don't know if the Cookbook template will work.
- `probably missing dependencies, see insert-the-link-for-required-dependencies-here` - It means that you don't know if the required dependencies are satisfied.
- `promote` - It means that the recipe is working and should be moved to the equivalent category at `cookbook/recipes`
# Run the setup script Other TODOs are specific and won't be covered on this list.
cd libc
PREFIX=<your preferred toolchain prefix> ./setup.sh all
# Add the tools to your path ### Repository Layout
export PATH=$PATH:<toolchain prefix>/bin
```
### Other distros/Mac OS X - `.cargo` - Cargo configuration.
To install the toolchain, run the following commands: - `bin` - LLVM and pkg-config CPU targets.
```bash - `recipes` - Package configuration files.
# Clone libc - `src` - Package system source code.
git clone --recursive git@github.com:redox-os/libc
# Run the setup script ### TODO
cd libc
./setup.sh all
# Add the tools to your path - Convert old recipes to TOML, see [this](https://gitlab.redox-os.org/redox-os/cookbook/-/issues/174) tracking issue.
export PATH=$PATH:/path/to/libc/build/prefix/bin - Remove the scripts after full TOML conversion.
```
[target.aarch64-unknown-redox.dependencies.std]
features = ["panic_unwind"]
[target.x86_64-unknown-redox.dependencies.std]
features = ["panic_unwind", "backtrace"]
#[dependencies.test]
#stage = 1
#!/usr/bin/env bash
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/lib/pkgconfig"
export PKG_CONFIG_PATH="${PKG_CONFIG_SYSROOT_DIR}/share/pkgconfig"
if [ -n "${COOKBOOK_DYNAMIC}" ]
then
exec pkg-config "$@"
else
exec pkg-config --static "$@"
fi
#!/usr/bin/env bash
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/lib/pkgconfig"
export PKG_CONFIG_PATH="${PKG_CONFIG_SYSROOT_DIR}/share/pkgconfig"
if [ -n "${COOKBOOK_DYNAMIC}" ]
then
exec pkg-config "$@"
else
exec pkg-config --static "$@"
fi
#!/usr/bin/env bash
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/lib/pkgconfig"
export PKG_CONFIG_PATH="${PKG_CONFIG_SYSROOT_DIR}/share/pkgconfig"
if [ -n "${COOKBOOK_DYNAMIC}" ]
then
exec pkg-config "$@"
else
exec pkg-config --static "$@"
fi
This diff is collapsed.
#!/usr/bin/env bash #!/usr/bin/env bash
export PKG_CONFIG_PATH= export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_RECIPE}/sysroot"
export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/lib/pkgconfig" export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/lib/pkgconfig"
export PKG_CONFIG_PATH="${PKG_CONFIG_SYSROOT_DIR}/share/pkgconfig"
exec pkg-config --static "$@" if [ -n "${COOKBOOK_DYNAMIC}" ]
then
exec pkg-config "$@"
else
exec pkg-config --static "$@"
fi
...@@ -5,14 +5,12 @@ source config.sh ...@@ -5,14 +5,12 @@ source config.sh
if [ $# = 0 ] if [ $# = 0 ]
then then
recipes="$(ls -1 recipes)" recipes="$(target/release/list_recipes)"
else else
recipes="$@" recipes="$@"
fi fi
for recipe in $recipes for recipe_path in $recipes
do do
./cook.sh "$recipe" distclean ./cook.sh "$recipe_path" distclean
done done
rm -rf xargo
...@@ -8,29 +8,33 @@ then ...@@ -8,29 +8,33 @@ then
fi fi
ARCH="${TARGET%%-*}" ARCH="${TARGET%%-*}"
HOST="$TARGET" HOST="$TARGET"
if [ x"${HOST}" == x"riscv64gc-unknown-redox" ] ; then
HOST="riscv64-unknown-redox"
fi
# Automatic variables # Automatic variables
ROOT="$(cd `dirname "$0"` && pwd)" ROOT="$(cd `dirname "$0"` && pwd)"
REPO="$ROOT/repo/$TARGET" REPO="$ROOT/repo/$TARGET"
export PATH="${ROOT}/bin:$PATH" export PATH="${ROOT}/bin:$PATH"
export XARGO_HOME="${ROOT}/xargo"
export AR="${HOST}-ar" export AR="${HOST}-gcc-ar"
export AS="${HOST}-as" export AS="${HOST}-as"
export CC="${HOST}-gcc" export CC="${HOST}-gcc"
export CXX="${HOST}-g++" export CXX="${HOST}-g++"
export LD="${HOST}-ld" export LD="${HOST}-ld"
export NM="${HOST}-nm" export NM="${HOST}-gcc-nm"
export OBJCOPY="${HOST}-objcopy" export OBJCOPY="${HOST}-objcopy"
export OBJDUMP="${HOST}-objdump" export OBJDUMP="${HOST}-objdump"
export PKG_CONFIG="${HOST}-pkg-config" export PKG_CONFIG="${HOST}-pkg-config"
export RANLIB="${HOST}-ranlib" export RANLIB="${HOST}-gcc-ranlib"
export READELF="${HOST}-readelf" export READELF="${HOST}-readelf"
export STRIP="${HOST}-strip" export STRIP="${HOST}-strip"
BUILD="$(cc -dumpmachine)"
export PKG_CONFIG_FOR_BUILD="pkg-config" export PKG_CONFIG_FOR_BUILD="pkg-config"
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "FreeBSD" ]]; then
# GNU find # GNU find
FIND="gfind"; FIND="gfind";
...@@ -40,6 +44,8 @@ if [[ "$OSTYPE" == "darwin"* ]]; then ...@@ -40,6 +44,8 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
elif [ ! -z "$(which port)" ]; then elif [ ! -z "$(which port)" ]; then
# TODO: find a programatic way of asking MacPorts for it's root dir. # TODO: find a programatic way of asking MacPorts for it's root dir.
STAT="/opt/local/opt/coreutils/libexec/gnubin/stat"; STAT="/opt/local/opt/coreutils/libexec/gnubin/stat";
elif [ ! -z "$(which pkg)" ]; then
STAT="gnustat"
else else
echo "Please install either Homebrew or MacPorts and run the boostrap script." echo "Please install either Homebrew or MacPorts and run the boostrap script."
exit 1 exit 1
...@@ -48,3 +54,17 @@ else ...@@ -48,3 +54,17 @@ else
FIND="find" FIND="find"
STAT="stat"; STAT="stat";
fi fi
export FIND
export STAT
if [ ! "$(uname -s)" = "Redox" ]
then
function docgen {
"$ROOT/docgen/target/release/docgen" "$@"
}
function pkgar {
"$ROOT/pkgar/target/release/pkgar" "$@"
}
fi
...@@ -6,20 +6,18 @@ source config.sh ...@@ -6,20 +6,18 @@ source config.sh
# Variables to be overriden by recipes # Variables to be overriden by recipes
export BINDIR=bin export BINDIR=bin
export CARGO=(env RUSTFLAGS="$PREFIX_RUSTFLAGS -C link-arg=-zmuldefs" cargo)
export CARGOBUILD=rustc
export CARGOFLAGS= export CARGOFLAGS=
export DEBUG= export DEBUG=
export EXAMPLES=
export PREPARE_COPY=1
if [ ! "$(uname -s)" = "Redox" ] if hash sha256sum 2>/dev/null
then then
SHASUM="sha256sum"
function pkg { else
CC=cc cargo run --release --manifest-path "$ROOT/pkgutils/Cargo.toml" --bin pkg -- $@ SHASUM="shasum -a 256"
}
function docgen {
CC=cc cargo run --release --manifest-path "$ROOT/docgen/Cargo.toml" --bin docgen -- $@
}
fi fi
function usage { function usage {
...@@ -28,26 +26,14 @@ function usage { ...@@ -28,26 +26,14 @@ function usage {
echo " distclean" >&2 echo " distclean" >&2
echo " build" >&2 echo " build" >&2
echo " clean" >&2 echo " clean" >&2
echo " diff" >&2
echo " diff_origin" >&2
echo " diff_upstream" >&2
echo " difftool" >&2
echo " difftool_origin" >&2
echo " difftool_upstream" >&2
echo " fetch" >&2 echo " fetch" >&2
echo " unfetch" >&2 echo " unfetch" >&2
echo " pkg" >&2
echo " unpkg" >&2
echo " prepare" >&2 echo " prepare" >&2
echo " unprepare" >&2 echo " unprepare" >&2
echo " publish" >&2
echo " unpublish" >&2
echo " stage" >&2 echo " stage" >&2
echo " unstage" >&2 echo " unstage" >&2
echo " status" >&2
echo " status_origin" >&2
echo " status_upstream" >&2
echo " tar" >&2
echo " untar" >&2
echo " update" >&2
echo " version" >&2 echo " version" >&2
} }
...@@ -62,10 +48,10 @@ function op { ...@@ -62,10 +48,10 @@ function op {
op $1 prepare op $1 prepare
op $1 build op $1 build
op $1 stage op $1 stage
op $1 tar op $1 pkg
;; ;;
distclean) distclean)
op $1 untar op $1 unpkg
op $1 unstage op $1 unstage
op $1 unprepare op $1 unprepare
;; ;;
...@@ -81,7 +67,13 @@ function op { ...@@ -81,7 +67,13 @@ function op {
then then
if [ ! -f source.tar ] if [ ! -f source.tar ]
then then
wget "$TAR" -O source.tar wget "$TAR" --continue -O source.tar.tmp
mv source.tar.tmp source.tar
fi
if [ -n "$TAR_SHA256" ]
then
$SHASUM -c <<< "${TAR_SHA256} source.tar"
fi fi
if [ ! -d source ] if [ ! -d source ]
...@@ -110,7 +102,17 @@ function op { ...@@ -110,7 +102,17 @@ function op {
git remote add upstream "$GIT_UPSTREAM" git remote add upstream "$GIT_UPSTREAM"
git fetch upstream git fetch upstream
fi fi
git pull
ORIGIN_BRANCH="$(git branch --remotes | grep '^ origin/HEAD -> ' | cut -d ' ' -f 5-)"
if [ -n "$BRANCH" ]
then
ORIGIN_BRANCH="origin/$BRANCH"
fi
if [ "$(git rev-parse HEAD)" != "$(git rev-parse $ORIGIN_BRANCH)" ]
then
git checkout -B "$(echo "$ORIGIN_BRANCH" | cut -d / -f 2-)" "$ORIGIN_BRANCH"
fi
git submodule sync --recursive git submodule sync --recursive
git submodule update --init --recursive git submodule update --init --recursive
popd > /dev/null popd > /dev/null
...@@ -118,113 +120,7 @@ function op { ...@@ -118,113 +120,7 @@ function op {
fi fi
;; ;;
unfetch) unfetch)
rm -rfv source rm -rfv source source.tar
if [ -n "$TAR" ]
then
rm -f source.tar
fi
;;
status)
if [ -n "$TAR" ]
then
tar --compare --file="source.tar" -C "source" --strip-components=1 2>&1 |
grep -v "tar: :" | grep -v '\(Mod time\|Mode\|Gid\|Uid\) differs' ||
true
elif [ -n "$GIT" ]
then
git -C source diff --stat --color
fi
;;
status_origin)
if [ -n "$GIT" ]
then
if [ -n "$BRANCH" ]
then
git -C source diff --stat --color "origin/$BRANCH"
else
git -C source diff --stat --color "origin/master"
fi
fi
;;
status_upstream)
if [ -n "$GIT_UPSTREAM" ]
then
if [ -n "$BRANCH" ]
then
git -C source diff --stat --color "upstream/$BRANCH"
else
git -C source diff --stat --color "upstream/master"
fi
fi
;;
diff)
if [ -n "$GIT" ]
then
git -C source diff
fi
;;
diff_origin)
if [ -n "$GIT" ]
then
if [ -n "$BRANCH" ]
then
git -C source diff "origin/$BRANCH"
else
git -C source diff "origin/master"
fi
fi
;;
diff_upstream)
if [ -n "$GIT_UPSTREAM" ]
then
if [ -n "$BRANCH" ]
then
git -C source diff "upstream/$BRANCH"
else
git -C source diff "upstream/master"
fi
fi
;;
difftool)
if [ -n "$GIT" ]
then
git -C source difftool -d
fi
;;
difftool_origin)
if [ -n "$GIT" ]
then
if [ -n "$BRANCH" ]
then
git -C source difftool -d "origin/$BRANCH"
else
git -C source difftool -d "origin/master"
fi
fi
;;
difftool_upstream)
if [ -n "$GIT_UPSTREAM" ]
then
if [ -n "$BRANCH" ]
then
git -C source difftool -d "upstream/$BRANCH"
else
git -C source difftool -d "upstream/master"
fi
fi
;;
update)
pushd source > /dev/null
skip=0
if [ "$(type -t recipe_update)" = "function" ]
then
recipe_update
fi
if [ "$skip" -eq "0" ]
then
xargo update
fi
popd > /dev/null
;; ;;
prepare) prepare)
skip=0 skip=0
...@@ -234,8 +130,16 @@ function op { ...@@ -234,8 +130,16 @@ function op {
fi fi
if [ "$skip" -eq "0" ] if [ "$skip" -eq "0" ]
then then
rm -rf sysroot rm -rf "${COOKBOOK_SYSROOT}"
mkdir sysroot mkdir "${COOKBOOK_SYSROOT}"
# usrmerge
mkdir "${COOKBOOK_SYSROOT}/usr"
for folder in bin include lib share
do
mkdir "${COOKBOOK_SYSROOT}/usr/${folder}"
ln -s "usr/${folder}" "${COOKBOOK_SYSROOT}/${folder}"
done
if [ ${#BUILD_DEPENDS} -gt 0 ] if [ ${#BUILD_DEPENDS} -gt 0 ]
then then
...@@ -245,25 +149,34 @@ function op { ...@@ -245,25 +149,34 @@ function op {
for i in "${BUILD_DEPENDS[@]}" for i in "${BUILD_DEPENDS[@]}"
do do
pkg --target=$TARGET install --root sysroot "$REPO/$i.tar.gz" pkgar \
extract \
"${COOKBOOK_SYSROOT}" \
--archive "$REPO/$i.pkgar" \
--pkey "${ROOT}/build/id_ed25519.pub.toml"
done done
fi fi
rm -rf build rm -rf "${COOKBOOK_BUILD}"
cp -rp source build if [ "$PREPARE_COPY" -eq "0" ]
then
mkdir "${COOKBOOK_BUILD}"
else
cp -Rp source "${COOKBOOK_BUILD}"
fi
for patch in *.patch for patch in *.patch
do do
patch -p1 -d build < "$patch" patch -p1 -d "${COOKBOOK_BUILD}" < "$patch"
done done
fi fi
;; ;;
unprepare) unprepare)
rm -rf build rm -rf "${COOKBOOK_BUILD}"
rm -rf sysroot rm -rf "${COOKBOOK_SYSROOT}"
;; ;;
version) version)
pushd build > /dev/null pushd "${COOKBOOK_BUILD}" > /dev/null
skip=0 skip=0
if [ "$(type -t recipe_version)" = "function" ] if [ "$(type -t recipe_version)" = "function" ]
then then
...@@ -271,20 +184,21 @@ function op { ...@@ -271,20 +184,21 @@ function op {
fi fi
if [ "$skip" -eq "0" ] if [ "$skip" -eq "0" ]
then then
cargo config package.version | tr -d '"' # there's an unstable built-in cargo config command, so hack around it
cargo-config config package.version | tr -d '"'
fi fi
popd > /dev/null popd > /dev/null
;; ;;
gitversion) gitversion)
if [ -d build/.git ] if [ -d "${COOKBOOK_BUILD}"/.git ]
then then
echo "$(op $1 version)-$(git -C build rev-parse --short HEAD)" echo "$(op $1 version)-$(git -C "${COOKBOOK_BUILD}" rev-parse --short HEAD)"
else else
op $1 version op $1 version
fi fi
;; ;;
build) build)
pushd build > /dev/null pushd "${COOKBOOK_BUILD}" > /dev/null
skip=0 skip=0
if [ "$(type -t recipe_build)" = "function" ] if [ "$(type -t recipe_build)" = "function" ]
then then
...@@ -297,36 +211,20 @@ function op { ...@@ -297,36 +211,20 @@ function op {
release_flag= release_flag=
fi fi
if [ "$skip" -eq "0" ] if [ -n "$CARGO_PACKAGE" ]; then
then package_flag="--package=$CARGO_PACKAGE"
cp -p "$ROOT/Xargo.toml" "Xargo.toml" else
xargo build --target "$TARGET" $release_flag $CARGOFLAGS package_flag=
fi
popd > /dev/null
;;
test)
pushd build > /dev/null
skip=0
if [ "$(type -t recipe_test)" = "function" ]
then
recipe_test
fi
release_flag="--release"
if [ "$DEBUG" == 1 ]
then
release_flag=
fi fi
if [ "$skip" -eq "0" ] if [ "$skip" -eq "0" ]
then then
cp -p "$ROOT/Xargo.toml" "Xargo.toml" "${CARGO[@]}" "$CARGOBUILD" --target "$TARGET" $release_flag $package_flag $CARGOFLAGS
xargo test --no-run --target "$TARGET" $release_flag $CARGOFLAGS
fi fi
popd > /dev/null popd > /dev/null
;; ;;
clean) clean)
pushd build > /dev/null pushd "${COOKBOOK_BUILD}" > /dev/null
skip=0 skip=0
if [ "$(type -t recipe_clean)" = "function" ] if [ "$(type -t recipe_clean)" = "function" ]
then then
...@@ -334,15 +232,16 @@ function op { ...@@ -334,15 +232,16 @@ function op {
fi fi
if [ "$skip" -eq "0" ] if [ "$skip" -eq "0" ]
then then
xargo clean "${CARGO[@]}" clean
fi fi
popd > /dev/null popd > /dev/null
;; ;;
stage) stage)
op $1 unstage op $1 unstage
mkdir -p stage mkdir -p "${COOKBOOK_STAGE}"
stage="$(realpath stage)" stage="$(realpath "${COOKBOOK_STAGE}")"
pushd build > /dev/null source="$(realpath source)"
pushd "${COOKBOOK_BUILD}" > /dev/null
skip=0 skip=0
if [ "$(type -t recipe_stage)" = "function" ] if [ "$(type -t recipe_stage)" = "function" ]
then then
...@@ -350,7 +249,7 @@ function op { ...@@ -350,7 +249,7 @@ function op {
fi fi
if [ "$skip" -eq "0" ] if [ "$skip" -eq "0" ]
then then
#TODO xargo install --root "$stage" $CARGOFLAGS #TODO "${CARGO[@]}" install --root "$stage" $CARGOFLAGS
if [ "$DEBUG" == 1 ] if [ "$DEBUG" == 1 ]
then then
build=debug build=debug
...@@ -359,15 +258,15 @@ function op { ...@@ -359,15 +258,15 @@ function op {
fi fi
bins="$(find target/$TARGET/$build/ -maxdepth 1 -type f ! -name '*.*')" bins="$(find target/$TARGET/$build/ -maxdepth 1 -type f ! -name '*.*')"
if [ -z "$bins" ] if [ -z "$bins" ] || [ "$EXAMPLES" == 1 ]
then then
example=true example=true
bins="$(find target/$TARGET/$build/examples/ -maxdepth 1 -type f ! -name '*.*' ! -name '*-*' \ bins="$bins $(find target/$TARGET/$build/examples/ -maxdepth 1 -type f ! -name '*.*' ! -name '*-*' \
2> /dev/null || true)" 2> /dev/null || true)"
fi fi
if [ -n "$bins" ] if [ -n "$bins" ]
then then
if [ -n "$example" ] if [ -n "$example" ] && [ "$EXAMPLES" != 1 ]
then then
echo "$(tput bold)Note$(tput sgr0): No binaries detected, using example binaries" echo "$(tput bold)Note$(tput sgr0): No binaries detected, using example binaries"
fi fi
...@@ -385,17 +284,24 @@ function op { ...@@ -385,17 +284,24 @@ function op {
echo "$(tput bold)Warning$(tput sgr0): Recipe does not have any binaries" >&2 echo "$(tput bold)Warning$(tput sgr0): Recipe does not have any binaries" >&2
fi fi
docgen ../source ../stage/ref docgen "$source" "$stage/ref"
fi fi
popd > /dev/null popd > /dev/null
;; ;;
unstage) unstage)
rm -rfv stage rm -rfv "${COOKBOOK_STAGE}"
;; ;;
tar) pkg)
echo "name = \"$1\"" > "stage.toml" pkgar \
echo "version = \"$(op $1 version)\"" >> "stage.toml" create \
echo "target = \"$TARGET\"" >> "stage.toml" --archive "${COOKBOOK_STAGE}.pkgar" \
--skey "${ROOT}/build/id_ed25519.toml" \
"${COOKBOOK_STAGE}"
# Generate stage.toml
echo "name = \"$1\"" > "${COOKBOOK_STAGE}.toml"
echo "version = \"$(op $1 version)\"" >> "${COOKBOOK_STAGE}.toml"
echo "target = \"$TARGET\"" >> "${COOKBOOK_STAGE}.toml"
# Add runtime dependencies to package if they exist # Add runtime dependencies to package if they exist
if [ -n "$DEPENDS" ] if [ -n "$DEPENDS" ]
...@@ -403,26 +309,13 @@ function op { ...@@ -403,26 +309,13 @@ function op {
# Remove leading and trailing whitespace, replace whitespace between # Remove leading and trailing whitespace, replace whitespace between
# package names with commas, and surround package names with quotes # package names with commas, and surround package names with quotes
dependencies=$(echo -e "$DEPENDS" | sed -E 's/^[[:space:]]*//;s/[[:space:]]*$//;s/[[:space:]]+/,/g;s/[^, ][^, ]*/"&"/g') dependencies=$(echo -e "$DEPENDS" | sed -E 's/^[[:space:]]*//;s/[[:space:]]*$//;s/[[:space:]]+/,/g;s/[^, ][^, ]*/"&"/g')
echo "depends = [$dependencies]" >> "stage.toml" echo "depends = [$dependencies]" >> "${COOKBOOK_STAGE}.toml"
else else
echo "depends = []" >> "stage.toml" echo "depends = []" >> "${COOKBOOK_STAGE}.toml"
fi fi
mkdir -p stage/pkg
cp -v stage.toml "stage/pkg/$1.toml"
pkg --target=$TARGET create stage
;; ;;
untar) unpkg)
rm -rfv stage.tar.gz stage.sig stage.toml rm -fv "${COOKBOOK_STAGE}.pkgar" "${COOKBOOK_STAGE}.toml"
;;
publish)
mkdir -p "$REPO"
cp -v stage.tar.gz "$REPO/$1.tar.gz"
cp -v stage.sig "$REPO/$1.sig"
cp -v stage.toml "$REPO/$1.toml"
;;
unpublish)
rm -rfv "$REPO/$1.tar.gz" "$REPO/$1.sig" "$REPO/$1.toml"
;; ;;
*) *)
usage $1 usage $1
...@@ -432,19 +325,36 @@ function op { ...@@ -432,19 +325,36 @@ function op {
if [ -n "$1" ] if [ -n "$1" ]
then then
if [ -d "$ROOT/recipes/$1" ] if (echo "$1" | grep '.*/.*' >/dev/null); then
recipe_name=$(basename "$1")
recipe_path="recipes/$1"
else
recipe_name="$1"
recipe_path=`target/release/find_recipe $recipe_name`
fi
if [ -d "$ROOT/$recipe_path" ]
then then
export COOKBOOK_RECIPE="${ROOT}/recipes/$1" export COOKBOOK_RECIPE="${ROOT}/$recipe_path"
TARGET_DIR="${COOKBOOK_RECIPE}/target/${TARGET}"
mkdir -p "${TARGET_DIR}"
export COOKBOOK_BUILD="${TARGET_DIR}/build"
export COOKBOOK_STAGE="${TARGET_DIR}/stage"
export COOKBOOK_SOURCE="${COOKBOOK_RECIPE}/source"
export COOKBOOK_SYSROOT="${TARGET_DIR}/sysroot"
export PKG_CONFIG_ALLOW_CROSS=1 export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_PATH= export PKG_CONFIG_PATH=
export PKG_CONFIG_LIBDIR="${COOKBOOK_RECIPE}/sysroot/lib/pkgconfig" export PKG_CONFIG_LIBDIR="${COOKBOOK_SYSROOT}/lib/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_RECIPE}/sysroot" export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
cd "${COOKBOOK_RECIPE}" cd "${COOKBOOK_RECIPE}"
source recipe.sh if [ -e recipe.sh ]; then
source recipe.sh
fi
ops=() ops=()
for arg in "${@:2}" for arg in "${@:2}"
...@@ -459,10 +369,10 @@ then ...@@ -459,10 +369,10 @@ then
for i in "${ops[@]}" for i in "${ops[@]}"
do do
op "$1" "$i" op "$recipe_name" "$i"
done done
else else
echo "cook.sh: recipe '$1' not found" >&2 echo "cook.sh: recipe '$recipe_name' at not found" >&2
exit 1 exit 1
fi fi
else else
......
...@@ -5,12 +5,25 @@ source config.sh ...@@ -5,12 +5,25 @@ source config.sh
if [ $# = 0 ] if [ $# = 0 ]
then then
recipes="$(ls -1 recipes)" recipes="$(target/release/list_recipes)"
else else
recipes="$@" recipes="$@"
fi fi
for recipe in $recipes for recipe_path in $recipes
do do
./cook.sh "$recipe" fetch if (echo "$recipe_path" | grep '.*/.*' >/dev/null); then
recipe_name=$(basename "$recipe_path")
recipe_path="recipes/$recipe_path"
else
recipe_name="$recipe_path"
recipe_path=`target/release/find_recipe $recipe_name`
fi
if [ -e "$recipe_path/recipe.toml" ]
then
target/release/cook --fetch-only "$recipe_name"
else
./cook.sh "$recipe_name" fetch
fi
done done
Subproject commit 0ccbc9914b1ec655e23d4babc5afed87e42e9a0f
Subproject commit 4908c5e486afca3371b20245b50a21a9eeeef084
GIT=https://gitlab.redox-os.org/redox-os/acid.git
[source]
tar = "https://github.com/lz4/lz4/releases/download/v1.10.0/lz4-1.10.0.tar.gz"
blake3 = "3e69fd475e7852e17594985528b5232afeba7d3d56cfebe2e89071768b2ab36a"
patches = ["redox.patch"]
[build]
template = "custom"
script = """
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
# No configure provided
COOKBOOK_CONFIGURE="true"
COOKBOOK_CONFIGURE_FLAGS=""
export CPPFLAGS="${CPPFLAGS} -D_REDOX"
cookbook_configure
"""