From 2cddfecfb2db291836c61d28a20130d923732768 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sat, 17 Jun 2017 01:53:51 +0200 Subject: [PATCH] Enable `io.popen` on Linux --- build.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 1dec803..fd4f1d2 100644 --- a/build.rs +++ b/build.rs @@ -1,8 +1,17 @@ extern crate gcc; +use std::env; + fn main() { - gcc::Config::new() - .define("LUA_USE_APICHECK", None) + let mut config = gcc::Config::new(); + + if env::var("CARGO_CFG_TARGET_OS") == Ok("linux".to_string()) { + // Among other things, this enables `io.popen` support. + // Despite the name, we could enable this on more platforms. + config.define("LUA_USE_LINUX", None); + } + + config.define("LUA_USE_APICHECK", None) .include("lua") .file("lua/lapi.c") .file("lua/lauxlib.c")