From c3aa12549e0209e8e4afffbec0b888d3b2787cdc Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Sat, 1 Jul 2017 12:10:05 -0700 Subject: [PATCH 1/5] Update pkgutils submodule --- pkgutils | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgutils b/pkgutils index bf8cc11dd..c7a89531e 160000 --- a/pkgutils +++ b/pkgutils @@ -1 +1 @@ -Subproject commit bf8cc11ddcc649c3be3e97055ab6a7f4060b7946 +Subproject commit c7a89531e1a788a8e5a96f12c8949f9a2a8e9bdb From e098418b0e363b18aa19ebfdace59a068c4bd319 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Sat, 1 Jul 2017 12:10:22 -0700 Subject: [PATCH 2/5] Use symlinks instead of scripts --- recipes/dash/recipe.sh | 3 +-- recipes/gcc/recipe.sh | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/recipes/dash/recipe.sh b/recipes/dash/recipe.sh index 27c87435f..26c147b78 100644 --- a/recipes/dash/recipe.sh +++ b/recipes/dash/recipe.sh @@ -44,7 +44,6 @@ function recipe_clean { function recipe_stage { dest="$(realpath $1)" make DESTDIR="$dest" install - echo -e '#!/bin/ion\ndash @args[1..]' > "$1/bin/sh" - chmod a+x "$1/bin/sh" + ln -s "dash" "$1/bin/sh" skip=1 } diff --git a/recipes/gcc/recipe.sh b/recipes/gcc/recipe.sh index a27002e6d..fecb84728 100644 --- a/recipes/gcc/recipe.sh +++ b/recipes/gcc/recipe.sh @@ -53,7 +53,6 @@ function recipe_stage { dest="$(realpath $1)" make DESTDIR="$dest" install-gcc install-target-libgcc find "$dest"/{bin,libexec} -exec x86_64-elf-redox-strip {} ';' 2> /dev/null - echo -e '#!/bin/ion\ngcc @args[1..]' > "$1/bin/cc" - chmod a+x "$1/bin/cc" + ln -s "gcc" "$1/bin/cc" skip=1 } From a15946a32469079477d798f7d17186c4499bc764 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Thu, 6 Jul 2017 14:24:19 -0700 Subject: [PATCH 3/5] System for compile-time dependencies; use for openssl --- cook.sh | 16 ++++++++++++++++ recipes/cargo/recipe.sh | 19 ++----------------- recipes/curl/recipe.sh | 22 ++-------------------- recipes/openssl/recipe.sh | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 37 deletions(-) create mode 100644 recipes/openssl/recipe.sh diff --git a/cook.sh b/cook.sh index 9d11a95b9..4a9ab7831 100755 --- a/cook.sh +++ b/cook.sh @@ -95,6 +95,21 @@ function op { fi ;; prepare) + rm -rf sysroot + mkdir sysroot + + if [ ${#BUILD_DEPENDS} -gt 0 ] + then + pushd $ROOT + ./repo.sh ${BUILD_DEPENDS} + popd + + for i in "${BUILD_DEPENDS[@]}" + do + CC=cc cargo run --release --manifest-path "$ROOT/pkgutils/Cargo.toml" --bin pkg -- --target=$TARGET install --root sysroot "$REPO/$i.tar.gz" + done + fi + rm -rf build cp -r source build @@ -105,6 +120,7 @@ function op { ;; unprepare) rm -rf build + rm -rf sysroot ;; version) pushd build > /dev/null diff --git a/recipes/cargo/recipe.sh b/recipes/cargo/recipe.sh index 835267931..dad63c3bc 100644 --- a/recipes/cargo/recipe.sh +++ b/recipes/cargo/recipe.sh @@ -1,22 +1,7 @@ GIT=https://github.com/ids1024/cargo.git BRANCH=redox +BUILD_DEPENDS=(openssl) function recipe_build { - if [ -d openssl-redox ] - then - git -C openssl-redox pull - else - git clone https://github.com/ids1024/openssl.git -b redox --depth 1 openssl-redox - fi - - rm -rf openssl-prefix - mkdir openssl-prefix - - pushd openssl-redox - ./Configure no-shared no-dgram redox-x86_64 --prefix="/" - make -j"$(nproc)" - make DESTDIR="$PWD/../openssl-prefix" install - popd - - export OPENSSL_DIR=$PWD/openssl-prefix + export OPENSSL_DIR="$PWD/../sysroot" } diff --git a/recipes/curl/recipe.sh b/recipes/curl/recipe.sh index ad96990c2..80ef01b77 100644 --- a/recipes/curl/recipe.sh +++ b/recipes/curl/recipe.sh @@ -1,5 +1,6 @@ GIT=https://github.com/ids1024/curl.git BRANCH=redox +BUILD_DEPENDS=(openssl) HOST=x86_64-elf-redox @@ -14,27 +15,8 @@ function recipe_update { } function recipe_build { - if [ -d openssl-redox ] - then - git -C openssl-redox pull - else - git clone https://github.com/ids1024/openssl.git -b redox --depth 1 openssl-redox - fi - - rm -rf openssl-prefix - mkdir openssl-prefix - - pushd openssl-redox - ./Configure no-shared no-dgram redox-x86_64 --prefix="/" - make -j"$(nproc)" - make DESTDIR="$PWD/../openssl-prefix" install - popd - - rm -rf openssl-prefix/lib/pkgconfig # pkg-config returns paths based on / prefix, breaking cross compile - - ./configure --prefix=/ --host=${HOST} --disable-tftp --disable-ftp --disable-ntlm-wb --with-ssl="$PWD/openssl-prefix" --with-ca-path=/ssl/certs + ./configure --prefix=/ --host=${HOST} --disable-tftp --disable-ftp --disable-ntlm-wb --with-ssl="$PWD/../sysroot" --with-ca-path=/ssl/certs make - skip=1 } diff --git a/recipes/openssl/recipe.sh b/recipes/openssl/recipe.sh new file mode 100644 index 000000000..48559cac7 --- /dev/null +++ b/recipes/openssl/recipe.sh @@ -0,0 +1,38 @@ +GIT=https://github.com/ids1024/openssl.git +BRANCH=redox + +HOST=x86_64-elf-redox + +function recipe_version { + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + skip=1 +} + +function recipe_update { + echo "skipping update" + skip=1 +} + +function recipe_build { + ./Configure no-shared no-dgram redox-x86_64 --prefix="/" + make -j"$(nproc)" + skip=1 +} + +function recipe_test { + echo "skipping test" + skip=1 +} + +function recipe_clean { + make clean + skip=1 +} + +function recipe_stage { + dest="$(realpath $1)" + make DESTDIR="$dest" install + rm -rf "$1/lib/pkgconfig" # pkg-config returns paths based on / prefix, breaking cross compile + rm -rf "$1/{share,ssl}" + skip=1 +} From b7db0cafb8ad627d3d0c6644c270be679957fe68 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Thu, 6 Jul 2017 14:25:19 -0700 Subject: [PATCH 4/5] Update pkgutils --- pkgutils | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgutils b/pkgutils index bf8cc11dd..96a6b2d9f 160000 --- a/pkgutils +++ b/pkgutils @@ -1 +1 @@ -Subproject commit bf8cc11ddcc649c3be3e97055ab6a7f4060b7946 +Subproject commit 96a6b2d9fe30d054ef754e6cc3bf88ff60e40199 From f0bb6ec31d3e3301fa08f778650173bc8a73a19a Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Thu, 6 Jul 2017 14:28:06 -0700 Subject: [PATCH 5/5] Add sysroot to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 64dda0f65..22481bbf1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ stage.sig stage.tar stage.tar.gz stage.toml +sysroot xargo