├── .gitignore ├── FAQ.md ├── LICENSE.md ├── README.md ├── documentation ├── BUILDING.md ├── arachnid.md ├── notes.md └── package_management_system.md └── scripts ├── README.md ├── clean_sources ├── create_filesystem ├── cross_compile_programs ├── env_vars_etc ├── finalise_toolchain_build ├── get_sources ├── hard_clean ├── patches └── 01-spider-linux-directories.patch ├── spider-chroot ├── start_toolchain_build └── varcheck /.gitignore: -------------------------------------------------------------------------------- 1 | base 2 | toolchain 3 | scripts/test.c 4 | scripts/sources 5 | -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | # Frequently Asked Questions 2 | 3 | ### What is the [USP](https://en.wikipedia.org/wiki/Unique_selling_proposition) of Spider Linux in comparison to every other distro? 4 | 5 | Spider Linux's unique selling point is that it can do whatever you like but 6 | without all the cruft of something like, say, Gentoo and Portage. In fact the 7 | whole distro is based around this idea of doing everything at the simplest 8 | level. That's why we're using Python for the package manager and shell scripts 9 | and trying our best to make the simplest implementations of things. 10 | 11 | ### Who is Spider Linux targeted towards? 12 | 13 | Anyone can use Spider Linux. We have rough plans to support a variety of 14 | installation methods based on preference and hopefully have a variety of init 15 | systems as well. This is supposed to be a flexible distro anyone can use. 16 | 17 | ### How does Spider Linux differ from X or Y? 18 | 19 | Lots of choice but without tons of drawbacks. You could go GNUless if you 20 | really wanted to. 21 | 22 | ### How does the packaging system work? 23 | 24 | I am glad you asked. Our package management system uses our package manager 25 | **arachnid** - you could think of it like pacman mixed with emerge/portage but 26 | 10x cooler - for installing packages either from source or from a pre-compiled 27 | binary tarball. Arachnid will be developed in the latest version of Python 28 | because the language lines up with the project goals: it's getting faster with 29 | every update, it's simple and easy to use but it also has a very functional 30 | standard library. 31 | 32 | If you need/want to build a package from source the format will also be in 33 | Python. This allows us to be functional while reproducible which, in the modern 34 | era, is a pretty important thing. It also lets the build instructions be a 35 | format which is well known and is quite simple to learn instead of having a 36 | custom formatted build file or one which uses a shell-like format. 37 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Spider Linux 2 | 3 | Spider Linux is a work-in-progress, modern, independent, free and open-source 4 | Linux distribution. 5 | 6 | **Matrix**: 7 | [https://matrix.to/#/#spider-linux:privatevoid.net](https://matrix.to/#/#spider-linux:privatevoid.net) 8 | 9 | **As of Feb 2022**: The system is in, by no means, a usable state even for an 10 | advanced user. It is mainly due to hardcoded variables that are useful for 11 | testing on my machine but not for running on others'. I am working on changing 12 | that and so can you :^) 13 | 14 | You can see the FAQ [here](FAQ.md). 15 | 16 | For building the system from source see [here](documentation/BUILDING.md). 17 | 18 | ## Philosophy 19 | 20 | Spider Linux is developed with the following goals in mind: simplicity, 21 | efficiency and functionality. The goal is to have a minimal base system unto 22 | which the user can turn into whatever they desire using a powerful yet simple 23 | package manager/management system. I started the project because I wanted the 24 | best of both worlds when it came to package management, pre-compiled 25 | binary/source-based, but in a more convenient manner. 26 | 27 | ## Roadmap 28 | 29 | See [here](https://github.com/spider-linux/spiderlinux/issues/2). 30 | 31 | ## Documentation 32 | 33 | I try my best to document as much of the process as possible. Rough notes from 34 | before the project began can be found in the [documentation/](documentation/) 35 | directory of the Git repo. 36 | 37 | Documentation for the build scripts is provided 38 | [here](https://github.com/redshifttt/spiderlinux/blob/master/scripts/README.md). 39 | 40 | ## Inspiration 41 | 42 | Projects from which I drew inspiration from in no particular order: 43 | 44 | - Arch Linux 45 | - Gentoo Linux 46 | - Void Linux 47 | - OpenBSD 48 | - SerenityOS 49 | - glaucus Linux 50 | - NixOS 51 | -------------------------------------------------------------------------------- /documentation/BUILDING.md: -------------------------------------------------------------------------------- 1 | # How to Build 2 | 3 | Revision 2 (2022-04-20) 4 | 5 | This will be a rough guide on how to build the system from the ground up with 6 | the build scripts. It is mainly meant for people developing the system and the 7 | package manager but anyone can really use it for now. Since the whole system is 8 | basically one repo at this stage, some directories will need to be created 9 | within the repo. 10 | 11 | ## Prerequisites for your system 12 | 13 | * coreutils 14 | * make 15 | * automake 16 | * autoconf 17 | * findutils 18 | * bash 19 | * Python (one of the configure tests fails if your system doesn't have this installed) 20 | 21 | If you find there is more then send a PR. 22 | 23 | ## 1. Setup 24 | 25 | ### 1.1 Creating the necessary directories 26 | 27 | First you want to create the `base/` directory in the git root. 28 | 29 | ``` 30 | spiderlinux/ 31 | ├── base/ <--------- 32 | ├── documentation/ 33 | ├── scripts/ 34 | ├── FAQ.md 35 | ├── LICENSE.md 36 | └── README.md 37 | ``` 38 | 39 | This is where the eventual root filesystem will go. 40 | 41 | Next you want to go into `scripts/` and create a `sources/` directory. 42 | 43 | ### 1.2 Modifying the environment variables 44 | 45 | If you go into `env_vars_etc` you will find all of the variables and functions 46 | that the build scripts use to make life a lot easier. Change `BASE_DIR` to 47 | the path to the git repository. 48 | 49 | ```bash 50 | BASE_DIR=/home/sean/files/docs/projects/spiderlinux 51 | ``` 52 | 53 | Optionally you can change the `JOBS` variable to `-jX` with `X` being the 54 | number of jobs you want. By default this is set to the value of `nproc` which 55 | is number of processors. 56 | 57 | ```bash 58 | JOBS="-j$(nproc)" # total number of cores 59 | ``` 60 | 61 | ### 1.3 Getting the build sources 62 | 63 | Now what you're gonna want to do is run the `get_sources` script. This will 64 | download and untar all of the source code into the `sources/` directory you 65 | just made. 66 | 67 | ``` 68 | $ ./get_sources 69 | ``` 70 | 71 | At this stage there should be tarballs and their untarred contents in the 72 | `sources/` directory. 73 | 74 | **Pro Tip:** if you need to kill the build process at any point and start over 75 | from one of the stages then it is a good idea to run the `clean_sources` script 76 | before you run the current stage to get rid of any lingering build files from 77 | the previous builds. 78 | 79 | ``` 80 | $ ./clean_sources 81 | ``` 82 | 83 | ### 1.4 Creating the root filesystem 84 | 85 | To create the root filesystem we use the `create_filesystem` script. This goes 86 | into `base/` and creates all the necessary directories for a working system. To 87 | run the script you must use `sudo` as the root user will own the contents of 88 | the directory. 89 | 90 | ``` 91 | $ sudo ./create_filesystem 92 | ``` 93 | 94 | ## 2. Building 95 | 96 | ### 2.1 Starting the toolchain build 97 | 98 | The first part to building the distro is getting the compiler toolchain up and 99 | running. We start this with the `start_toolchain_build` script. This will build 100 | the cross compiler, the files the cross compiler needs to build binaries, and 101 | the C/C++ library. It finishes off with building GCC for the system. 102 | 103 | On first run this may take a while (around 9 minutes or so on my machine) but 104 | if you use ccache repeated builds will go faster. 105 | 106 | ``` 107 | $ ./start_toolchain_build 108 | ``` 109 | 110 | ### 2.2 Cross Compiling the base system 111 | 112 | Now the system needs some utilities so it can be used to finish off the 113 | toolchain and the rest of the system, to do this we use the 114 | `cross_compile_programs` script. For simplicity sake we cross compile all of 115 | these. Anything that cannot be cross compiled gets built in the 116 | `finalise_toolchain_build` script 117 | 118 | ``` 119 | $ ./cross_compile_programs 120 | ``` 121 | 122 | ### 2.3 Entering the system via `chroot` 123 | 124 | Before we finalise the toolchain we must enter the system. Some programs like 125 | perl and libraries like libstdc++ require you to be on the actual system for 126 | compiling because they like to make your life difficult. To enter the system run: 127 | 128 | ``` 129 | $ sudo ./spider-chroot ../base 130 | ``` 131 | 132 | ### 2.4 Finalising the toolchain build 133 | 134 | The final step is to complete the GCC toolchain by building libstdc++ (again) 135 | then perl. As a reminder **This should ONLY be ran INSIDE THE CHROOT!!**. 136 | 137 | First run `cd` on its own to get into `/root`. 138 | 139 | Then we finish the process off by running: 140 | 141 | ``` 142 | $ ./finalise_toolchain_build 143 | ``` 144 | 145 | This shouldn't take very long and when it's done you should end up with a 146 | nearly fully working system! The build process is nearly done and soon we'll be 147 | able to be self-hosting but for now it's just a hosted system accessible within 148 | a chroot. 149 | -------------------------------------------------------------------------------- /documentation/arachnid.md: -------------------------------------------------------------------------------- 1 | # Package Manager 2 | 3 | ## These are rough notes I made quite a while ago. Some elements have changed in that time. 4 | 5 | --- 6 | 7 | arachnid 8 | - install - installs a package 9 | - uninstall - removes a package 10 | - search - searches for packages 11 | - local - searches locally for packages and displays their info 12 | - verbose - verbose local search output 13 | - verbose - verbose search output 14 | - tag - packages will use a tag system for more refined searches and organisation 15 | - last - get a list of the recently installed packages, their install reason and time 16 | - update - updates the system 17 | - download - downloads updates (packages) and that's it 18 | - garbage - cleans config files 19 | 20 | --- 21 | 22 | - be able to build and install packages efficiently 23 | - maybe have commands in plain english. e.g. arachnid search local bash 24 | - second word is overall operation 25 | - third word is optional suboperation but cannot be a specific list of words such as local etc 26 | 27 | - be able to look up a list of last installed packages and their install times 28 | - be able to optionally (prompt?, in the cfg?) clean config files - both in $HOME and / - on package removal 29 | - maybe need to have some sort of file tracking, maybe not 30 | 31 | - cannot have both the binary and source version of a package on the system at the same time 32 | - have a way to convert from other packing formats such as rpm, deb, pkgbuild or even nix 33 | - use something nearly equivelent to plain english for the user to be able to quickly write a build file if need be 34 | - use a tag system to be able to filter out packages 35 | - tags should be broad and not include the program name in them 36 | - have verbosity that visually makes sense on first glance 37 | - colours 38 | 39 | - have 2 repositories: one for source and one for compiled binaries, make them as identical as possible 40 | - give the user the option to compile from source for greater control over the software or to use a precompiled binary for speed. 41 | - source would be meant more for people who either want control or have the power to compile and binaries would be made for people with slower hardware but the choice is there for the user anyway 42 | - have a git repo for the bleeding edge packages 43 | - every now and then the main cached package repo - that the package manager would normally get the packages from - will update to the latest commit that day. think of it like a nightly release of the git repo. 44 | 45 | -------------------------------------------------------------------------------- /documentation/notes.md: -------------------------------------------------------------------------------- 1 | # Spider Linux 2 | 3 | ### General Idea 4 | 5 | - choice of what you want to run 6 | - binary+source system 7 | - fast 8 | - minimal and light install 9 | - not minimal as in the meme, minimal as in the unix philosophy in a way (programs should do one/a couple thing(s) and do it/them really well) 10 | 11 | ### Init System 12 | 13 | - have an option to select the init system in the install file so that changing it over afterwards isn't too difficult 14 | - letting the user change init after install could also done 15 | - be able to use any that the user desires 16 | 17 | ### Kernel 18 | 19 | - be able to use any linux kernel 20 | - give the user the option to compile their own kernel if they wish or use a stock kernel 21 | 22 | ### Install System 23 | 24 | - configure drives, file-systems and networking then download the base system from a tar.xz (most likely) which will contain basic 25 | system tools to get the user off the ground such as a basic init system with the basic coreutils etc. 26 | - from here the user would create an install file which will look something like a build file for packages and configure the system to-be from within that file 27 | -------------------------------------------------------------------------------- /documentation/package_management_system.md: -------------------------------------------------------------------------------- 1 | ## Package Management System 2 | 3 | The package management system uses our package manager, `arachnid`. As 4 | previously mentioned, the goal is to have 1:1 compatibility for installing the 5 | source/pre-compiled binary version of a package. Reasons for possibly wanting 6 | to do this could be that you want to have a specific system with specific 7 | features, or you want to do that and not have to bother with compiling some 8 | programs, or you want to use a pre-compiled binary system but still have low 9 | level (i.e. core utilities, kernel, maybe even init in the future) control over 10 | how your system runs. 11 | 12 | The build file will be a Python file - which will use `libarachnid` in the 13 | future - that tells the package manager how to build the package. The actual 14 | package that gets installed, whether it has been compiled locally or not, will 15 | be a tarball most likely with either ZSTD or XZ compression. 16 | 17 | In order to accomplish this we need to have a system that can hold a build file 18 | and a tarball containing what was built from the build file (the point of doing 19 | this is to maximise compatibility). The package repository will likely be a Git 20 | repository separated into directories with the package name and version as 21 | their title. Inside the directory will be a Python file with the build 22 | instructions as mentioned above, a tarball and potentially a JSON file 23 | describing the package. Users are free to submit packages in the form of a pull 24 | request if the package has already been built, tested and is in the tarball 25 | format. At somewhat regular intervals, a server will create a cached snapshot 26 | of the Git repository and that will be where the package manager will retrieve 27 | the packages from whether that is source or pre-compiled binary format. 28 | 29 | See my rough notes for arachnid, from a while ago, in 30 | [documentation/arachnid.md](documentation/arachnid.md). 31 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | # Spider Linux Build Scripts 2 | 3 | This is the scripts that builds the system from source. We'll use these for now 4 | until we have a package manager that can just install the packages. You 5 | probably shouldn't run any of these unless you're familiar with bash as there 6 | are some things which are still hardcoded which makes using them tedious if you 7 | don't have the same system as me :). 8 | 9 | ## Nomenclature 10 | 11 | - **sources**: tarballs with source code in them. 12 | - **build-critical variables**: variables such as PATH, TARGET_TRIPLET etc. 13 | 14 | Here's what a full build roughly looks like: 15 | 16 | ``` 17 | get_sources --> create_filesystem --> start_toolchain_build --> cross_compile_programs --> spider-chroot --> finalise_toolchain_build 18 | ``` 19 | 20 | ## Sources Directory 21 | 22 | The `sources/` directory holds all of the source code needed to be compiled to 23 | create the system. There are a few scripts that manage this directory for you, 24 | namely `clean_sources` and `get_sources`, which clean up the program-specific 25 | directories and get the sources from their repositories respectively. For now 26 | it is a good idea to create this directory within the `scripts/` directory as 27 | we do not have an automated way to do that yet. I could add it in but I haven't 28 | got around to it. 29 | 30 | ## Helper Scripts 31 | 32 | ### env_vars_etc 33 | 34 | The `env_vars_etc` script contains various build-critical variables and functions 35 | to make the experience a lot easier to write and perform. It gets sourced at 36 | the start of every script. Variables defined here are things such as, but not 37 | limited to: 38 | 39 | - CFLAGS/CXXFLAGS 40 | - JOBS (make -jN) 41 | - path to base directory 42 | - path to sources directory 43 | 44 | ### varcheck 45 | 46 | The `varcheck` script checks to see if system variables have been set. It is 47 | somewhat obsolete now because we use `env_vars_etc` which sets the build-critical 48 | variables for us. 49 | 50 | ### get_sources 51 | 52 | The `get_sources` script grabs all of the needed sources to build the system 53 | from their respective code repositories. It also decompresses them into the 54 | `sources/` directory once it has downloaded them. 55 | 56 | ### clean_sources 57 | 58 | The `clean_sources` script will go through the `sources/` directory, remove all 59 | the program-specific directories, then untar the existing tarballs thus 60 | emulating a clean build. 61 | 62 | ### hard_clean 63 | 64 | The `hard_clean` script will clean both the `sources/` directory and will 65 | remove the `toolchain/` directory. 66 | 67 | ## Build Scripts 68 | 69 | ### create_filesystem 70 | 71 | The `create_filesystem` script goes into the `base/` directory and creates a 72 | filesystem which will eventually become the root (`/`) filesystem of the 73 | distro. It creates various directories such as `/usr`, `/root` and `/dev` to 74 | name a few, 75 | 76 | ### start_toolchain_build 77 | 78 | The `start_toolchain_build` script will build the GCC toolchain using binutils, 79 | gcc/libstdc++, glibc and kernel headers. This is the first important step in 80 | building programs for the system. 81 | 82 | ### cross_compile_programs 83 | 84 | The `cross_compile_programs` script will cross-compile programs for the system. 85 | These programs will then be used to finalise the system. 86 | 87 | ### spider-chroot 88 | 89 | The `spider-chroot` script will mount the required virtual filesystems in 90 | `/sys`, `/dev` and `/proc` then `chroot` into the root filesystem in `base/`. 91 | 92 | ### finalise_toolchain_build 93 | 94 | The `finalise_toolchain_build` script builds the final programs for the system. 95 | -------------------------------------------------------------------------------- /scripts/clean_sources: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source env_vars_etc 4 | 5 | run cd $SOURCES_DIR 6 | run sudo rm -rf ./*/ 7 | for archive in *.tar.*; do 8 | run tar xf "$archive" 9 | done 10 | -------------------------------------------------------------------------------- /scripts/create_filesystem: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source env_vars_etc 4 | 5 | run cd $SPIDER_ROOT && run sudo rm -rf * 6 | 7 | mkdir -pv {boot,home,mnt,opt,srv} \ 8 | {etc,var} \ 9 | etc/{opt,sysconfig} \ 10 | usr/{bin,lib} \ 11 | usr/lib/firmware \ 12 | usr/{,local/}{include,src} \ 13 | usr/local/{bin,lib} \ 14 | usr/{,local/}share/{color,dict,doc,info,locale,man} \ 15 | usr/{,local/}share/{misc,terminfo,zoneinfo} \ 16 | usr/{,local/}share/man/man{1..8} \ 17 | var/{cache,local,log,mail,opt,spool} \ 18 | var/lib/{color,misc,locate} \ 19 | {dev,proc,sys,run} \ 20 | toolchain 21 | 22 | # spider linux supports the /usr merge 23 | ln -sfv usr/bin sbin # sbin -> usr/bin 24 | ln -sfv usr/bin bin # bin -> usr/bin 25 | ln -sfv usr/lib lib # lib -> usr/lib 26 | ln -sfv usr/lib lib64 # lib64 -> usr/lib 27 | ln -sfv bin usr/sbin # usr/sbin -> usr/bin 28 | ln -sfv lib usr/lib64 # usr/lib64 -> usr/lib 29 | 30 | ln -sfv run var/run 31 | ln -sfv run/lock var/lock 32 | 33 | install -dv -m 0750 root 34 | install -dv -m 1777 tmp var/tmp 35 | 36 | touch etc/hostname 37 | 38 | cat > etc/passwd << EOF 39 | root::0:0:root:/root:/bin/bash 40 | EOF 41 | 42 | cat > etc/group << "EOF" 43 | root:x:0: 44 | bin:x:1: 45 | sys:x:2: 46 | kmem:x:3: 47 | tty:x:4: 48 | daemon:x:6: 49 | disk:x:8: 50 | dialout:x:10: 51 | video:x:12: 52 | utmp:x:13: 53 | usb:x:14: 54 | EOF 55 | 56 | cat > etc/fstab << "EOF" 57 | rootfs / auto defaults 1 1 58 | proc /proc proc defaults 0 0 59 | sysfs /sys sysfs defaults 0 0 60 | devpts /dev/pts devpts gid=4,mode=620 0 0 61 | tmpfs /dev/shm tmpfs defaults 0 0 62 | EOF 63 | 64 | cat > etc/profile << "EOF" 65 | export PATH=/bin:/usr/bin 66 | 67 | if [ `id -u` -eq 0 ] ; then 68 | PATH=/bin:/sbin:/usr/bin:/usr/sbin 69 | unset HISTFILE 70 | fi 71 | 72 | # Set up some environment variables. 73 | export USER=`id -un` 74 | export LOGNAME=$USER 75 | export HOSTNAME=`/bin/hostname` 76 | export HISTSIZE=1000 77 | export HISTFILESIZE=1000 78 | export PAGER='/bin/more ' 79 | export EDITOR='/bin/vi' 80 | EOF 81 | 82 | cat > etc/issue << "EOF" 83 | Spider Linux $(date +'%F') 84 | Kernel \r on an \m 85 | 86 | EOF 87 | 88 | cat > etc/inittab << "EOF" 89 | ::sysinit:/etc/rc.d/startup 90 | 91 | tty1::respawn:/sbin/getty 38400 tty1 92 | tty2::respawn:/sbin/getty 38400 tty2 93 | tty3::respawn:/sbin/getty 38400 tty3 94 | tty4::respawn:/sbin/getty 38400 tty4 95 | tty5::respawn:/sbin/getty 38400 tty5 96 | tty6::respawn:/sbin/getty 38400 tty6 97 | 98 | ::shutdown:/etc/rc.d/shutdown 99 | ::ctrlaltdel:/sbin/reboot 100 | EOF 101 | 102 | cat > etc/mdev.conf << "EOF" 103 | # Devices: 104 | # Syntax: %s %d:%d %s 105 | # devices user:group mode 106 | 107 | # null does already exist; therefore ownership has to 108 | # be changed with command 109 | null root:root 0666 @chmod 666 $MDEV 110 | zero root:root 0666 111 | grsec root:root 0660 112 | full root:root 0666 113 | 114 | random root:root 0666 115 | urandom root:root 0444 116 | hwrandom root:root 0660 117 | 118 | # console does already exist; therefore ownership has to 119 | # be changed with command 120 | console root:tty 0600 @mkdir -pm 755 fd && cd fd && for x in 0 1 2 3 ; do ln -sf /proc/self/fd/$x $x; done 121 | 122 | kmem root:root 0640 123 | mem root:root 0640 124 | port root:root 0640 125 | ptmx root:tty 0666 126 | 127 | # ram.* 128 | ram([0-9]*) root:disk 0660 >rd/%1 129 | loop([0-9]+) root:disk 0660 >loop/%1 130 | sd[a-z].* root:disk 0660 */lib/mdev/usbdisk_link 131 | hd[a-z][0-9]* root:disk 0660 */lib/mdev/ide_links 132 | 133 | tty root:tty 0666 134 | tty[0-9] root:root 0600 135 | tty[0-9][0-9] root:tty 0660 136 | ttyO[0-9]* root:tty 0660 137 | pty.* root:tty 0660 138 | vcs[0-9]* root:tty 0660 139 | vcsa[0-9]* root:tty 0660 140 | 141 | ttyLTM[0-9] root:dialout 0660 @ln -sf $MDEV modem 142 | ttySHSF[0-9] root:dialout 0660 @ln -sf $MDEV modem 143 | slamr root:dialout 0660 @ln -sf $MDEV slamr0 144 | slusb root:dialout 0660 @ln -sf $MDEV slusb0 145 | fuse root:root 0666 146 | 147 | # misc stuff 148 | agpgart root:root 0660 >misc/ 149 | psaux root:root 0660 >misc/ 150 | rtc root:root 0664 >misc/ 151 | 152 | # input stuff 153 | event[0-9]+ root:root 0640 =input/ 154 | ts[0-9] root:root 0600 =input/ 155 | 156 | # v4l stuff 157 | vbi[0-9] root:video 0660 >v4l/ 158 | video[0-9] root:video 0660 >v4l/ 159 | 160 | # load drivers for usb devices 161 | usbdev[0-9].[0-9] root:root 0660 */lib/mdev/usbdev 162 | usbdev[0-9].[0-9]_.* root:root 0660 163 | EOF 164 | 165 | cat > etc/os-release << EOF 166 | NAME="Spider Linux" 167 | PRETTY_NAME="Spider Linux" 168 | ID=spider 169 | BUILD_ID=rolling 170 | EOF 171 | 172 | -------------------------------------------------------------------------------- /scripts/cross_compile_programs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source env_vars_etc 4 | 5 | ## CROSS COMPILING BASIC SYSTEM TOOLS 6 | 7 | ### make 8 | 9 | goto_sources make 10 | 11 | ./configure $COMMON_CROSS_ARGS --without-guile 12 | 13 | make_install_destdir $SPIDER_ROOT 14 | 15 | ### coreutils 16 | 17 | goto_sources coreutils 18 | 19 | ./configure $COMMON_CROSS_ARGS \ 20 | --enable-install-program=hostname \ 21 | --enable-no-install-program=kill,uptime 22 | 23 | make_install_destdir $SPIDER_ROOT 24 | 25 | ### m4 26 | 27 | goto_sources m4 28 | 29 | ./configure $COMMON_CROSS_ARGS 30 | make_install_destdir $SPIDER_ROOT 31 | 32 | ### ncurses 33 | 34 | goto_sources ncurses 35 | 36 | sed -i s/mawk// configure 37 | 38 | sudo rm -rf build 39 | mkdir build 40 | pushd build 41 | ../configure 42 | make -C include 43 | make -C progs tic 44 | popd 45 | 46 | ./configure $COMMON_CROSS_ARGS \ 47 | --mandir=/usr/share/man \ 48 | --with-manpage-format=normal \ 49 | --with-shared \ 50 | --without-debug \ 51 | --without-ada \ 52 | --without-normal \ 53 | --disable-stripping \ 54 | --enable-widec 55 | 56 | make $JOBS 57 | sudo make DESTDIR=$SPIDER_ROOT TIC_PATH=$(pwd)/build/progs/tic install 58 | sudo bash -c "echo \"INPUT(-lncursesw)\" > $SPIDER_ROOT/usr/lib/libncurses.so" 59 | 60 | ### bash 61 | 62 | goto_sources bash 63 | 64 | ./configure $COMMON_CROSS_ARGS \ 65 | --without-bash-malloc 66 | 67 | make_install_destdir $SPIDER_ROOT 68 | sudo ln -sfv bash $SPIDER_ROOT/bin/sh 69 | 70 | ### sed 71 | 72 | goto_sources sed 73 | 74 | ./configure $COMMON_CROSS_ARGS 75 | make_install_destdir $SPIDER_ROOT 76 | 77 | ### grep 78 | 79 | goto_sources grep 80 | 81 | ./configure $COMMON_CROSS_ARGS 82 | make_install_destdir $SPIDER_ROOT 83 | 84 | ### gawk 85 | 86 | goto_sources gawk 87 | 88 | sed -i 's/extras//' Makefile.in 89 | 90 | ./configure $COMMON_CROSS_ARGS 91 | make_install_destdir $SPIDER_ROOT 92 | 93 | ### bison 94 | 95 | goto_sources bison 96 | 97 | ./configure $COMMON_CROSS_ARGS 98 | make_install_destdir $SPIDER_ROOT 99 | 100 | ### autoconf 101 | 102 | goto_sources autoconf 103 | 104 | ./configure $COMMON_CROSS_ARGS 105 | make_install_destdir $SPIDER_ROOT 106 | 107 | ### autoconf 108 | 109 | goto_sources automake 110 | 111 | ./configure $COMMON_CROSS_ARGS 112 | make_install_destdir $SPIDER_ROOT 113 | 114 | ### tar 115 | 116 | goto_sources tar 117 | 118 | ./configure $COMMON_CROSS_ARGS 119 | make_install_destdir $SPIDER_ROOT 120 | 121 | ### findutils 122 | 123 | goto_sources findutils 124 | 125 | ./configure $COMMON_CROSS_ARGS 126 | make_install_destdir $SPIDER_ROOT 127 | 128 | ### nano 129 | 130 | goto_sources nano 131 | 132 | ./configure $COMMON_CROSS_ARGS 133 | make_install_destdir $SPIDER_ROOT 134 | 135 | ### gzip 136 | 137 | goto_sources gzip 138 | 139 | ./configure $COMMON_CROSS_ARGS 140 | make_install_destdir $SPIDER_ROOT 141 | 142 | ### xz 143 | 144 | goto_sources xz 145 | 146 | ./autogen.sh || : 147 | ./configure $COMMON_CROSS_ARGS 148 | make_install_destdir $SPIDER_ROOT 149 | 150 | ### grub 151 | 152 | goto_sources grub 153 | 154 | ./configure $COMMON_CROSS_ARGS \ 155 | --sysconfdir=/etc \ 156 | --disable-efiemu \ 157 | --disable-werror 158 | 159 | make_install_destdir $SPIDER_ROOT 160 | 161 | ### python 162 | 163 | goto_sources python 164 | 165 | cat > config.site << EOF 166 | ac_cv_file__dev_ptmx=no 167 | ac_cv_file__dev_ptc=no 168 | EOF 169 | 170 | CONFIG_SITE=config.site \ 171 | ./configure $COMMON_CROSS_ARGS --disable-ipv6 172 | make_install_destdir $SPIDER_ROOT 173 | 174 | cd $SOURCES_DIR/.. 175 | sudo cp -v finalise_toolchain_build ../base/root/ 176 | sudo cp -vr sources/{gcc,gmp,mpc,mpfr}-*.tar.* ../base/root/ 177 | sudo cp -vr sources/perl-*.tar.* ../base/root/ 178 | -------------------------------------------------------------------------------- /scripts/env_vars_etc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -o pipefail 5 | 6 | BASE_DIR=/home/sean/files/docs/projects/spiderlinux 7 | SOURCES_DIR=$BASE_DIR/scripts/sources 8 | SPIDER_ROOT=$BASE_DIR/base 9 | TARGET_TRIPLET=x86_64-spider-linux-gnu 10 | BUILD_TRIPLET=x86_64-pc-linux-gnu 11 | 12 | export PATH="/usr/lib/ccache/bin:$SPIDER_ROOT/toolchain/bin:$PATH" 13 | 14 | # Usually you shouldn't set compiler optimisation flags but these 15 | # should be considered safe as per the Gentoo Wiki (https://wiki.gentoo.org/wiki/Safe_CFLAGS) 16 | COMMON_FLAGS="-march=native -O2 -pipe" 17 | export CFLAGS="${COMMON_FLAGS}" 18 | export CXXFLAGS="${COMMON_FLAGS}" 19 | JOBS="-j$(nproc)" # total number of cores 20 | 21 | COMMON_CROSS_ARGS="--prefix=/usr --host=$TARGET_TRIPLET --build=$BUILD_TRIPLET" 22 | 23 | run() { 24 | printf '\033[35;1m=>\033[0m \033[1m%s\033[0m\n' "$*" 25 | "$@" || return "${_ret:=0}" 26 | } 27 | 28 | # Wrapper around the usual find and cd we used to do 29 | get_source_path(){ echo $(find "$SOURCES_DIR" -maxdepth 1 -iname "$1*" -type d) ;} 30 | goto_sources(){ run cd "$(get_source_path "$1")" ;} 31 | 32 | make_build_dir(){ 33 | if [[ -d "build" ]]; then 34 | run sudo rm -rf build/ 35 | run mkdir build/ 36 | run cd build/ 37 | else 38 | run mkdir build/ 39 | run cd build/ 40 | fi 41 | } 42 | 43 | # Only really useful for gcc but DRY (https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) 44 | create_gcc_dep_dirs(){ 45 | run sudo rm -rf mpfr gmp mpc 2>/dev/null 46 | run sudo tar -xf ../mpfr-*.tar.xz && run mv -v mpfr-*/ mpfr 47 | run sudo tar -xf ../gmp-*.tar.xz && run mv -v gmp-*/ gmp 48 | run sudo tar -xf ../mpc-*.tar.gz && run mv -v mpc-*/ mpc 49 | } 50 | 51 | make_install(){ 52 | run sudo make $JOBS 53 | run sudo make install $JOBS 54 | } 55 | make_install_destdir(){ 56 | run sudo make $JOBS 57 | run sudo make DESTDIR=$1 install $JOBS 58 | } 59 | -------------------------------------------------------------------------------- /scripts/finalise_toolchain_build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/sh 2 | 3 | #===================================================================== 4 | # This script implies that the sources needed to build 5 | # the GCC toolchain are already downloaded and untarred. You 6 | # should build the dependencies to make the cross compiler with 7 | # your system compiler. 8 | #===================================================================== 9 | 10 | # Terminology: 11 | # prefix: the toplevel installation directory 12 | # sysroot: tells gcc "dir" will be the root in the filesystem of the target operating system. seems to be used for the second pass compiler that will run on the target system. 13 | # host: the system where you want to run the resulting compiler (normally the build machine) 14 | # build: the system which you are using 15 | # target: the system for which you want the compiler to generate code 16 | 17 | SOURCES_DIR=/root 18 | HOST_TRIPLET=x86_64-spider-linux-gnu 19 | 20 | JOBS="-j$(nproc)" # total number of cores 21 | 22 | # Wrapper around the usual fd and cd we used to do 23 | get_source_path(){ echo $(find "$SOURCES_DIR" -maxdepth 1 -name "$1*" -type d) ;} 24 | goto_sources(){ cd "$(get_source_path "$1")" ;} 25 | 26 | make_build_dir(){ 27 | if [[ -d "build" ]]; then 28 | sudo rm -rf build 29 | mkdir -p build 30 | cd build 31 | else 32 | mkdir -p build 33 | cd build 34 | fi 35 | } 36 | 37 | # Only really useful for gcc but DRY (https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) 38 | create_gcc_dep_dirs(){ 39 | sudo rm -rf mpfr gmp mpc 2>/dev/null 40 | tar -xf ../mpfr-4.1.0.tar.xz && mv -v mpfr-4.1.0 mpfr 41 | tar -xf ../gmp-6.2.1.tar.xz && mv -v gmp-6.2.1 gmp 42 | tar -xf ../mpc-1.2.1.tar.gz && mv -v mpc-1.2.1 mpc 43 | } 44 | 45 | #=============================================================================================== 46 | 47 | tar xf gcc-*.tar.* 48 | tar xf perl-*.tar.* 49 | 50 | # libstdc++ 2 51 | 52 | goto_sources gcc 53 | 54 | ln -sf gthr-posix.h libgcc/gthr-default.h 55 | 56 | create_gcc_dep_dirs 57 | 58 | make_build_dir 59 | 60 | ../libstdc++-v3/configure \ 61 | CXXFLAGS="-g -O2 -D_GNU_SOURCE" \ 62 | --prefix=/usr \ 63 | --disable-multilib \ 64 | --disable-nls \ 65 | --host=$HOST_TRIPLET \ 66 | --disable-libstdcxx-pch 67 | 68 | make $JOBS 69 | make install $JOBS 70 | 71 | ### perl 72 | 73 | goto_sources perl 74 | 75 | sh Configure \ 76 | -des \ 77 | -Dprefix=/usr \ 78 | -Dvendorprefix=/usr \ 79 | -Dprivlib=/usr/lib/perl5/5.34/core_perl \ 80 | -Darchlib=/usr/lib/perl5/5.34/core_perl \ 81 | -Dsitelib=/usr/lib/perl5/5.34/site_perl \ 82 | -Dsitearch=/usr/lib/perl5/5.34/site_perl \ 83 | -Dvendorlib=/usr/lib/perl5/5.34/vendor_perl \ 84 | -Dvendorarch=/usr/lib/perl5/5.34/vendor_perl 85 | 86 | make $JOBS 87 | make install $JOBS 88 | 89 | -------------------------------------------------------------------------------- /scripts/get_sources: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source env_vars_etc 4 | 5 | echo "==> Cleaning sources..." 6 | run cd $SOURCES_DIR 7 | run sudo rm -rf * 8 | 9 | linux_ver=5.15.41 10 | linux_maj_ver=${linux_ver/.*/} 11 | grub_ver=2.06 12 | make_ver=4.3 13 | zlib_ver=1.2.11 14 | perl_ver=5.34.0 15 | perl_maj_ver=${perl_ver/.*/} 16 | ncurses_ver=6.3 17 | flex_ver=2.6.4 18 | bison_ver=3.8.2 19 | m4_ver=latest 20 | gzip_ver=1.11 21 | libelf_ver=latest 22 | bzip_ver=latest 23 | coreutils_ver=9.0 24 | bash_ver=5.1.8 25 | sed_ver=4.8 26 | grep_ver=3.7 27 | gawk_ver=5.1.1 28 | find_ver=4.9.0 29 | tar_ver=latest 30 | autoconf_ver=latest 31 | automake_ver=1.16.5 32 | nano_ver=6.2 33 | nano_maj_ver=${nano_ver/.*/} 34 | xz_ver=5.2.5 35 | python_ver=3.10.4 36 | openrc_ver=0.44.10 37 | 38 | declare -A sources 39 | 40 | sources[bison_url]="https://ftp.gnu.org/gnu/bison/bison-$bison_ver.tar.xz" 41 | sources[bzip_url]="https://sourceware.org/pub/bzip2/bzip2-$bzip_ver.tar.gz" 42 | sources[flex_url]="https://github.com/westes/flex/files/981163/flex-$flex_ver.tar.gz" 43 | sources[gzip_url]="https://ftp.gnu.org/gnu/gzip/gzip-$gzip_ver.tar.xz" 44 | sources[libelf_url]="https://sourceware.org/elfutils/ftp/elfutils-$libelf_ver.tar.bz2" 45 | sources[linux_url]="https://cdn.kernel.org/pub/linux/kernel/v$linux_maj_ver.x/linux-$linux_ver.tar.xz" 46 | sources[ncurses_url]="https://ftp.gnu.org/gnu/ncurses/ncurses-$ncurses_ver.tar.gz" 47 | sources[perl_url]="https://www.cpan.org/src/$perl_maj_ver.0/perl-$perl_ver.tar.gz" 48 | sources[zlib_url]="https://zlib.net/fossils/zlib-$zlib_ver.tar.gz" 49 | sources[bash_url]="https://ftp.gnu.org/gnu/bash/bash-$bash_ver.tar.gz" 50 | sources[coreutils_url]="https://ftp.gnu.org/gnu/coreutils/coreutils-$coreutils_ver.tar.xz" 51 | sources[grep_url]="https://ftp.gnu.org/gnu/grep/grep-$grep_ver.tar.xz" 52 | sources[grub_url]="https://ftp.gnu.org/gnu/grub/grub-$grub_ver.tar.xz" 53 | sources[m4_url]="https://ftp.gnu.org/gnu/m4/m4-$m4_ver.tar.xz" 54 | sources[make_url]="https://ftp.gnu.org/gnu/make/make-$make_ver.tar.gz" 55 | sources[sed_url]="https://ftp.gnu.org/gnu/sed/sed-$sed_ver.tar.xz" 56 | sources[gawk_url]="https://ftp.gnu.org/gnu/gawk/gawk-$gawk_ver.tar.xz" 57 | sources[find_url]="https://ftp.gnu.org/gnu/findutils/findutils-$find_ver.tar.xz" 58 | sources[tar_url]="https://ftp.gnu.org/gnu/tar/tar-$tar_ver.tar.xz" 59 | sources[autoconf_url]="https://ftp.gnu.org/gnu/autoconf/autoconf-$autoconf_ver.tar.xz" 60 | sources[automake_url]="https://ftp.gnu.org/gnu/automake/automake-$automake_ver.tar.xz" 61 | sources[python_url]="https://www.python.org/ftp/python/$python_ver/Python-$python_ver.tar.xz" 62 | sources[nano_url]="https://www.nano-editor.org/dist/v$nano_maj_ver/nano-$nano_ver.tar.xz" 63 | sources[xz_url]="https://github.com/xz-mirror/xz/archive/refs/tags/v$xz_ver.tar.gz" 64 | sources[openrc_url]="https://github.com/OpenRC/openrc/archive/refs/tags/$openrc_ver.tar.gz" 65 | 66 | git clone https://github.com/firasuke/mussel 67 | 68 | echo "==> Downloading sources..." 69 | for url in "${sources[@]}"; do 70 | run curl -L -O "$url" 71 | done 72 | 73 | echo "==> Extracting sources..." 74 | for i in *.tar.*; do 75 | run tar xf "$i" 76 | done 77 | -------------------------------------------------------------------------------- /scripts/hard_clean: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | BASE_DIR=/home/sean/files/docs/projects/spiderlinux 4 | CROSS_FILES=$BASE_DIR/cross 5 | SOURCES_DIR=$CROSS_FILES/sources 6 | 7 | run() { 8 | printf '%s\n' "$*" 9 | "$@" || return "${_ret:=0}" 10 | } 11 | 12 | run cd $CROSS_FILES 13 | run sudo rm -rf {toolchain,sysroot} 14 | run mkdir -p {toolchain,sysroot} 15 | run cd $SOURCES_DIR 16 | run sudo rm -rf {binutils*,gcc*,glibc*,busybox*,grub*}/ 17 | run tar xf binutils* 18 | run tar xf gcc* 19 | run tar xf glibc* 20 | run tar xf busybox* 21 | run tar xf grub* 22 | run tar xf linux*.tar.xz 23 | -------------------------------------------------------------------------------- /scripts/patches/01-spider-linux-directories.patch: -------------------------------------------------------------------------------- 1 | :100755 100755 ff28f3f 0000000 M mussel.sh 2 | 3 | diff --git a/mussel.sh b/mussel.sh 4 | index ff28f3f..d1eb94e 100755 5 | --- a/mussel.sh 6 | +++ b/mussel.sh 7 | @@ -62,16 +62,16 @@ musl_sum=9332f713d3eb7de4369bc0327d99252275ee52abf523ee34b894b24a387f67579787f7c 8 | pkgconf_sum=58204006408ad5ce91222ed3c93c2e0b61c04fa83c0a8ad337b747b583744578dbebd4ad5ccbc577689637caa1c5dc246b7795ac46e39c6666b1aa78199b7c28 9 | 10 | # ----- Development Directories ----- # 11 | -CURDIR="$PWD" 12 | -SRCDIR="$CURDIR/sources" 13 | -BLDDIR="$CURDIR/builds" 14 | -PCHDIR="$CURDIR/patches" 15 | +MUSSELDIR="$PWD" 16 | +SRCDIR="$MUSSELDIR/sources" 17 | +BLDDIR="$MUSSELDIR/builds" 18 | +PCHDIR="$MUSSELDIR/patches" 19 | 20 | -MPREFIX="$CURDIR/toolchain" 21 | -MSYSROOT="$CURDIR/sysroot" 22 | +MPREFIX="../../../base/toolchain" 23 | +MSYSROOT="../../../base" 24 | 25 | # ----- mussel Log File ---- # 26 | -MLOG="$CURDIR/log.txt" 27 | +MLOG="$MUSSELDIR/log.txt" 28 | 29 | # ----- PATH ----- # 30 | # 31 | @@ -84,142 +84,6 @@ CXXFLAGS=-O2 32 | # ----- mussel Flags ----- # 33 | while [ $# -gt 0 ]; do 34 | case $1 in 35 | - aarch64 | arm64 | armv8-a) 36 | - XARCH=aarch64 37 | - LARCH=arm64 38 | - MARCH=$XARCH 39 | - XGCCARGS="--with-arch=armv8-a --with-abi=lp64 --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419" 40 | - XPURE64=$XARCH 41 | - XTARGET=$XARCH-linux-musl 42 | - ;; 43 | - arm | armv6zk | bcm2835) 44 | - XARCH=armv6zk 45 | - LARCH=arm 46 | - MARCH=$LARCH 47 | - XGCCARGS="--with-arch=$XARCH --with-tune=arm1176jzf-s --with-abi=aapcs-linux --with-fpu=vfp --with-float=hard" 48 | - XPURE64="" 49 | - XTARGET=$XARCH-linux-musleabihf 50 | - ;; 51 | - armv7) 52 | - XARCH=$1 53 | - LARCH=arm 54 | - MARCH=$LARCH 55 | - XGCCARGS="--with-arch=${LARCH}v7-a --with-fpu=vfpv3 --with-float=hard" 56 | - XPURE64="" 57 | - XTARGET=$LARCH-linux-musleabihf 58 | - ;; 59 | - i586) 60 | - XARCH=$1 61 | - LARCH=i386 62 | - MARCH=$LARCH 63 | - XGCCARGS="--with-arch=$1 --with-tune=generic" 64 | - XPURE64="" 65 | - XTARGET=$1-linux-musl 66 | - ;; 67 | - i386 | i686 | x86) 68 | - XARCH=i686 69 | - LARCH=i386 70 | - MARCH=$LARCH 71 | - XGCCARGS="--with-arch=$XARCH --with-tune=generic" 72 | - XPURE64="" 73 | - XTARGET=$XARCH-linux-musl 74 | - ;; 75 | - mblaze | microblaze | microblazebe | microblazeeb) 76 | - XARCH=microblaze 77 | - LARCH=$XARCH 78 | - MARCH=$XARCH 79 | - XGCCARGS="--with-endian=big" 80 | - XPURE64="" 81 | - XTARGET=$XARCH-linux-musl 82 | - ;; 83 | - microblazeel | microblazele) 84 | - XARCH=microblazeel 85 | - LARCH=microblaze 86 | - MARCH=$LARCH 87 | - XGCCARGS="--with-endian=little" 88 | - XPURE64="" 89 | - XTARGET=$XARCH-linux-musl 90 | - ;; 91 | - mips | mips64 | mips64be | mips64eb | mips64r2) 92 | - XARCH=mips64 93 | - LARCH=mips 94 | - MARCH=$XARCH 95 | - XGCCARGS="--with-endian=big --with-arch=${XARCH}r2 --with-abi=64 --with-float=hard" 96 | - XPURE64=$XARCH 97 | - XTARGET=$XARCH-linux-musl 98 | - ;; 99 | - loongson | loongson3 | mips64el | mips64le | mips64elr2 | mips64r2el) 100 | - XARCH=mips64el 101 | - LARCH=mips 102 | - MARCH=${LARCH}64 103 | - XGCCARGS="--with-endian=little --with-arch=${MARCH}r2 --with-abi=64 --with-float=hard" 104 | - XPURE64=$MARCH 105 | - XTARGET=$XARCH-linux-musl 106 | - ;; 107 | - mips64r6 | mipsisa64r6) 108 | - XARCH=mipsisa64r6 109 | - LARCH=mips 110 | - MARCH=${LARCH}64 111 | - XGCCARGS="--with-endian=big --with-arch=${MARCH}r6 --with-abi=64 --with-float=hard --with-nan=2008" 112 | - XPURE64=$MARCH 113 | - XTARGET=$XARCH-linux-musl 114 | - ;; 115 | - mips64r6el | mips64r6le | mipsisa64r6el) 116 | - XARCH=mipsisa64r6el 117 | - LARCH=mips 118 | - MARCH=${LARCH}64 119 | - XGCCARGS="--with-endian=little --with-arch=${MARCH}r6 --with-abi=64 --with-float=hard --with-nan=2008" 120 | - XPURE64=$MARCH 121 | - XTARGET=$XARCH-linux-musl 122 | - ;; 123 | - openrisc | or1k | or1ksim) 124 | - XARCH=or1k 125 | - LARCH=openrisc 126 | - MARCH=$XARCH 127 | - XGCCARGS="" 128 | - XPURE64="" 129 | - XTARGET=$XARCH-linux-musl 130 | - ;; 131 | - pmac32 | powerpc | ppc) 132 | - XARCH=powerpc 133 | - LARCH=$XARCH 134 | - MARCH=$XARCH 135 | - XGCCARGS="--with-cpu=$XARCH --enable-secureplt --without-long-double-128" 136 | - XPURE64="" 137 | - XTARGET=$XARCH-linux-musl 138 | - ;; 139 | - g5 | powerpc64 | powerpc64be | powerpc64eb | ppc64 | ppc64be | ppc64eb) 140 | - XARCH=powerpc64 141 | - LARCH=powerpc 142 | - MARCH=$XARCH 143 | - XGCCARGS="--with-cpu=$XARCH --with-abi=elfv2" 144 | - XPURE64=$XARCH 145 | - XTARGET=$XARCH-linux-musl 146 | - ;; 147 | - powernv | powerpc64le | ppc64le) 148 | - XARCH=powerpc64le 149 | - LARCH=powerpc 150 | - MARCH=${LARCH}64 151 | - XGCCARGS="--with-cpu=$XARCH --with-abi=elfv2" 152 | - XPURE64=$MARCH 153 | - XTARGET=$XARCH-linux-musl 154 | - ;; 155 | - riscv | riscv64 | rv64imafdc) 156 | - XARCH=riscv64 157 | - LARCH=riscv 158 | - MARCH=$XARCH 159 | - XGCCARGS="--with-arch=rv64imafdc --with-tune=rocket --with-abi=lp64d" 160 | - XPURE64=$XARCH 161 | - XTARGET=$XARCH-linux-musl 162 | - ;; 163 | - s390 | s390x | z15 | z196) 164 | - XARCH=s390x 165 | - LARCH=s390 166 | - MARCH=$XARCH 167 | - XGCCARGS="--with-arch=z196 --with-tune=z15 --with-long-double-128" 168 | - XPURE64=$XARCH 169 | - XTARGET=$XARCH-linux-musl 170 | - ;; 171 | x86-64 | x86_64) 172 | XARCH=x86-64 173 | LARCH=x86_64 174 | @@ -376,10 +240,10 @@ mpatch() { 175 | 176 | # ----- mclean(): Clean Directory ----- # 177 | mclean() { 178 | - if [ -d "$CURDIR/$1" ]; then 179 | + if [ -d "$MUSSELDIR/$1" ]; then 180 | printf -- "${BLUEC}..${NORMALC} Cleaning $1 directory...\n" 181 | - rm -fr "$CURDIR/$1" 182 | - mkdir "$CURDIR/$1" 183 | + rm -fr "$MUSSELDIR/$1" 184 | + mkdir "$MUSSELDIR/$1" 185 | printf -- "${GREENC}=>${NORMALC} $1 cleaned.\n" 186 | printf -- "Cleaned $1.\n" >> $MLOG 187 | fi 188 | -------------------------------------------------------------------------------- /scripts/spider-chroot: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [[ $# == 0 ]] && exit 4 | 5 | MOUNTPOINT=$1 6 | 7 | clean() { 8 | umount "$MOUNTPOINT/dev/shm" 2>/dev/null 9 | umount "$MOUNTPOINT/dev/pts" 10 | umount "$MOUNTPOINT/dev" 11 | umount "$MOUNTPOINT/proc" 12 | umount "$MOUNTPOINT/run" 13 | umount "$MOUNTPOINT/sys/firmware/efi/efivars" 2>/dev/null 14 | umount "$MOUNTPOINT/sys" 15 | } 16 | 17 | trap 'clean' EXIT INT 18 | 19 | mknod -m 600 $MOUNTPOINT/dev/console c 5 1 >/dev/null 20 | mknod -m 666 $MOUNTPOINT/dev/null c 1 3 >/dev/null 21 | 22 | mount --bind /dev $MOUNTPOINT/dev 23 | mount --bind /dev/pts $MOUNTPOINT/dev/pts 24 | mount -t proc proc $MOUNTPOINT/proc 25 | mount -t sysfs sysfs $MOUNTPOINT/sys 26 | mount -t tmpfs tmpfs $MOUNTPOINT/run 27 | if [ -h $MOUNTPOINT/dev/shm ]; then mkdir -pv $MOUNTPOINT/$(readlink $MOUNTPOINT/dev/shm); fi 28 | 29 | cp -f /etc/resolv.conf $MOUNTPOINT/etc/resolv.conf 30 | 31 | chroot "$MOUNTPOINT" /usr/bin/env -i \ 32 | HOME=/root \ 33 | TERM="$TERM" \ 34 | SHELL=/usr/bin/bash \ 35 | USER=root \ 36 | LOGNAME=root \ 37 | PS1="\033[31m(spider-linux)\033[0m \u@\h \033[1m\W\033[0m # " \ 38 | CFLAGS="${CFLAGS:--march=native -pipe -O2}" \ 39 | CXXFLAGS="${CXXFLAGS:--march=native -pipe -O2}" \ 40 | MAKEFLAGS="${MAKEFLAGS:--j$(nproc)}" \ 41 | /usr/bin/bash -l 42 | -------------------------------------------------------------------------------- /scripts/start_toolchain_build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source env_vars_etc 4 | 5 | # BUILDING THE CROSS COMPILER ----------------------------------------------------------------------------------------------------- 6 | 7 | echo "==> Stage 1: Building the Cross Compiler" 8 | 9 | ### binutils 1 10 | 11 | echo "==> Configuring binutils." 12 | goto_sources binutils 13 | 14 | make_build_dir 15 | 16 | ../configure \ 17 | --prefix=$SPIDER_ROOT/toolchain \ 18 | --target=$TARGET_TRIPLET \ 19 | --host=$BUILD_TRIPLET \ 20 | --build=$BUILD_TRIPLET \ 21 | --with-sysroot=$SPIDER_ROOT \ 22 | --disable-nls \ 23 | --disable-werror 24 | 25 | make_install 26 | 27 | ### gcc 1 28 | 29 | echo "==> Configuring gcc 1." 30 | goto_sources gcc 31 | 32 | create_gcc_dep_dirs 33 | 34 | sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 35 | 36 | make_build_dir 37 | 38 | ../configure \ 39 | --prefix=$SPIDER_ROOT/toolchain \ 40 | --target=$TARGET_TRIPLET \ 41 | --host=$BUILD_TRIPLET \ 42 | --build=$BUILD_TRIPLET \ 43 | --with-sysroot=$SPIDER_ROOT \ 44 | --with-glibc-version=2.11 \ 45 | --with-newlib \ 46 | --without-headers \ 47 | --enable-initfini-array \ 48 | --disable-nls \ 49 | --disable-shared \ 50 | --disable-multilib \ 51 | --disable-decimal-float \ 52 | --disable-threads \ 53 | --disable-libatomic \ 54 | --disable-libgomp \ 55 | --disable-libquadmath \ 56 | --disable-libssp \ 57 | --disable-libvtv \ 58 | --disable-libstdcxx \ 59 | --enable-languages=c,c++ 60 | 61 | make_install 62 | 63 | cd .. 64 | # sudo rm -f $SPIDER_ROOT/toolchain/lib/gcc/$TARGET_TRIPLET/11.2.0/install-tools/include/limits.h 2>/dev/null 65 | sudo bash -c "cat gcc/limitx.h gcc/glimits.h gcc/limity.h > $SPIDER_ROOT/toolchain/lib/gcc/$TARGET_TRIPLET/12.1.0/install-tools/include/limits.h" 66 | 67 | ### kernel headers 68 | 69 | echo "==> Generating kernel headers..." 70 | goto_sources linux 71 | echo "==> Building kernel headers..." 72 | make mrproper $JOBS 73 | make headers $JOBS 74 | find usr/include -name '.*' -delete 75 | rm usr/include/Makefile 76 | echo "==> Installing kernel headers to $SPIDER_ROOT/usr..." 77 | sudo cp -r usr/include $SPIDER_ROOT/usr 78 | 79 | ### glibc 80 | 81 | echo "==> Configuring glibc." 82 | goto_sources glibc 83 | 84 | make_build_dir 85 | 86 | echo "rootsbindir=/usr/bin" > configparms 87 | 88 | ../configure \ 89 | --prefix=/usr \ 90 | --host=$TARGET_TRIPLET \ 91 | --build=$BUILD_TRIPLET \ 92 | --enable-kernel=3.2 \ 93 | --with-headers=$SPIDER_ROOT/usr/include \ 94 | libc_cv_slibdir=/usr/lib 95 | 96 | make_install_destdir $SPIDER_ROOT 97 | 98 | sudo sed '/RTLDLIST=/s@/usr@@g' -i $SPIDER_ROOT/usr/bin/ldd 99 | sudo $SPIDER_ROOT/toolchain/libexec/gcc/$TARGET_TRIPLET/12.1.0/install-tools/mkheaders 100 | 101 | ### libstdc++ 1 102 | 103 | echo "==> Configuring libstdc++ 1." 104 | goto_sources gcc 105 | 106 | make_build_dir 107 | 108 | ../libstdc++-v3/configure \ 109 | --prefix=/usr \ 110 | --host=$TARGET_TRIPLET \ 111 | --build=$BUILD_TRIPLET \ 112 | --disable-multilib \ 113 | --disable-nls \ 114 | --disable-libstdcxx-pch \ 115 | --with-gxx-include-dir=/toolchain/$TARGET_TRIPLET/include/c++/12.1.0 116 | 117 | make_install_destdir $SPIDER_ROOT 118 | 119 | ###################################################### 120 | ################### THIS IS PART 2 ################### 121 | ###################################################### 122 | 123 | ### binutils 2 124 | 125 | goto_sources binutils 126 | 127 | make_build_dir 128 | 129 | ../configure \ 130 | --prefix=/usr \ 131 | --host=$TARGET_TRIPLET \ 132 | --build=$BUILD_TRIPLET \ 133 | --enable-shared \ 134 | --enable-64-bit-bfd \ 135 | --disable-nls \ 136 | --disable-werror 137 | 138 | make_install_destdir $SPIDER_ROOT 139 | sudo install -vm755 libctf/.libs/libctf.so.0.0.0 $SPIDER_ROOT/usr/lib 140 | 141 | ### gcc 2 142 | 143 | goto_sources gcc 144 | 145 | create_gcc_dep_dirs 146 | 147 | sudo sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 148 | 149 | sudo mkdir -pv $TARGET_TRIPLET/libgcc 150 | sudo ln -sfv ../../../libgcc/gthr-posix.h $TARGET_TRIPLET/libgcc/gthr-default.h 151 | 152 | make_build_dir 153 | 154 | ../configure \ 155 | --prefix=/usr \ 156 | --host=$TARGET_TRIPLET \ 157 | --build=$BUILD_TRIPLET \ 158 | CC_FOR_TARGET=$TARGET_TRIPLET-gcc \ 159 | --with-build-sysroot=$SPIDER_ROOT \ 160 | --enable-initfini-array \ 161 | --disable-nls \ 162 | --disable-multilib \ 163 | --disable-decimal-float \ 164 | --disable-libatomic \ 165 | --disable-libgomp \ 166 | --disable-libquadmath \ 167 | --disable-libssp \ 168 | --disable-libvtv \ 169 | --disable-libstdcxx \ 170 | --enable-languages=c,c++ 171 | 172 | make_install_destdir $SPIDER_ROOT 173 | sudo ln -sfv gcc $SPIDER_ROOT/usr/bin/cc 174 | -------------------------------------------------------------------------------- /scripts/varcheck: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | bold="\033[1m" 4 | off="\033[0m" 5 | msg_col="\033[1;32m" 6 | err_col="\033[1;38;5;196m" 7 | 8 | msg(){ printf "${msg_col}==>${off} ${bold}%s${off}\n" "$@"; } 9 | err(){ printf "${err_col}error${off}: ${bold}%s${off}\n" "$@"; } 10 | 11 | # --- VARIABLES CHECK 12 | 13 | msg "Checking you have the correct environment variables set..." 14 | 15 | PREFIX="$HOME/files/docs/projects/spiderlinux/cross" 16 | TARGET=x86_64-spider-linux-gnu 17 | PATH="$PREFIX/bin:$PATH" 18 | CHROOT="/mnt/spider" 19 | exploded_PATH=$(echo $PATH | tr ":" "\n") 20 | 21 | [[ ! $(lsblk -o MOUNTPOINT | grep "$CHROOT") ]] && CHROOT+=" (nothing mounted there)" 22 | 23 | printf "==============================\nNOTHING RAN IN THIS SCRIPT WILL SET THE ENVIRONMENT VARIABLES. MAKE SURE TO SET THEM IN YOUR BASH{RC,PROFILE}\n==============================\n\n" 24 | printf "PREFIX,var is set to,$PREFIX\nTARGET,var is set to,$TARGET\nCHROOT,var is set to,$CHROOT\n" | column -s, -t 25 | printf "PATH is\n${exploded_PATH}\n" 26 | 27 | # --- DEPENDENCY CHECK 28 | 29 | is_installed(){ [[ ! $(yay -Qsq "$1") ]] && err "$1 is not installed."; } 30 | 31 | is_installed make 32 | is_installed bison 33 | is_installed gmp 34 | is_installed mpc 35 | is_installed mpfr 36 | is_installed texinfo 37 | --------------------------------------------------------------------------------