Overview
| Comment: | add dist mechanism |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
d248dc59659e83f0d814a8d6fe85b223 |
| User & Date: | lexi on 2021-01-19 22:02:23 |
| Other Links: | manifest | tags |
Context
|
2021-01-22
| ||
| 16:48 | somewhat defuckulate build system check-in: 251b382f5c user: lexi tags: trunk | |
|
2021-01-19
| ||
| 22:02 | add dist mechanism check-in: d248dc5965 user: lexi tags: trunk | |
|
2021-01-14
| ||
| 17:38 | check in missing file check-in: 576487f566 user: lexi tags: trunk | |
Changes
Modified config.lua from [af9c45003f] to [cba33505b3].
26 26 pkg = {}; 27 27 dist = default('parsav_dist', coalesce( 28 28 os.getenv('NIX_PATH') and 'nixos', 29 29 os.getenv('NIX_STORE') and 'nixos', 30 30 '')); 31 31 tgttrip = default('parsav_arch_triple'); -- target triple, used in xcomp 32 32 tgtcpu = default('parsav_arch_cpu'); -- target cpu, used in xcomp 33 - tgthf = u.tobool(default('parsav_arch_armhf',true)); 33 + -- tgthf = u.tobool(default('parsav_arch_armhf',true)); 34 34 doc = { 35 35 online = u.tobool(default('parsav_online_documentation',true)); 36 36 offline = u.tobool(default('parsav_offline_documentation',true)); 37 37 }; 38 38 outform = default('parsav_emit_type', 'o'); 39 39 endian = default('parsav_arch_endian', 'little'); 40 40 prefix = default('parsav_install_prefix', '.');
Added dist/BSDmakefile version [7f20717fa4].
1 +# being extremely paranoid here, but there's some vague plans to get nix 2 +# shit working under BSD kernels, so we may as well future-proof the thing 3 +.if defined(NIX_STORE) || defined(NIX_PATH) 4 + l-glibc-path != nix path-info nixos.glibc 5 + rt-path = $(l-glibc-path)/lib 6 +.endif 7 + 8 +rt-path ?= /usr/lib 9 +runtime = $(rt-path)/crt1.o \ 10 + $(rt-path)/crti.o \ 11 + $(rt-path)/crtbegin.o \ 12 + $(rt-path)/crtend.o \ 13 + $(rt-path)/crtn.o 14 + 15 +.include <makefile>
Added dist/GNUmakefile version [1a1f87c1d5].
1 +# we need to detect the environment and set the runtime path appropriately 2 +ifndef NIX_STORE 3 +else ifndef NIX_PATH 4 +else 5 + distro = nix 6 +endif 7 + 8 +ifndef runtime 9 + ifeq ($(distro),nix) 10 + rt-pfx = $(shell nix path-info nixos.glibc)/lib 11 + else ifeq ($(shell test -e /usr/local/lib/crt1.o; echo $$?),0) 12 + rt-pfx = /usr/local/lib 13 + else ifeq ($(shell test -e /lib/crt1.o; echo $$?),0) 14 + rt-pfx = /lib 15 + endif 16 + runtime = $(rt-pfx)/crt1.o $(rt-pfx)/crti.o $(rt-pfx)/crtn.o 17 +endif 18 + 19 +include makefile
Added dist/default.nix version [a7ffc6f8bf].
Added dist/makefile version [de98ce3076].
1 +# vim: ft=make 2 +runtime ?= /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtn.o 3 +all: parsav parsavd 4 + 5 +%: %.o 6 + ld -o $@ $< $(runtime) ${NIX_LDFLAGS} -L. -ljson-c -lpq -lmbedtls -lmbedcrypto -lmongoose -lc 7 + strip @$ 8 + 9 +%.o: %.ll 10 + llc --filetype=obj --relocation-model=pic $<
Added dist/readme.md version [d87e8d1b5f].
1 +# parsav distribution 2 +to prepare a binary (or LLVM IR) distribution of parsav, simply `cd` into its directory and issue the command `make`. any version of `make` should work; you may need to manually set the location of the C runtime with the `runtime` variable if you're not using GNU or BSD make (e.g. `make runtime='crt1.o crti.o crtn.o' all`). certain distributions may need extra parameters to be passed to the makefile, or the makefile may need to be run in a particular environment, such as on `nix`. 3 + 4 +# dependencies 5 +the standard releases are built with most dependencies statically linked at compile time. several dependencies will need to be installed before linking parsav, however: 6 + 7 + * libc: used for OS calls 8 + * binutils: used to link and strip the binary 9 + * libjsonc: used for fediverse integration 10 + * libpq: used for the postgres backend (usually part of the postgres distribution) 11 + 12 +## makefile variables 13 + 14 +## special cases 15 + 16 +### nixos 17 +on nixos, `make` will not work unless you use `nix-shell` to enter an environment with all the dependencies available. however, if you just want to install parsav, you can use `default.nix` to build a package.
Modified makefile from [d43e9d6c44] to [51cc28542c].
1 +version = dev 1 2 dl = git 2 3 dbg-flags = $(if $(dbg),-g) 3 4 4 5 images = static/default-avatar.webp static/query.webp static/heart.webp static/retweet.webp static/reply.webp static/file.webp static/follow.webp 5 6 #$(addsuffix .webp, $(basename $(wildcard static/*.svg))) 6 7 styles = $(addsuffix .css, $(basename $(wildcard static/*.scss))) 7 8 ................................................................................ 31 32 dep: dep.mbedtls dep.mongoose dep.json-c 32 33 dep.mbedtls: lib/mbedtls/library/libmbedtls.a \ 33 34 lib/mbedtls/library/libmbedcrypto.a \ 34 35 lib/mbedtls/library/libmbedx509.a 35 36 dep.mongoose: lib/mongoose/libmongoose.a 36 37 dep.json-c: lib/json-c/libjson-c.a 37 38 39 +static-libs = lib/json-c/libjson-c.a \ 40 + lib/mongoose/libmongoose.a \ 41 + lib/mbedtls/library/libmbedx509.a \ 42 + lib/mbedtls/library/libmbedcrypto.a \ 43 + lib/mbedtls/library/libmbedtls.a 44 + 45 +dist-kind ?= o 46 +parsav-dist = parsav-$(dist-kind)dist-$(version) 47 +$(parsav-dist).txz: parsav.$(dist-kind) parsavd.$(dist-kind) dist/readme.md dist/GNUmakefile dist/BSDmakefile dist/makefile dist/default.nix $(static-libs) 48 + mkdir -p $(parsav-dist) 49 + cp -u $^ $(parsav-dist)/ 50 + tar cf $(parsav-dist){.tar,} 51 + xz -c9e $(parsav-dist).tar > $@ 52 + rm -r $(parsav-dist){.tar,} 53 + 38 54 lib: 39 55 mkdir $@ 40 56 # generate a shim static library so mongoose cooperates 41 57 # with the build apparatus. note that parsav is designed 42 58 # to be fronted by a real web server like nginx if SSL 43 59 # is to be used, so we don't turn on SSL in mongoose 44 60 lib/mongoose/libmongoose.a: lib/mongoose lib/mongoose/mongoose.c lib/mongoose/mongoose.h ................................................................................ 47 63 -DMG_ENABLE_IPV6=1 \ 48 64 -DMG_ENABLE_HTTP_WEBDAV=1 \ 49 65 -DMG_ENABLE_HTTP_WEBSOCKET=0 50 66 ar rcs $@ lib/mongoose/*.o 51 67 ranlib $@ 52 68 53 69 lib/json-c/Makefile: lib/json-c lib/json-c/CMakeLists.txt 54 - cd lib/json-c && cmake . 70 + cd $< && cmake . 55 71 lib/json-c/libjson-c.a: lib/json-c/Makefile 56 72 $(MAKE) -C lib/json-c 57 73 lib/mbedtls/library/%.a: lib/mbedtls 58 74 $(MAKE) -C lib/mbedtls/library $*.a 59 75 60 76 ifeq ($(dl), git) 61 77 clone = git clone --depth 1 # save time 62 -lib/mongoose: lib 63 - cd lib && $(clone) https://github.com/cesanta/mongoose.git 64 -lib/mbedtls: lib 65 - cd lib && $(clone) https://github.com/ARMmbed/mbedtls.git 66 -lib/json-c: lib 67 - cd lib && $(clone) https://github.com/json-c/json-c.git 78 +ensurelib = mkdir -p lib && cd lib 79 +lib/mongoose: 80 + $(ensurelib) && $(clone) https://github.com/cesanta/mongoose.git 81 +lib/mbedtls: 82 + $(ensurelib) && $(clone) https://github.com/ARMmbed/mbedtls.git 83 +lib/json-c: 84 + $(ensurelib) && $(clone) https://github.com/json-c/json-c.git 68 85 else 69 86 lib/%: lib/%.tar.gz 70 - cd lib && tar zxf $*.tar.gz 87 + $(ensurelib) && tar zxf $*.tar.gz 71 88 mv lib/$$(tar tf $< | head -n1) $@ 72 89 73 90 ifeq ($(dl), wget) 74 - dlfile = wget "$(1)" -O "$(2)" 91 + dlfile = mkdir -p $(dir $@) && wget "$1" -O "$@" 75 92 endif 76 93 77 94 ifeq ($(dl), curl) 78 - dlfile = curl "$(1)" -o "$(2)" 95 + dlfile = mkdir -p $(dir $@) && curl "$1" -o "$@" 79 96 endif 80 97 81 -lib/mongoose.tar.gz: lib 82 - $(call dlfile,https://api.github.com/repos/cesanta/mongoose/tarball/master,$@) 83 -lib/mbedtls.tar.gz: lib 84 - $(call dlfile,https://api.github.com/repos/ARMmbed/mbedtls/tarball/master,$@) 85 -lib/json-c.tar.gz: lib 86 - $(call dlfile,https://api.github.com/repos/json-c/json-c/tarball/master,$@) 98 +lib/mongoose.tar.gz: 99 + $(call dlfile,https://api.github.com/repos/cesanta/mongoose/tarball/master) 100 +lib/mbedtls.tar.gz: 101 + $(call dlfile,https://api.github.com/repos/ARMmbed/mbedtls/tarball/master) 102 +lib/json-c.tar.gz: 103 + $(call dlfile,https://api.github.com/repos/json-c/json-c/tarball/master) 87 104 endif
Modified parsav.t from [8d6924c4e0] to [b6e7e54998].
656 656 print(util.dump(config)) 657 657 os.exit(0) 658 658 end 659 659 660 660 local holler = print 661 661 local suffix = config.exe and '' or ('.'..config.outform) 662 662 local out = 'parsavd' .. suffix 663 -local linkargs = {} 663 +local linkargs = {'-g'} 664 664 local target = config.tgttrip and terralib.newtarget { 665 665 Triple = config.tgttrip; 666 666 CPU = config.tgtcpu; 667 667 FloatABIHard = config.tgthf; 668 668 } or nil 669 - 670 669 if bflag('quiet','q') then holler = function() end end 670 + 671 +if target then holler(' * building for triple ' .. tostring(target)) end 671 672 if bflag('asan','s') then linkargs[#linkargs+1] = '-fsanitize=address' end 672 673 if bflag('lsan','S') then linkargs[#linkargs+1] = '-fsanitize=leak' end 673 674 674 -for _,p in pairs(config.pkg) do util.append(linkargs, p.linkargs) end 675 +if config.exe then 676 + for _,p in pairs(config.pkg) do util.append(linkargs, p.linkargs) end 677 +end 675 678 local linkargs_d = linkargs -- controller is not multithreaded 676 679 if config.posix then 677 680 linkargs_d[#linkargs_d+1] = '-pthread' 678 681 end 679 682 680 -holler(' → linking \27[1mparsav\27[m with "' .. table.concat(linkargs,' ') .. '"') 683 +holler(' → writing \27[1mparsav\27[m with "' .. table.concat(linkargs,' ') .. '"') 681 684 terralib.saveobj('parsav' ..suffix, { main = lib.mgtool }, linkargs, target) 682 685 683 -holler(' → linking \27[1mparsavd\27[m with "' .. table.concat(linkargs_d,' ') .. '"') 686 +holler(' → writing \27[1mparsavd\27[m with "' .. table.concat(linkargs_d,' ') .. '"') 684 687 terralib.saveobj('parsavd'..suffix, { main = entry_daemon }, linkargs_d, target)