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

The silver searcher to rust #1418

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ config.status
config.sub
configure
depcomp
html/
Doxyfile
gmon.out
install-sh
Makefile
Makefile.in
missing
rust/target
src/config.h*
stamp-h1
tests/*.err
Expand Down
43 changes: 43 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,49 @@ dist_zshcomp_DATA = _the_silver_searcher

EXTRA_DIST = Makefile.w32 LICENSE NOTICE the_silver_searcher.spec README.md

#########################################################################################

RUST_SOURCE =\
rust/Cargo.toml\
rust/src/lib.rs

RUST_EXTRA =\
rust/Cargo.lock

if DEBUG_RELEASE
CARGO_RELEASE_ARGS=
else
CARGO_RELEASE_ARGS=--release
endif

rust_dir = $(top_srcdir)/rust

check-local-rust:
cd $(rust_dir) && \
CARGO_TARGET_DIR=target cargo test

clean-local-rust:
cd $(rust_dir) && \
cargo clean

RUST_LIB=$(rust_dir)/target/@RUST_TARGET_SUBDIR@/librust_internals.a

$(RUST_LIB): $(RUST_SOURCE)
cd $(rust_dir) && \
CARGO_TARGET_DIR=target cargo build --verbose $(CARGO_RELEASE_ARGS)

EXTRA_DIST += \
$(RUST_SOURCE) \
$(RUST_EXTRA)

ag_LDADD += $(RUST_LIB)

# solve undefined reference to 'dlsym' caused by newer
# versions of gcc/ld default to linking with --as-needed.
ag_LDFLAGS = -Wl,--no-as-needed -ldl

#########################################################################################

all:
@$(MAKE) ag -r

Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# The Silver Searcher - Incremental manual transpilation to Rust

Hi there!

First of all, thank you for your work on this beautiful tool and for sharing it for free!

About this pull request:
As part of my Bachelor thesis in Computer Science at the Technische Universität Darmstadt, I forumlated a "recipe" to do manual and incremental C to Rust transpilation and applied it on your project's filter and ignore functionalities.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is pretty cool to hear about!

Of course it would be great if you considered merging this pull request or branching off in your repository, but apart from that even some sort of smallish feedback would mean a lot coming from you and may substanciate further work on this topic.
For about 5 months, I will keep working on this with my thesis' supervisor, and, if everything works out, we will publish a paper - so thank you very much if you should find the time to contribute and help me pacing forward in this direction!

Best
Phil


# The Silver Searcher

A code searching tool similar to `ack`, with a focus on speed.
Expand Down
3 changes: 3 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make clean-local-rust && make clean && make distclean
22 changes: 22 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,26 @@ AM_COND_IF(
[AC_MSG_WARN([clang-format not found. 'make test' will not detect improperly-formatted files.])]
)

###############################################################################################

AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[Build Rust code with debugging information [default=no]]),
[debug_release=$enableval],
[debug_release=no])

AC_MSG_CHECKING(whether to build Rust code with debugging information)
if test "x$debug_release" = "xyes" ; then
AC_MSG_RESULT(yes)
RUST_TARGET_SUBDIR=debug
else
AC_MSG_RESULT(no)
RUST_TARGET_SUBDIR=release
fi
AM_CONDITIONAL([DEBUG_RELEASE], [test "x$debug_release" = "xyes"])

AC_SUBST([RUST_TARGET_SUBDIR])

###############################################################################################

AC_OUTPUT