freetype:update and moved to /usr/lib
[nyanlinux.git] / builders / cproc-2ef69c243bf05282071b9fd66e9ab2ffb8c25783 / builder.sh
blobd2f8526c3276c949e849faee89c00612d59c5234
1 #XXX not yet in a toolchain
2 src_name=cproc
3 git_commit=${pkg_name##*-}
4 slot=$git_commit
5 git_url0=https://git.sr.ht/~mcf/cproc
7 pkg_dir=/run/pkgs/$src_name
8 src_dir=$src_dir_root/$src_name
9 rm -Rf $pkg_dir
10 mkdir -p /run/pkgs
11 cp -r $src_dir $pkg_dir
13 PATH_SAVED=$PATH
14 export PATH="\
15 /nyan/toolchains/binutils-tinycc/bin:\
16 /nyan/make/current/bin:\
17 /nyan/git/current/bin:\
18 $PATH\
20 target_gnu_triple=$(basename "$(ls -d /nyan/toolchains/binutils-tinycc/bin/*-tcc)")
21 target_gnu_triple=${target_gnu_triple%-tcc}
23 cd $pkg_dir
25 if test x$git_commit != x; then
26 git checkout --force $git_commit
27 git reset --hard
30 # XXX we don't run the configure script and genereate config.h and config.mk ourself
31 # XXX we are trying to make it work with tcc
32 defines=
33 cat >config.h <<EOF
34 static const char target[] = "$target_gnu_triple";
35 static const char *const startfiles[] = {"",""}; /* XXX: EMPTY FOR NOW */
36 static const char *const endfiles[] = {"",""}; /* XXX: EMPTY FOR NOW */
37 static const char *const preprocesscmd[] = {
38 "/nyan/cproc/$slot/bin/cpp",
40 /* clear preprocessor GNU C version */
41 "-U", "__TINYC__",
42 "-U", "__TCC_PP__",
44 /* we don't yet support these optional features */
45 "-D", "__STDC_NO_ATOMICS__",
46 "-D", "__STDC_NO_COMPLEX__",
47 "-D", "__STDC_NO_VLA__",
48 "-U", "__SIZEOF_INT128__",
50 /* we don't generate position-independent code */
51 "-U", "__PIC__",
53 /* ignore attributes and extension markers */
54 "-D", "__attribute__(x)=",
55 "-D", "__extension__=",
56 $defines};
57 static const char *const codegencmd[] = {"/nyan/qbe/current/bin/qbe"};
58 static const char *const assemblecmd[] = {"/nyan/toolchains/binutils-tinycc/bin/$target_gnu_triple-as"};
59 static const char *const linkcmd[] = {"/nyan/toolchains/binutils-tinycc/bin/$target_gnu_triple-ld", "-B/nyan/glibc/current/lib --dynamic-linker '/lib64/ld-linux-x86-64.so.2'"};
60 EOF
62 # makefile syntax (hence variable syntax)
63 cat >config.mk <<EOF
64 PREFIX=/nyan/cproc/$slot
65 BINDIR=\$(PREFIX)/bin
66 CC=$target_gnu_triple-tcc
67 CFLAGS=
68 LDFLAGS=
69 EOF
71 make -j $threads_n
72 make install
74 cat >/nyan/cproc/$slot/bin/cpp <<EOF
75 #!/bin/sh
76 exec /nyan/toolchains/binutils-tinycc/bin/$target_gnu_triple-tcc -E "\$@"
77 EOF
78 chmod +x /nyan/cproc/$slot/bin/cpp
80 export PATH=$PATH_SAVED
81 unset PATH_SAVED
82 unset target_gnu_triple
83 rm -Rf $pkg_dir