Skip to content

Commit

Permalink
Handle DEBUG envvar in configure script rather than in Makevars (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
yutannihilation authored Oct 25, 2024
1 parent b9de571 commit e4373ae
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 12 deletions.
12 changes: 11 additions & 1 deletion R-package/configure
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,14 @@ if [ "$(uname)" = "Emscripten" ]; then
TARGET="wasm32-unknown-emscripten"
fi

sed -e "s/@TARGET@/${TARGET}/" src/Makevars.in > src/Makevars
# catch DEBUG envvar, which is passed from pkgbuild::compile_dll()
if [ "${DEBUG}" = "true" ]; then
PROFILE=dev
else
PROFILE=release
fi

sed \
-e "s/@TARGET@/${TARGET}/" \
-e "s/@PROFILE@/${PROFILE}/" \
src/Makevars.in > src/Makevars
12 changes: 11 additions & 1 deletion R-package/configure.win
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,14 @@ RUSTC_VERSION="$(rustc --version || true)"
echo "using Rust package manager: '${CARGO_VERSION}'"
echo "using Rust compiler: '${RUSTC_VERSION}'"

sed -e "s/@TARGET@/x86_64-pc-windows-gnu/" src/Makevars.win.in > src/Makevars.win
# catch DEBUG envvar, which is passed from pkgbuild::compile_dll()
if [ "${DEBUG}" = "true" ]; then
PROFILE=dev
else
PROFILE=release
fi

sed \
-e "s/@TARGET@/x86_64-pc-windows-gnu/" \
-e "s/@PROFILE@/${PROFILE}/" \
src/Makevars.win.in > src/Makevars.win
3 changes: 1 addition & 2 deletions R-package/src/Makevars.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
TARGET = @TARGET@

# catch DEBUG envvar, which is passed from pkgbuild::compile_dll()
PROFILE = $(subst x,release,$(subst truex,dev,$(DEBUG)x))
PROFILE = @PROFILE@

TARGET_DIR = $(CURDIR)/rust/target
LIBDIR = $(TARGET_DIR)/$(TARGET)/$(subst dev,debug,$(PROFILE))
Expand Down
3 changes: 1 addition & 2 deletions R-package/src/Makevars.win.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
TARGET = @TARGET@

# catch DEBUG envvar, which is passed from pkgbuild::compile_dll()
PROFILE = $(subst x,release,$(subst truex,dev,$(DEBUG)x))
PROFILE = @PROFILE@

TARGET_DIR = $(CURDIR)/rust/target
LIBDIR = $(TARGET_DIR)/$(TARGET)/$(subst dev,debug,$(PROFILE))
Expand Down
3 changes: 1 addition & 2 deletions savvy-bindgen/src/gen/templates/Makevars.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
TARGET = @TARGET@

# catch DEBUG envvar, which is passed from pkgbuild::compile_dll()
PROFILE = $(subst x,release,$(subst truex,dev,$(DEBUG)x))
PROFILE = @PROFILE@

TARGET_DIR = $(CURDIR)/rust/target
LIBDIR = $(TARGET_DIR)/$(TARGET)/$(subst dev,debug,$(PROFILE))
Expand Down
3 changes: 1 addition & 2 deletions savvy-bindgen/src/gen/templates/Makevars.win.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
TARGET = @TARGET@

# catch DEBUG envvar, which is passed from pkgbuild::compile_dll()
PROFILE = $(subst x,release,$(subst truex,dev,$(DEBUG)x))
PROFILE = @PROFILE@

TARGET_DIR = $(CURDIR)/rust/target
LIBDIR = $(TARGET_DIR)/$(TARGET)/$(subst dev,debug,$(PROFILE))
Expand Down
12 changes: 11 additions & 1 deletion savvy-bindgen/src/gen/templates/configure
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,14 @@ if [ "$(uname)" = "Emscripten" ]; then
TARGET="wasm32-unknown-emscripten"
fi

sed -e "s/@TARGET@/${TARGET}/" src/Makevars.in > src/Makevars
# catch DEBUG envvar, which is passed from pkgbuild::compile_dll()
if [ "${DEBUG}" = "true" ]; then
PROFILE=dev
else
PROFILE=release
fi

sed \
-e "s/@TARGET@/${TARGET}/" \
-e "s/@PROFILE@/${PROFILE}/" \
src/Makevars.in > src/Makevars
12 changes: 11 additions & 1 deletion savvy-bindgen/src/gen/templates/configure.win
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,14 @@ RUSTC_VERSION="$(rustc --version || true)"
echo "using Rust package manager: '${CARGO_VERSION}'"
echo "using Rust compiler: '${RUSTC_VERSION}'"

sed -e "s/@TARGET@/x86_64-pc-windows-gnu/" src/Makevars.win.in > src/Makevars.win
# catch DEBUG envvar, which is passed from pkgbuild::compile_dll()
if [ "${DEBUG}" = "true" ]; then
PROFILE=dev
else
PROFILE=release
fi

sed \
-e "s/@TARGET@/x86_64-pc-windows-gnu/" \
-e "s/@PROFILE@/${PROFILE}/" \
src/Makevars.win.in > src/Makevars.win

0 comments on commit e4373ae

Please sign in to comment.