From 4547515dc2dbb41e609579b147e85b703646804b Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Tue, 28 Oct 2014 23:19:09 -0400 Subject: [PATCH] progress --- recipes-deps/curl/curl_%.bbappend | 24 +++++ recipes-deps/libgit2/libgit2_0.21.1.bb | 1 + recipes-deps/zlib/zlib_%.bbappend | 2 +- recipes/cargo/cargo.inc | 14 +-- recipes/cargo/cargo_2014-10-09.bb | 7 +- recipes/cargo/cargo_2014-10-10.bb | 5 -- recipes/cargo/cargo_2014-10-15.bb | 6 -- recipes/cargo/cargo_2014-10-21.bb | 6 -- recipes/cargo/cargo_2014-10-28.bb | 2 + recipes/rust/rust-0.12.0.inc | 9 -- recipes/rust/rust-git.inc | 6 ++ recipes/rust/rust-release.inc | 6 ++ recipes/rust/rust.inc | 107 ++++++++++++++++++++++ recipes/rust/rust_0.12.0+2014-10-28.bb | 7 ++ recipes/rust/rust_0.12.0.bb | 117 ++----------------------- 15 files changed, 169 insertions(+), 150 deletions(-) create mode 100644 recipes-deps/curl/curl_%.bbappend delete mode 100644 recipes/cargo/cargo_2014-10-10.bb delete mode 100644 recipes/cargo/cargo_2014-10-15.bb delete mode 100644 recipes/cargo/cargo_2014-10-21.bb create mode 100644 recipes/cargo/cargo_2014-10-28.bb delete mode 100644 recipes/rust/rust-0.12.0.inc create mode 100644 recipes/rust/rust-git.inc create mode 100644 recipes/rust/rust-release.inc create mode 100644 recipes/rust/rust.inc create mode 100644 recipes/rust/rust_0.12.0+2014-10-28.bb diff --git a/recipes-deps/curl/curl_%.bbappend b/recipes-deps/curl/curl_%.bbappend new file mode 100644 index 0000000..c3c1bb1 --- /dev/null +++ b/recipes-deps/curl/curl_%.bbappend @@ -0,0 +1,24 @@ + +## An excerpt from curl-sys's build script: +#export CFLAGS := $(CFLAGS) -fPIC -ffunction-sections -fdata-sections +#OPTS := $(OPTS) \ +# --enable-static=yes \ +# --enable-shared=no \ +# --disable-ldap --disable-ldaps --disable-ftp --disable-rtsp \ +# --disable-dict --disable-telnet --disable-tftp --disable-pop3 \ +# --disable-imap --disable-smtp --disable-gopher --disable-manual \ +# --enable-optimize --without-librtmp --without-libidn \ +# --prefix="$(OUT_DIR)" +## Due to how rust links, we need -fPIC. Without it, + +#EXTRA_OECONF_append = " \ +# --with-zlib \ +# --enable-static \ +# --enable-hidden-symbols \ +#" + +CFLAGS +=" -fPIC" + +do_configure_prepend () { + #export CFLAGS="$CFLAGS -fPIC" +} diff --git a/recipes-deps/libgit2/libgit2_0.21.1.bb b/recipes-deps/libgit2/libgit2_0.21.1.bb index 7f3c903..9b94b41 100644 --- a/recipes-deps/libgit2/libgit2_0.21.1.bb +++ b/recipes-deps/libgit2/libgit2_0.21.1.bb @@ -1,3 +1,4 @@ SRC_URI[md5sum] = "cbf3422d54dd6f55f09855a6eb749f41" +SRC_URI[sha256sum] = "bc06bc9b5f8449040b8d0f727c83cbd7a4c2243317d33d57c3c548873294845e" require libgit2.inc diff --git a/recipes-deps/zlib/zlib_%.bbappend b/recipes-deps/zlib/zlib_%.bbappend index d5b730c..5586293 100644 --- a/recipes-deps/zlib/zlib_%.bbappend +++ b/recipes-deps/zlib/zlib_%.bbappend @@ -1,5 +1,5 @@ # cargo tries to build a shared object using several static objects, one of # which includes the contenst of zlib (zutil.o) do_configure_prepend () { - export CFLAGS="${CFLAGS} -fPIC" + #export CFLAGS="${CFLAGS} -fPIC" } diff --git a/recipes/cargo/cargo.inc b/recipes/cargo/cargo.inc index 1637482..537e57d 100644 --- a/recipes/cargo/cargo.inc +++ b/recipes/cargo/cargo.inc @@ -4,7 +4,7 @@ HOMEPAGE = "http://crates.io" SECTION = "devel" LICENSE = "MIT | Apache-2.0" -DEPENDS = "openssl-native rust-native zlib-native libgit2-native curl-native" +DEPENDS = "openssl-native rust-native zlib-native libgit2-native curl-native ca-certificates-native" SRC_URI = "git://github.com/rust-lang/cargo.git;protocol=https" @@ -18,11 +18,6 @@ LIC_FILES_CHKSUM ="\ S = "${WORKDIR}/git" B = "${S}" -do_patch () { - # Work around a bug in openssl-static-sys - ln -f "${prefix}/../lib/libcrypto.a" "${prefix}/lib/" -} - do_configure () { "${S}/configure" \ "--prefix=${prefix}" \ @@ -44,13 +39,6 @@ do_compile () { # to override it's arch info. oe_cargo_config - # FIXME: rustc needs -L flags to know where to look for libs, adding -L - # flags to the linker is not sufficient. - # As a workaround, copy libs locally - local ldep="${S}/target/${RUST_TARGET_SYS}/deps" - mkdir -p "${ldep}" - cp "${libdir}/libz.a" "${ldep}" - export RUST_PATH="${RUST_PATH}" oe_runmake ARGS="--verbose" } diff --git a/recipes/cargo/cargo_2014-10-09.bb b/recipes/cargo/cargo_2014-10-09.bb index 0181911..c59f6de 100644 --- a/recipes/cargo/cargo_2014-10-09.bb +++ b/recipes/cargo/cargo_2014-10-09.bb @@ -1,3 +1,8 @@ SRCREV = "2d101e2e3809da5dc6c79c27ad962d7945cddfb5" -require recipes/cargo/cargo.inc +do_patch_prepend () { + # Work around a bug in openssl-static-sys + mkdir -p "${prefix}/lib" + ln -sf "${base_prefix}/lib/libcrypto.a" "${prefix}/lib/" +} +require cargo.inc diff --git a/recipes/cargo/cargo_2014-10-10.bb b/recipes/cargo/cargo_2014-10-10.bb deleted file mode 100644 index 5e4ab16..0000000 --- a/recipes/cargo/cargo_2014-10-10.bb +++ /dev/null @@ -1,5 +0,0 @@ -SRCREV = "0881adf3eef5283bdfc006a23ea907b6529b0027" - -# This version doesn't work with rust-0.12.0 -DEFAULT_PREFERENCE = "-1" -require recipes/cargo/cargo.inc diff --git a/recipes/cargo/cargo_2014-10-15.bb b/recipes/cargo/cargo_2014-10-15.bb deleted file mode 100644 index 8c68c27..0000000 --- a/recipes/cargo/cargo_2014-10-15.bb +++ /dev/null @@ -1,6 +0,0 @@ -SRCREV = "9788700351f5c236c4e403f28a9156e6ee0b2483" - -# This version doesn't work with rust-0.12.0 -DEFAULT_PREFERENCE = "-1" - -require recipes/cargo/cargo.inc diff --git a/recipes/cargo/cargo_2014-10-21.bb b/recipes/cargo/cargo_2014-10-21.bb deleted file mode 100644 index 9160ba8..0000000 --- a/recipes/cargo/cargo_2014-10-21.bb +++ /dev/null @@ -1,6 +0,0 @@ -SRCREV = "abc712795321d13dcf6839242c476e42d3e211d2" - -# This version doesn't work with rust-0.12.0 -DEFAULT_PREFERENCE = "-1" - -require recipes/cargo/cargo.inc diff --git a/recipes/cargo/cargo_2014-10-28.bb b/recipes/cargo/cargo_2014-10-28.bb new file mode 100644 index 0000000..f46a47f --- /dev/null +++ b/recipes/cargo/cargo_2014-10-28.bb @@ -0,0 +1,2 @@ +SRCREV = "947a62b7db0a105d7ba70d3ea77be0a21e7e1bd9" +require cargo.inc diff --git a/recipes/rust/rust-0.12.0.inc b/recipes/rust/rust-0.12.0.inc deleted file mode 100644 index 431c185..0000000 --- a/recipes/rust/rust-0.12.0.inc +++ /dev/null @@ -1,9 +0,0 @@ -SRC_URI[md5sum] = "24f80304da2ef1c0362b7caf700390f9" -SRC_URI[sha256sum] = "883e66b24d90d9957c5c538469fcde6f0668e5fb6448beecfc60884060e769b7" - -LIC_FILES_CHKSUM ="\ - file://COPYRIGHT;md5=0e8e4a3b5d8e1c90eb243d406369763a \ -" -SRC_URI_append = "\ - file://0001-mk-rt-export-CC-does-not-seem-to-work-gcc-observed-u.patch \ -" diff --git a/recipes/rust/rust-git.inc b/recipes/rust/rust-git.inc new file mode 100644 index 0000000..ab5cc4c --- /dev/null +++ b/recipes/rust/rust-git.inc @@ -0,0 +1,6 @@ +SRC_URI = "\ + gitsm://github.com/rust-lang/rust.git;protocol=https \ +" +S = "${WORKDIR}/git" +require rust.inc + diff --git a/recipes/rust/rust-release.inc b/recipes/rust/rust-release.inc new file mode 100644 index 0000000..db83c4e --- /dev/null +++ b/recipes/rust/rust-release.inc @@ -0,0 +1,6 @@ +SRC_URI = "\ + https://static.rust-lang.org/dist/rust-${PV}.tar.gz \ +" + +require rust.inc + diff --git a/recipes/rust/rust.inc b/recipes/rust/rust.inc new file mode 100644 index 0000000..cf48a65 --- /dev/null +++ b/recipes/rust/rust.inc @@ -0,0 +1,107 @@ +inherit rust + +SUMMARY = "Rust compiler and runtime libaries" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "MIT | Apache-2.0" + +B = "${WORKDIR}/build" + +do_configure () { + # FIXME: allow --enable-local-rust + # FIXME: target_prefix vs prefix, see cross.bbclass + # FIXME: handle non-native builds + + # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a + # wide range of targets (not just HOST). Yocto's settings for them will + # be inappropriate, avoid using. + unset CFLAGS + unset LDFLAGS + unset CXXFLAGS + unset CPPFLAGS + + # XXX: rpath is required otherwise rustc fails to resolve symbols + + ${S}/configure \ + "--enable-rpath" \ + "--disable-verify-install" \ + "--prefix=${prefix}" \ + "--target=${RUST_TARGET_SYS}" \ + "--localstatedir=${localstatedir}" \ + "--sysconfdir=${sysconfdir}" \ + "--datadir=${datadir}" \ + "--infodir=${infodir}" \ + "--mandir=${mandir}" \ + "--build=${RUST_BUILD_SYS}" \ + "--host=${RUST_HOST_SYS}" \ + "--libdir=${libdir}" + + +} + +rust_runmake () { + echo "COMPILE ${PN}" "$@" + env + + # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a + # wide range of targets (not just HOST). Yocto's settings for them will + # be inappropriate, avoid using. + unset CFLAGS + unset LDFLAGS + unset CXXFLAGS + unset CPPFLAGS + + # FIXME: this only works if RT != RH. For RT == RH, we need to add + # additional targets to platform.mk and patch rust to understand the + # new triples (so it can find runtime libraries). + + # Note: these variable names include '-', so we can't supply them via + # shell exports + oe_runmake \ + CROSS_PREFIX_${RUST_TARGET_SYS}= \ + CC_${rt}="${CCACHE}${TARGET_PREFIX}gcc ${TARGET_CC_ARCH}" \ + CXX_${rt}="${CCACHE}${TARGET_PREFIX}g++ ${TARGET_CC_ARCH}" \ + CPP_${rt}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} -E" \ + AR_${rt}="${TARGET_PREFIX}ar" \ + \ + CROSS_PREFIX_${ROST_HOST_SYS}= \ + CC_${rh}="${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}" \ + CXX_${rh}="${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}" \ + CPP_${rh}="${HOST_PREFIX}gcc ${HOST_CC_ARCH} -E" \ + AR_${rh}="${HOST_PREFIX}ar" \ + \ + CFG_CFLAGS_${RUST_TARGET_SYS}="${TARGET_CFLAGS}" \ + CFG_LDFLAGS_${RUST_TARGET_SYS}="${TARGET_LDFLAGS}" \ + CFG_CFLAGS_${RUST_HOST_SYS}="${HOST_CFLAGS}" \ + CFG_LDFLAGS_${RUST_HOST_SYS}="${HOST_LDFLAGS}" \ + \ + "$@" +} + +do_compile () { + rust_runmake +} + +do_install () { + rust_runmake DESTDIR="${D}" install +} + +# FIXME: use FILES to create a -runtime (not -native) package +# $PREFIX/lib/rustlib/`rust_triple`/lib/* contains the runtime libraries (and rlibs) +# Need to copy the *.so files to the appropriate target path +# cp $prefix/lib/rustlib/`rust_triple "${TARGET_ARCH}" "${TARGET_VENDOR}" "${TARGET_OS}"`/lib/*.so ${target_libdir}/ + +# cross-canadian: llvm configure fails for host while attempting to build host-only llvm +BBCLASSEXTEND = "cross native" + +#python cross_virtclass_provides_native_handler () { +# classextend = e.data.getVar('BBCLASSEXTEND', True) or "" +# if "cross" not in classextend: +# return +# pn = e.data.getVar("PN", True) +# if not pn.endswith("-cross"): +# return +# e.data.prependVar("PROVIDES", "rust-native ") +#} +#addhandler cross_virtclass_provides_native_handler +#cross_virtclass_provides_native_handler[eventmask] = "bb.event.RecipePreFinalise" diff --git a/recipes/rust/rust_0.12.0+2014-10-28.bb b/recipes/rust/rust_0.12.0+2014-10-28.bb new file mode 100644 index 0000000..f42a0a9 --- /dev/null +++ b/recipes/rust/rust_0.12.0+2014-10-28.bb @@ -0,0 +1,7 @@ +LIC_FILES_CHKSUM ="\ + file://COPYRIGHT;md5=0e8e4a3b5d8e1c90eb243d406369763a \ +" + +SRCREV = "1652a1f2c61883c5f2b55a952796619d8aef365e" + +require rust-git.inc diff --git a/recipes/rust/rust_0.12.0.bb b/recipes/rust/rust_0.12.0.bb index d42618c..9d1d67d 100644 --- a/recipes/rust/rust_0.12.0.bb +++ b/recipes/rust/rust_0.12.0.bb @@ -1,112 +1,11 @@ -inherit rust +SRC_URI[md5sum] = "24f80304da2ef1c0362b7caf700390f9" +SRC_URI[sha256sum] = "883e66b24d90d9957c5c538469fcde6f0668e5fb6448beecfc60884060e769b7" -SUMMARY = "Rust compiler and runtime libaries" -HOMEPAGE = "http://www.rust-lang.org" -SECTION = "devel" -LICENSE = "MIT | Apache-2.0" - -SRC_URI = "\ - https://static.rust-lang.org/dist/rust-${PV}.tar.gz \ +LIC_FILES_CHKSUM ="\ + file://COPYRIGHT;md5=0e8e4a3b5d8e1c90eb243d406369763a \ +" +SRC_URI_append = "\ + file://0001-mk-rt-export-CC-does-not-seem-to-work-gcc-observed-u.patch \ " -B = "${WORKDIR}/build" -do_configure () { - # FIXME: allow --enable-local-rust - # FIXME: target_prefix vs prefix, see cross.bbclass - # FIXME: handle non-native builds - - # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a - # wide range of targets (not just HOST). Yocto's settings for them will - # be inappropriate, avoid using. - unset CFLAGS - unset LDFLAGS - unset CXXFLAGS - unset CPPFLAGS - - # XXX: rpath is required otherwise rustc fails to resolve symbols - - ${S}/configure \ - "--enable-rpath" \ - "--disable-verify-install" \ - "--prefix=${prefix}" \ - "--target=${RUST_TARGET_SYS}" \ - "--localstatedir=${localstatedir}" \ - "--sysconfdir=${sysconfdir}" \ - "--datadir=${datadir}" \ - "--infodir=${infodir}" \ - "--mandir=${mandir}" \ - "--build=${RUST_BUILD_SYS}" \ - "--host=${RUST_HOST_SYS}" \ - "--libdir=${libdir}" - - -} - -rust_runmake () { - echo "COMPILE ${PN}" "$@" - env - - # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a - # wide range of targets (not just HOST). Yocto's settings for them will - # be inappropriate, avoid using. - unset CFLAGS - unset LDFLAGS - unset CXXFLAGS - unset CPPFLAGS - - # FIXME: this only works if RT != RH. For RT == RH, we need to add - # additional targets to platform.mk and patch rust to understand the - # new triples (so it can find runtime libraries). - - # Note: these variable names include '-', so we can't supply them via - # shell exports - oe_runmake \ - CROSS_PREFIX_${RUST_TARGET_SYS}= \ - CC_${rt}="${CCACHE}${TARGET_PREFIX}gcc ${TARGET_CC_ARCH}" \ - CXX_${rt}="${CCACHE}${TARGET_PREFIX}g++ ${TARGET_CC_ARCH}" \ - CPP_${rt}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} -E" \ - AR_${rt}="${TARGET_PREFIX}ar" \ - \ - CROSS_PREFIX_${ROST_HOST_SYS}= \ - CC_${rh}="${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}" \ - CXX_${rh}="${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}" \ - CPP_${rh}="${HOST_PREFIX}gcc ${HOST_CC_ARCH} -E" \ - AR_${rh}="${HOST_PREFIX}ar" \ - \ - CFG_CFLAGS_${RUST_TARGET_SYS}="${TARGET_CFLAGS}" \ - CFG_LDFLAGS_${RUST_TARGET_SYS}="${TARGET_LDFLAGS}" \ - CFG_CFLAGS_${RUST_HOST_SYS}="${HOST_CFLAGS}" \ - CFG_LDFLAGS_${RUST_HOST_SYS}="${HOST_LDFLAGS}" \ - \ - "$@" -} - -do_compile () { - rust_runmake -} - -do_install () { - rust_runmake DESTDIR="${D}" install -} - -# FIXME: use FILES to create a -runtime (not -native) package -# $PREFIX/lib/rustlib/`rust_triple`/lib/* contains the runtime libraries (and rlibs) -# Need to copy the *.so files to the appropriate target path -# cp $prefix/lib/rustlib/`rust_triple "${TARGET_ARCH}" "${TARGET_VENDOR}" "${TARGET_OS}"`/lib/*.so ${target_libdir}/ - -# cross-canadian: llvm configure fails for host while attempting to build host-only llvm -BBCLASSEXTEND = "cross native" - -#python cross_virtclass_provides_native_handler () { -# classextend = e.data.getVar('BBCLASSEXTEND', True) or "" -# if "cross" not in classextend: -# return -# pn = e.data.getVar("PN", True) -# if not pn.endswith("-cross"): -# return -# e.data.prependVar("PROVIDES", "rust-native ") -#} -#addhandler cross_virtclass_provides_native_handler -#cross_virtclass_provides_native_handler[eventmask] = "bb.event.RecipePreFinalise" - -require recipes/rust/rust-${PV}.inc +require rust-release.inc