garbash-www

archive of ~alex garbash.com page
git clone git://git.alexkarle.com.com/garbash-www
Log | Files | Refs | README | LICENSE

006-use-the-src.md (1406B) [raw]


      1 ---
      2 title: 006-use-the-src
      3 ---
      4 
      5 # 006-us-the-src
      6 
      7 Tues Sept 21, 2021
      8 
      9 Use the source, Luke!
     10 
     11 One of the main reasons to use a FOSS OS is that you can see the code!
     12 For me as a dev, it's been a lifechanging experience. Often it's faster
     13 to just look at the code than try to decipher Stack Overflow answers,
     14 and I always learn more that way!
     15 
     16 Another perk of the \*BSD's is that all of their source is in one repo.
     17 This can of course make SCM slow, but from a curious-developer perspective
     18 it's a dream come true.
     19 
     20 OpenBSD uses cvs(1) to manage their source, but they publish a read-only
     21 git(1) mirror to GitHub, which I like to use for familiarity sake.
     22 
     23 Traditionally, all the source lives in /usr/src , and OpenBSD expects
     24 you to put it there (for build purposes).
     25 
     26 To get it:
     27 
     28 1. Add yourself to the wsrc and wobj groups so you can build without doas
     29 ```
     30     # usermod -G wsrc,wobj <user>
     31 ```
     32 2. Clone a bare repo to /var/git (default /usr/src not big enough for .git)
     33 ```
     34     # mkdir /var/git
     35     # chmod 775 /var/git
     36     # chown root:wsrc /var/git
     37     $ cd /var/git
     38     $ git clone --bare https://github.com/openbsd/src
     39 ```
     40 3. Check out a new worktree at /usr/src
     41 ```
     42     $ git -C /var/git/src.git worktree add /usr/src
     43 ```
     44 4. Find your favorite tool and build it
     45 ```
     46     $ cd /usr/src/bin/ed
     47     $ make obj  # for out of tree build, see make(1) OBJDIR
     48     $ make
     49     $ ./obj/ed
     50 ```
     51 
     52 How cool is that?