From 64f2cab8a8ec6a823156341920ad499ec2cfe9e8 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Thu, 15 May 2025 07:36:41 +0000 Subject: [PATCH] some cleanup and doc updates --- README.md | 115 +++++++++--------- .../README.org" | 7 +- .../RT_extensions_install.sh" | 0 .../RT_extensions_libcpp_capture.sh" | 0 .../build_all.sh" | 0 .../build_gcc.sh" | 0 .../clean_build.sh" | 0 .../clean_dist.sh" | 0 .../clean_source.sh" | 0 .../clean_upstream.sh" | 0 .../deprecated/stuff.cc" | 0 .../environment.sh" | 0 .../library/directives.cc" | 0 .../library/macro.cc" | 0 .../mv_libs_to_gcc.sh" | 0 .../project_download.sh" | 0 .../project_extract.sh" | 0 .../project_requisites.sh" | 0 .../project_setup.sh" | 0 .../rebuild_gcc.sh" | 0 .../todo.org" | 0 21 files changed, 60 insertions(+), 62 deletions(-) rename "script_gcc_min-12\360\237\226\211/README.org" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/README.org" (84%) rename "script_gcc_min-12\360\237\226\211/RT_extensions_install.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/RT_extensions_install.sh" (100%) rename "script_gcc_min-12\360\237\226\211/RT_extensions_libcpp_capture.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/RT_extensions_libcpp_capture.sh" (100%) rename "script_gcc_min-12\360\237\226\211/build_all.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/build_all.sh" (100%) rename "script_gcc_min-12\360\237\226\211/build_gcc.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/build_gcc.sh" (100%) rename "script_gcc_min-12\360\237\226\211/clean_build.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_build.sh" (100%) rename "script_gcc_min-12\360\237\226\211/clean_dist.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_dist.sh" (100%) rename "script_gcc_min-12\360\237\226\211/clean_source.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_source.sh" (100%) rename "script_gcc_min-12\360\237\226\211/clean_upstream.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_upstream.sh" (100%) rename "script_gcc_min-12\360\237\226\211/deprecated/stuff.cc" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/deprecated/stuff.cc" (100%) rename "script_gcc_min-12\360\237\226\211/environment.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/environment.sh" (100%) rename "script_gcc_min-12\360\237\226\211/library/directives.cc" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/library/directives.cc" (100%) rename "script_gcc_min-12\360\237\226\211/library/macro.cc" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/library/macro.cc" (100%) rename "script_gcc_min-12\360\237\226\211/mv_libs_to_gcc.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/mv_libs_to_gcc.sh" (100%) rename "script_gcc_min-12\360\237\226\211/project_download.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_download.sh" (100%) rename "script_gcc_min-12\360\237\226\211/project_extract.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_extract.sh" (100%) rename "script_gcc_min-12\360\237\226\211/project_requisites.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_requisites.sh" (100%) rename "script_gcc_min-12\360\237\226\211/project_setup.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_setup.sh" (100%) rename "script_gcc_min-12\360\237\226\211/rebuild_gcc.sh" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/rebuild_gcc.sh" (100%) rename "script_gcc_min-12\360\237\226\211/todo.org" => "script_Deb-12.10_gcc-12.4.1\360\237\226\211/todo.org" (100%) diff --git a/README.md b/README.md index d5c424a..05e4247 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,34 @@ -# Standalone GCC Installation with Option for RT Mods +# Standalone GCC installation with optional RT cpp extensions -As of 2025-05-15: -This is pre-release development. +## State of the scripts -* Based on GCC 12.4.1 -* Builds on Debian 12 -* Standalone toolchain build scripts are functional and modular -* Includes `#macro` and `#assign` directive support (RT extensions) +The default branch is 'core_developers_branch'. (It is not 'master'.) ---- - -## General Notes - -The scripts in the script_gcc_min-12🖉/ directory are working on Debian 12.10, though 'build_all.sh' has not been run yet. It currently functions as documentation as to how to do the install. Though you might run it if you are brave, mightbe that it will work. - -The scripts in the script_gcc-15🖉/ directory do not work. It was difficult to bootstrap a standalone install of the latest gcc. Hence the fall back to the - -The gcc 12 scripts are working. - -With the esception of this file, all documents are in emacs org format. +The scripts in the script_Deb-12.10_gcc-12.4.1🖉/ directory are currently working to build gcc-12.4.1 on a Debian-12.10 system. They also work to build gcc-12.4.1 with the optional RT extensions to cpp. -## Standalone Build +If you are on another system, or using another version of gcc, if the script_Deb-12.10_gcc-12.4.1🖉/ scripts work for you, please note that here. -For those who wish to let the chips fall where they may: +If you had to modify the scripts to make the install work, please make a new directory with your system and gcc version, and copy and modify the scripts there. -```bash -> source env_toolsmith -> ./build_all.sh -``` - -Alternatively, read through `build_all.sh` and follow its logic step by step. -Environment variables are defined in `script🖉/environment.sh` — this file guides where and how components are installed. - ---- +The scripts in the script_gcc-15🖉/ directory do not work. It was difficult to bootstrap a standalone install of the latest gcc, on Deb-12, but I gave it a try. Hence the fall back to the version 12. -## The `#rt_macro` and `#assign` Directives +## Documentation -These are two experimental extensions to the C preprocessor (CPP), part of the **RT Extensions**. +Apart from this file, the text documents are written in emacs org format. -To enable them: +To see documentation on how to do the build, read the README in the appropriate script directory. Also note that the scripts themselves list the commands and options used, in the order they are used. -```bash -> source env_toolsmith -> ./apply_RT_assign_directive_mod -> ./build_all.sh -``` -(At the moment manually copy the directives.cc and macro.cc files back into the source.) - ---- +## The RT extentions ### `#rt_macro` -Defines a macro in standard ISO form, using token literal parsing and optional parameter substitution. Equivalent to a cleaner `#define`, with controlled multi-line support and macro parameter semantics. +Defines a macro in standard ISO form, using token literal parsing and optional parameter substitution. Basically it is `#define` where the body is contained within parenthesis, and need not be on one line. #### Syntax (EBNF): ``` - directive ::= "#rt_macro" name params body ; name ::= identifier ; @@ -71,29 +41,15 @@ body ::= "(" literal? ")" ; literal ::= ; sequence parsed into tokens without expansion ; whitespace, including newlines, is ignored - ``` -- A `literal` clause is delimited with `(` ... `)` and behaves like `#define F(x) (x + 1)`. -- An `expr` clause is delimited with `[` ... `]` and expands tokens as they are parsed. - -If you need an unbalanced parenthesis in the macro, define it to a macro, then include the macro. - -#define OPEN ( -#assign X() ( OPEN ) - ---- +If you need an unbalanced paren, define a macro that expands to a paren and use that. Parenthesis need only to match when the body is lexed. ### `#assign` -Assigns a macro dynamically. It differs from `#macro` by: -- Accepting a **macro name expression** (`name_clause`) which may itself be an expansion -- Accepting a **macro body expression**, optionally with recursive expansion -- Allowing runtime reassignment of macro behavior - -_This enables construction of self-modifying or symbolic macros within a source file._ +This is another variation on #define. Currently it can not be used to define function like macros. -**Note:** `#assign` currently supports expression-based bodies but does not include parameter binding. +Unlike assign, there is an option to expand the name and body before the definition is registered. When the name is expanded, it must expand to an identifier that can be used as a nmae. #### Syntax (EBNF): @@ -115,6 +71,47 @@ _This enables construction of self-modifying or symbolic macros within a source --- +#### Examples + +See the experiments/ directory for more examples. + +``` +#assign (A_NAME) (3) +``` + +Is the same as: + +``` +#define A_NAME 3 +``` + +``` +#define B_NAME Fred +#assign [B_NAME] (5) +``` + +Is the same as: + +``` +#define Fred 5 +``` + +### `__CAT(SEP, ...)` + +A builtin macro utility for token concatenation with an explicit separator. + +Unlike the standard `##` token pasting, `__CAT` allows insertion of a custom separator, and works with variadic arguments. + +**Example:** + +``` +__CAT(_, foo, bar, baz) // expands to: foo_bar_baz +``` +``` +__CAT(, foo, bar, baz) // expands to: foobarbaz +``` + + ### License This project is licensed under the **MIT License**. diff --git "a/script_gcc_min-12\360\237\226\211/README.org" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/README.org" similarity index 84% rename from "script_gcc_min-12\360\237\226\211/README.org" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/README.org" index 01bb29b..d9aae6b 100755 --- "a/script_gcc_min-12\360\237\226\211/README.org" +++ "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/README.org" @@ -1,14 +1,15 @@ * General Notes -GNU `cpp` is integrated with the gcc repo. +GNU `cpp` is integrated with the GNU gcc repo. There is a lot more to GCC than one might imagine. It was developed as though an integral part of Unix. Hence, the standalone build has top-level directories that resemble the top level of a Unix system. -The scripts here will download source and build a standalone GCC 12 along with version-compatible tools. It is common for a toolsmith to read the scripts and copy paste the commands. +The scripts here will download source and build a standalone GCC 12 along with version-compatible tools. + * RT extensions -If you want the RT extensions, the install_RT_extensions.sh must be run after the gcc sources are expanded. +If you want the RT extensions, the RT extension sources must be copied from library/ after the gcc sources are expanded. Use `RT_extensions_install.sh`. When editing the sources, generally the library/ versions are treated as authoritive. * environment diff --git "a/script_gcc_min-12\360\237\226\211/RT_extensions_install.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/RT_extensions_install.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/RT_extensions_install.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/RT_extensions_install.sh" diff --git "a/script_gcc_min-12\360\237\226\211/RT_extensions_libcpp_capture.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/RT_extensions_libcpp_capture.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/RT_extensions_libcpp_capture.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/RT_extensions_libcpp_capture.sh" diff --git "a/script_gcc_min-12\360\237\226\211/build_all.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/build_all.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/build_all.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/build_all.sh" diff --git "a/script_gcc_min-12\360\237\226\211/build_gcc.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/build_gcc.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/build_gcc.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/build_gcc.sh" diff --git "a/script_gcc_min-12\360\237\226\211/clean_build.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_build.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/clean_build.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_build.sh" diff --git "a/script_gcc_min-12\360\237\226\211/clean_dist.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_dist.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/clean_dist.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_dist.sh" diff --git "a/script_gcc_min-12\360\237\226\211/clean_source.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_source.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/clean_source.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_source.sh" diff --git "a/script_gcc_min-12\360\237\226\211/clean_upstream.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_upstream.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/clean_upstream.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/clean_upstream.sh" diff --git "a/script_gcc_min-12\360\237\226\211/deprecated/stuff.cc" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/deprecated/stuff.cc" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/deprecated/stuff.cc" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/deprecated/stuff.cc" diff --git "a/script_gcc_min-12\360\237\226\211/environment.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/environment.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/environment.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/environment.sh" diff --git "a/script_gcc_min-12\360\237\226\211/library/directives.cc" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/library/directives.cc" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/library/directives.cc" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/library/directives.cc" diff --git "a/script_gcc_min-12\360\237\226\211/library/macro.cc" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/library/macro.cc" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/library/macro.cc" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/library/macro.cc" diff --git "a/script_gcc_min-12\360\237\226\211/mv_libs_to_gcc.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/mv_libs_to_gcc.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/mv_libs_to_gcc.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/mv_libs_to_gcc.sh" diff --git "a/script_gcc_min-12\360\237\226\211/project_download.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_download.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/project_download.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_download.sh" diff --git "a/script_gcc_min-12\360\237\226\211/project_extract.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_extract.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/project_extract.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_extract.sh" diff --git "a/script_gcc_min-12\360\237\226\211/project_requisites.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_requisites.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/project_requisites.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_requisites.sh" diff --git "a/script_gcc_min-12\360\237\226\211/project_setup.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_setup.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/project_setup.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/project_setup.sh" diff --git "a/script_gcc_min-12\360\237\226\211/rebuild_gcc.sh" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/rebuild_gcc.sh" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/rebuild_gcc.sh" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/rebuild_gcc.sh" diff --git "a/script_gcc_min-12\360\237\226\211/todo.org" "b/script_Deb-12.10_gcc-12.4.1\360\237\226\211/todo.org" similarity index 100% rename from "script_gcc_min-12\360\237\226\211/todo.org" rename to "script_Deb-12.10_gcc-12.4.1\360\237\226\211/todo.org" -- 2.20.1