alexkarle.com

Source for alexkarle.com
git clone git://git.alexkarle.com/alexkarle.com.git
Log | Files | Refs | README | LICENSE

006-use-the-src.txt (1329B) [raw]


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