pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

mrust-minicargo: no longer implicitly pass -g to mrustc backend



Module Name:	pkgsrc-wip
Committed By:	Dave Berger <pkgsrc-mrust%web5by5.com@localhost>
Pushed By:	dave
Date:		Sat Jan 22 08:08:38 2022 -0500
Changeset:	73594985b9dafe0d6274640e7c3d560362b4a50b

Modified Files:
	mrust-minicargo/distinfo
	mrust-minicargo/patches/patch-tools_minicargo_build.cpp
Added Files:
	mrust-minicargo/patches/patch-tools_minicargo_build.h
	mrust-minicargo/patches/patch-tools_minicargo_main.cpp

Log Message:
mrust-minicargo: no longer implicitly pass -g to mrustc backend

 o  Cuts down memory requirements for build
 o  New minicargo -g switch optionally re-enables old behavior

Jan 19 17:23:05 2022 EST: patch-tools_minicargo_build.cpp
Jan 19 17:23:05 2022 EST: patch-tools_minicargo_build.h
Jan 19 17:23:05 2022 EST: patch-tools_minicargo_main.cpp

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=73594985b9dafe0d6274640e7c3d560362b4a50b

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 mrust-minicargo/distinfo                           |  4 ++-
 .../patches/patch-tools_minicargo_build.cpp        | 24 ++++++++++++-
 .../patches/patch-tools_minicargo_build.h          | 12 +++++++
 .../patches/patch-tools_minicargo_main.cpp         | 40 ++++++++++++++++++++++
 4 files changed, 78 insertions(+), 2 deletions(-)

diffs:
diff --git a/mrust-minicargo/distinfo b/mrust-minicargo/distinfo
index b0ddca5a85..51b94cb8b4 100644
--- a/mrust-minicargo/distinfo
+++ b/mrust-minicargo/distinfo
@@ -4,4 +4,6 @@ SHA1 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866
 RMD160 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = c99362354c652e037622c84b8076ea3bfc4e1ec8
 SHA512 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 8af5c92102f9964c8f68ff469f0d1197e9b84fcf07d9efa8805011766ce256ddef794c2d08a3a85c7cd0234c9235ca5fe0b18372a71fa984d36e2e765d379037
 Size (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 1354302 bytes
-SHA1 (patch-tools_minicargo_build.cpp) = 3b28768fbdab9310aa3c4805ee6f02a7bbe216a4
+SHA1 (patch-tools_minicargo_build.cpp) = c17d70ae42d8302afd1650ffc69061f4675a5d97
+SHA1 (patch-tools_minicargo_build.h) = 4149736055d68e67717a9fd4ecfe5e2a2cc09afd
+SHA1 (patch-tools_minicargo_main.cpp) = 943679c189e43db2f4d07f4b8353b2c53cebc25e
diff --git a/mrust-minicargo/patches/patch-tools_minicargo_build.cpp b/mrust-minicargo/patches/patch-tools_minicargo_build.cpp
index 76f2bbe018..5c9b62fc54 100644
--- a/mrust-minicargo/patches/patch-tools_minicargo_build.cpp
+++ b/mrust-minicargo/patches/patch-tools_minicargo_build.cpp
@@ -11,7 +11,29 @@ $NetBSD$
  # include <sys/sysctl.h>
  #endif
  
-@@ -1266,7 +1266,11 @@ const helpers::path& get_mrustc_path()
+@@ -906,9 +906,11 @@ bool Builder::build_target(const Package
+         }
+     }
+     if( true /*this->enable_debug*/ ) {
+-        args.push_back("-g");
+         args.push_back("--cfg"); args.push_back("debug_assertions");
+     }
++    if( m_opts.mrustc_g ) {
++        args.push_back("-g");
++    }
+     if( true /*this->enable_optimise*/ ) {
+         args.push_back("-O");
+     }
+@@ -1044,7 +1046,7 @@ bool Builder::build_target(const Package
+     args.push_back("--crate-type"); args.push_back("bin");
+     args.push_back("-o"); args.push_back(outfile);
+     args.push_back("-L"); args.push_back(this->get_output_dir(true).str()); // NOTE: Forces `is_for_host` to true here.
+-    if( true )
++    if( m_opts.mrustc_g )
+     {
+         args.push_back("-g");
+     }
+@@ -1266,7 +1268,11 @@ const helpers::path& get_mrustc_path()
          else
              // TODO: Buffer too small
  # elif defined(__FreeBSD__) || defined(__DragonFly__) || (defined(__NetBSD__) && defined(KERN_PROC_PATHNAME)) // NetBSD 8.0+
diff --git a/mrust-minicargo/patches/patch-tools_minicargo_build.h b/mrust-minicargo/patches/patch-tools_minicargo_build.h
new file mode 100644
index 0000000000..0cb663abe8
--- /dev/null
+++ b/mrust-minicargo/patches/patch-tools_minicargo_build.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- tools/minicargo/build.h.orig	2021-09-12 00:15:52.000000000 +0000
++++ tools/minicargo/build.h
+@@ -20,6 +20,7 @@ struct BuildOptions
+     ::helpers::path build_script_overrides;
+     ::std::vector<::helpers::path>  lib_search_dirs;
+     bool emit_mmir = false;
++    bool mrustc_g  = false;
+     const char* target_name = nullptr;  // if null, host is used
+     enum class Mode {
+         /// Build the binary/library
diff --git a/mrust-minicargo/patches/patch-tools_minicargo_main.cpp b/mrust-minicargo/patches/patch-tools_minicargo_main.cpp
new file mode 100644
index 0000000000..ca35bb844e
--- /dev/null
+++ b/mrust-minicargo/patches/patch-tools_minicargo_main.cpp
@@ -0,0 +1,40 @@
+$NetBSD$
+
+--- tools/minicargo/main.cpp.orig	2021-09-12 00:15:52.000000000 +0000
++++ tools/minicargo/main.cpp
+@@ -44,6 +44,9 @@ struct ProgramOptions
+     // Library search directories
+     ::std::vector<const char*>  lib_search_dirs;
+ 
++    // Pass "-g" to backend mrustc (for compiling in debugging symbols)
++    bool mrustc_g = false;
++
+     // Number of build jobs to run at a time
+     unsigned build_jobs = 1;
+ 
+@@ -220,6 +223,7 @@ int main(int argc, const char* argv[])
+         build_opts.output_dir = opts.output_directory ? ::helpers::path(opts.output_directory) : ::helpers::path("output");
+         build_opts.lib_search_dirs.reserve(opts.lib_search_dirs.size());
+         build_opts.emit_mmir = opts.emit_mmir;
++        build_opts.mrustc_g = opts.mrustc_g;
+         build_opts.target_name = opts.target;
+         for(const auto* d : opts.lib_search_dirs)
+             build_opts.lib_search_dirs.push_back( ::helpers::path(d) );
+@@ -318,6 +322,9 @@ int ProgramOptions::parse(int argc, cons
+                     return 1;
+                 }
+                 break;
++            case 'g':
++                this->mrustc_g = true;
++                break;
+             case 'n':
+                 this->build_jobs = 0;
+                 break;
+@@ -429,6 +436,7 @@ void ProgramOptions::help() const
+         << "--vendor-dir <dir>       : Directory containing vendored packages (from `cargo vendor`)\n"
+         << "--output-dir,-o <dir>    : Specify the compiler output directory\n"
+         << "-L <dir>                 : Search for pre-built crates (e.g. libstd) in the specified directory\n"
++        << "-g                       : Pass -g to invocations of mrustc (for compiling in debugging symbols)\n"
+         << "-j <count>               : Run at most <count> build tasks at once (default is to run only one)\n"
+         << "-n                       : Don't build any packages, just list the packages that would be built\n"
+         ;


Home | Main Index | Thread Index | Old Index