Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it build with latest rustc #5

Closed
paulolieuthier opened this issue Apr 1, 2015 · 2 comments
Closed

Make it build with latest rustc #5

paulolieuthier opened this issue Apr 1, 2015 · 2 comments

Comments

@paulolieuthier
Copy link

Can't build it using rustc nightly. I've fixed the erros in build.rs, but there are errors in source code as well.

EDIT: I've fixed ffi.rs as well, but couldn't fix lib.rs as it makes use of std::intrinsics::TyDesc, which was removed from Rust as you can see here: rust-lang/rust#23376.

diff --git a/build.rs b/build.rs
index 9deb49d..b8c6358 100644
--- a/build.rs
+++ b/build.rs
@@ -1,27 +1,25 @@
-extern crate "pkg-config" as pkg_config;
+#![feature(convert)]

-use std::old_io::Command;
-use std::os;
+extern crate pkg_config;

-#[allow(unused_must_use)]
-fn main() {
-    let mut build = os::getcwd().unwrap();
-    build.push_many(&["ext", "libqmlrswrapper", "build"]);
+use std::process::Command;
+use std::fs;
+use std::env;
+use std::path::PathBuf;

-    /* Ignore error, the return value is not reliable and we'll catch it when chdir'ing anyway. */
-    std::old_io::fs::mkdir(&build, std::old_io::USER_RWX);
+fn main() {
+    let wcd = env::current_dir().unwrap();
+    let build = PathBuf::from(&wcd.join("ext/libqmlrswrapper/build"));

-    os::change_dir(&build).ok().expect("Failed to change into build directory");
+    let _ = fs::create_dir_all(&build);
...skipping...

     println!("cargo:rustc-flags=-L {} -l qmlrswrapper:static -l stdc++", build.display());
     pkg_config::find_library("Qt5Core Qt5Gui Qt5Qml Qt5Quick").unwrap();
diff --git a/src/ffi.rs b/src/ffi.rs
index 207d5c2..aaee52d 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -9,7 +9,7 @@ pub enum QVariant {}
 pub enum QVariantList {}

 #[repr(C)]
-#[derive(Eq, PartialEq, Show, Copy)]
+#[derive(Eq, PartialEq, Debug, Copy)]
 pub enum QrsVariantType {
     Invalid = 0,
     Int64,
diff --git a/src/lib.rs b/src/lib.rs
index 7d658ec..664dfe5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,6 +5,7 @@ extern crate libc;

 use libc::{c_char, c_int, c_uint, c_void};
 use std::sync::Arc;
+use std::old_path::Path;
 use ffi::{QVariant, QrsEngine, QObject};

 /* Re-exports */
@paulolieuthier paulolieuthier changed the title Update qmlrs to the latest Rust Make it build with latest rustc Apr 1, 2015
@cyndis
Copy link
Owner

cyndis commented Apr 1, 2015

Thanks for your patch! I applied it and fixed the issues in the library proper. I had to remove the code that calls destructors for set properties, so those won't be called for now. That piece of code was horrible and would have to have been replaced anyway. Hopefully I'll get the free time and inspiration to fix this properly some time :p

@cyndis cyndis closed this as completed Apr 1, 2015
@paulolieuthier
Copy link
Author

Hey, man, that was quick! 😄 Thanks, I hope I can help more some other day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants