1# Copyright (c) Huawei Technologies Co., Ltd. 2020-2022. All rights reserved.
2# Must do steps below manually after getting the sources code
3# from official website:
4# 1. make defconfig or make menuconfig
5#   ==> To generate .config file.
6# 2. NOBUILD=1 scripts/make.sh
7#   ==> To generate neccesary files like heades in generated
8# direcotory.
9
10# To add a toy:
11# 1. Edit .config to enable the toy you want to add.
12# 2. Edit toybox'sources below if neccesary.
13# e. Add th toy to the symlinks.
14if (defined(ohos_lite)) {
15  executable("toybox") {
16    # from middleware file build.sh
17    sources = [
18      "lib/args.c",
19      "lib/commas.c",
20      "lib/deflate.c",
21      "lib/dirtree.c",
22      "lib/env.c",
23      "lib/help.c",
24      "lib/lib.c",
25      "lib/linestack.c",
26      "lib/llist.c",
27      "lib/net.c",
28      "lib/password.c",
29      "lib/portability.c",
30      "lib/tty.c",
31      "lib/xwrap.c",
32      "main.c",
33      "toys/android/sendevent.c",
34      "toys/lsb/dmesg.c",
35      "toys/lsb/gzip.c",
36      "toys/lsb/hostname.c",
37      "toys/lsb/killall.c",
38      "toys/lsb/md5sum.c",
39      "toys/lsb/mknod.c",
40      "toys/lsb/mktemp.c",
41      "toys/lsb/mount.c",
42      "toys/lsb/passwd.c",
43      "toys/lsb/pidof.c",
44      "toys/lsb/seq.c",
45      "toys/lsb/su.c",
46      "toys/lsb/sync.c",
47      "toys/lsb/umount.c",
48      "toys/net/ftpget.c",
49      "toys/net/ifconfig.c",
50      "toys/net/microcom.c",
51      "toys/net/netcat.c",
52      "toys/net/netstat.c",
53      "toys/net/ping.c",
54      "toys/net/rfkill.c",
55      "toys/net/sntp.c",
56      "toys/net/tunctl.c",
57      "toys/other/acpi.c",
58      "toys/other/ascii.c",
59      "toys/other/base64.c",
60      "toys/other/blkid.c",
61      "toys/other/blockdev.c",
62      "toys/other/bzcat.c",
63      "toys/other/chroot.c",
64      "toys/other/chrt.c",
65      "toys/other/chvt.c",
66      "toys/other/clear.c",
67      "toys/other/count.c",
68      "toys/other/devmem.c",
69      "toys/other/dos2unix.c",
70      "toys/other/eject.c",
71      "toys/other/factor.c",
72      "toys/other/fallocate.c",
73      "toys/other/flock.c",
74      "toys/other/fmt.c",
75      "toys/other/free.c",
76      "toys/other/freeramdisk.c",
77      "toys/other/fsfreeze.c",
78      "toys/other/fsync.c",
79      "toys/other/help.c",
80      "toys/other/hexedit.c",
81      "toys/other/hwclock.c",
82      "toys/other/i2ctools.c",
83      "toys/other/inotifyd.c",
84      "toys/other/insmod.c",
85      "toys/other/ionice.c",
86      "toys/other/login.c",
87      "toys/other/losetup.c",
88      "toys/other/lsattr.c",
89      "toys/other/lsmod.c",
90      "toys/other/lspci.c",
91      "toys/other/lsusb.c",
92      "toys/other/makedevs.c",
93      "toys/other/mcookie.c",
94      "toys/other/mix.c",
95      "toys/other/mkpasswd.c",
96      "toys/other/mkswap.c",
97      "toys/other/modinfo.c",
98      "toys/other/mountpoint.c",
99      "toys/other/nbd_client.c",
100      "toys/other/nsenter.c",
101      "toys/other/oneit.c",
102      "toys/other/partprobe.c",
103      "toys/other/pivot_root.c",
104      "toys/other/pmap.c",
105      "toys/other/printenv.c",
106      "toys/other/pwdx.c",
107      "toys/other/readahead.c",
108      "toys/other/readlink.c",
109      "toys/other/realpath.c",
110      "toys/other/reboot.c",
111      "toys/other/reset.c",
112      "toys/other/rev.c",
113      "toys/other/rmmod.c",
114      "toys/other/setfattr.c",
115      "toys/other/setsid.c",
116      "toys/other/shred.c",
117      "toys/other/stat.c",
118      "toys/other/swapoff.c",
119      "toys/other/swapon.c",
120      "toys/other/switch_root.c",
121      "toys/other/sysctl.c",
122      "toys/other/tac.c",
123      "toys/other/taskset.c",
124      "toys/other/timeout.c",
125      "toys/other/truncate.c",
126      "toys/other/uptime.c",
127      "toys/other/usleep.c",
128      "toys/other/uuidgen.c",
129      "toys/other/vconfig.c",
130      "toys/other/vmstat.c",
131      "toys/other/w.c",
132      "toys/other/watch.c",
133      "toys/other/which.c",
134      "toys/other/xxd.c",
135      "toys/other/yes.c",
136      "toys/pending/bootchartd.c",
137      "toys/pending/dd.c",
138      "toys/pending/diff.c",
139      "toys/pending/getty.c",
140      "toys/pending/lsof.c",
141      "toys/pending/mdev.c",
142      "toys/pending/more.c",
143      "toys/pending/route.c",
144      "toys/pending/telnetd.c",
145      "toys/posix/basename.c",
146      "toys/posix/cal.c",
147      "toys/posix/cat.c",
148      "toys/posix/chgrp.c",
149      "toys/posix/chmod.c",
150      "toys/posix/cksum.c",
151      "toys/posix/cmp.c",
152      "toys/posix/comm.c",
153      "toys/posix/cp.c",
154      "toys/posix/cpio.c",
155      "toys/posix/cut.c",
156      "toys/posix/date.c",
157      "toys/posix/df.c",
158      "toys/posix/dirname.c",
159      "toys/posix/du.c",
160      "toys/posix/echo.c",
161      "toys/posix/env.c",
162      "toys/posix/expand.c",
163      "toys/posix/false.c",
164      "toys/posix/file.c",
165      "toys/posix/find.c",
166      "toys/posix/getconf.c",
167      "toys/posix/grep.c",
168      "toys/posix/head.c",
169      "toys/posix/iconv.c",
170      "toys/posix/id.c",
171      "toys/posix/kill.c",
172      "toys/posix/link.c",
173      "toys/posix/ln.c",
174      "toys/posix/logger.c",
175      "toys/posix/ls.c",
176      "toys/posix/mkdir.c",
177      "toys/posix/mkfifo.c",
178      "toys/posix/nice.c",
179      "toys/posix/nl.c",
180      "toys/posix/nohup.c",
181      "toys/posix/od.c",
182      "toys/posix/paste.c",
183      "toys/posix/patch.c",
184      "toys/posix/printf.c",
185      "toys/posix/ps.c",
186      "toys/posix/pwd.c",
187      "toys/posix/renice.c",
188      "toys/posix/rm.c",
189      "toys/posix/rmdir.c",
190      "toys/posix/sed.c",
191      "toys/posix/sleep.c",
192      "toys/posix/sort.c",
193      "toys/posix/split.c",
194      "toys/posix/strings.c",
195      "toys/posix/tail.c",
196      "toys/posix/tar.c",
197      "toys/posix/tee.c",
198      "toys/posix/test.c",
199      "toys/posix/time.c",
200      "toys/posix/touch.c",
201      "toys/posix/true.c",
202      "toys/posix/tty.c",
203      "toys/posix/ulimit.c",
204      "toys/posix/uname.c",
205      "toys/posix/uniq.c",
206      "toys/posix/unlink.c",
207      "toys/posix/uudecode.c",
208      "toys/posix/uuencode.c",
209      "toys/posix/wc.c",
210      "toys/posix/who.c",
211      "toys/posix/xargs.c",
212    ]
213
214    include_dirs = [ "./" ]
215
216    defines = [
217      "_DEFAULT_SOURCE",
218      "OHOS_LITE",
219    ]
220
221    configs -= [ "//build/lite/config:language_c" ]
222    cflags_c = [
223      "-std=gnu11",
224      "-Wall",
225      "-Wundef",
226      "-Wno-char-subscripts",
227      "-Wno-implicit-function-declaration",
228      "-Wno-unused-variable",
229      "-Wno-unused-value",
230      "-Wno-incompatible-pointer-types",
231      "-Wno-int-conversion",
232      "-Wno-sign-compare",
233      "-Wno-format",
234      "-Wno-unused-result",
235      "-Os",
236      "-ffunction-sections",
237      "-fdata-sections",
238      "-fno-asynchronous-unwind-tables",
239      "-fPIE",
240      "-funsigned-char",
241    ]
242
243    ldflags = [
244      "-pie",
245      "-Wl,-z,relro",
246      "-Wl,-z,now",
247      "-Wl,-z,noexecstack",
248      "-lm",
249      "-lcrypt",
250    ]
251  }
252
253  cmd_long_path = [
254    "bin/chmod",
255    "bin/chown",
256    "bin/chroot",
257    "bin/chrt",
258    "bin/chvt",
259    "bin/cksum",
260    "bin/clear",
261    "bin/cmp",
262    "bin/comm",
263    "bin/count",
264    "bin/cp",
265    "bin/cpio",
266    "bin/crc32",
267    "bin/cut",
268    "bin/date",
269    "bin/devmem",
270    "bin/df",
271    "bin/diff",
272    "bin/dirname",
273    "bin/dmesg",
274    "bin/dnsdomainname",
275    "bin/dos2unix",
276    "bin/du",
277    "bin/echo",
278    "bin/egrep",
279    "bin/eject",
280    "bin/env",
281    "bin/expand",
282    "bin/factor",
283    "bin/fallocate",
284    "bin/false",
285    "bin/fgrep",
286    "bin/file",
287    "bin/find",
288    "bin/flock",
289    "bin/fmt",
290    "bin/free",
291    "bin/freeramdisk",
292    "bin/fsfreeze",
293    "bin/fstype",
294    "bin/fsync",
295    "bin/ftpget",
296    "bin/ftpput",
297    "bin/getconf",
298    "sbin/getty",
299    "bin/grep",
300    "bin/groups",
301    "bin/gunzip",
302    "bin/halt",
303    "bin/head",
304    "bin/help",
305    "bin/hexedit",
306    "bin/hostname",
307    "bin/hwclock",
308    "bin/i2cdetect",
309    "bin/i2cdump",
310    "bin/i2cget",
311    "bin/i2cset",
312    "bin/iconv",
313    "bin/id",
314    "bin/ifconfig",
315    "bin/inotifyd",
316    "bin/insmod",
317    "bin/install",
318    "bin/ionice",
319    "bin/iorenice",
320    "bin/iotop",
321    "bin/kill",
322    "bin/killall",
323    "bin/killall5",
324    "bin/link",
325    "bin/ln",
326    "bin/logger",
327    "bin/login",
328    "bin/logname",
329    "bin/losetup",
330    "bin/ls",
331    "bin/lsattr",
332    "bin/lsmod",
333    "bin/lsof",
334    "bin/lspci",
335    "bin/lsusb",
336    "bin/makedevs",
337    "bin/mcookie",
338    "bin/md5sum",
339    "bin/microcom",
340    "bin/mix",
341    "bin/mkdir",
342    "bin/mkfifo",
343    "bin/mknod",
344    "bin/mkpasswd",
345    "bin/mkswap",
346    "bin/mktemp",
347    "bin/modinfo",
348    "bin/more",
349    "bin/mount",
350    "bin/mountpoint",
351    "bin/mv",
352    "bin/nbd-client",
353    "bin/nc",
354    "bin/netcat",
355    "bin/netstat",
356    "bin/nice",
357    "bin/nl",
358    "bin/nohup",
359    "bin/nproc",
360    "bin/nsenter",
361    "bin/od",
362    "bin/oneit",
363    "bin/partprobe",
364    "bin/passwd",
365    "bin/paste",
366    "bin/patch",
367    "bin/pgrep",
368    "bin/pidof",
369    "bin/ping",
370    "bin/ping6",
371    "bin/pivot_root",
372    "bin/pkill",
373    "bin/pmap",
374    "bin/poweroff",
375    "bin/printenv",
376    "bin/printf",
377    "bin/prlimit",
378    "bin/ps",
379    "bin/pwd",
380    "bin/pwdx",
381    "bin/readahead",
382    "bin/readlink",
383    "bin/realpath",
384    "bin/reboot",
385    "bin/renice",
386    "bin/reset",
387    "bin/rev",
388    "bin/rfkill",
389    "bin/rm",
390    "bin/rmdir",
391    "bin/rmmod",
392    "bin/sed",
393    "bin/seq",
394    "bin/setfattr",
395    "bin/setsid",
396    "bin/shalsum",
397    "bin/shred",
398    "bin/sleep",
399    "bin/sntp",
400    "bin/sort",
401    "bin/split",
402    "bin/stat",
403    "bin/strings",
404    "bin/su",
405    "bin/swapoff",
406    "bin/swapon",
407    "bin/switch_root",
408    "bin/sync",
409    "bin/sysctrl",
410    "bin/tac",
411    "bin/tail",
412    "bin/tar",
413    "bin/taskset",
414    "bin/tee",
415    "bin/test",
416    "bin/time",
417    "bin/timeout",
418    "bin/top",
419    "bin/touch",
420    "bin/true",
421    "bin/truncate",
422    "bin/tty",
423    "bin/tunctl",
424    "bin/ulimit",
425    "bin/umount",
426    "bin/uname",
427    "bin/uniq",
428    "bin/unix2dos",
429    "bin/unlink",
430    "bin/unshare",
431    "bin/uptime",
432    "bin/usleep",
433    "bin/uudecode",
434    "bin/uuencode",
435    "bin/uuidgen",
436    "bin/vconfig",
437    "bin/vmstat",
438    "bin/w",
439    "bin/watch",
440    "bin/wc",
441    "bin/which",
442    "bin/who",
443    "bin/whoami",
444    "bin/xargs",
445    "bin/xxd",
446    "bin/yes",
447    "bin/zcat",
448    "bin/mdev",
449    "bin/telnetd",
450    "bin/route",
451  ]
452
453  foreach(path, cmd_long_path) {
454    exec_script("install.py",
455                [
456                  "--long_path",
457                  path,
458                  "--out_dir",
459                  rebase_path("$root_out_dir"),
460                ])
461  }
462} else {
463  import("//build/ohos.gni")
464  import("toybox.gni")
465
466  ohos_executable("su") {
467    sources = [ "openharmony/su.c" ]
468
469    include_dirs = [ "./openharmony" ]
470
471    cflags_c = [
472      "-std=gnu11",
473      "-Wall",
474      "-Wundef",
475      "-Wno-char-subscripts",
476      "-Wno-implicit-function-declaration",
477      "-Wno-unused-variable",
478      "-Wno-unused-value",
479      "-Wno-incompatible-pointer-types",
480      "-Wno-int-conversion",
481      "-Wno-sign-compare",
482      "-Wno-format",
483      "-Wno-unused-result",
484      "-Os",
485      "-ffunction-sections",
486      "-fdata-sections",
487      "-fno-asynchronous-unwind-tables",
488      "-fPIE",
489      "-funsigned-char",
490      "-Wno-string-plus-int",
491      "-Wno-tautological-constant-compare",
492      "-Wno-string-conversion",
493      "-Wno-unused-but-set-variable",
494    ]
495
496    ldflags = [
497      "-pie",
498      "-Wl,-z,relro",
499      "-Wl,-z,now",
500      "-Wl,-z,noexecstack",
501      "-lm",
502      "-lcrypt",
503    ]
504
505    part_name = "toybox"
506    subsystem_name = "thirdparty"
507    install_images = [ "eng_system" ]
508    install_enable = true
509  }
510
511  ohos_executable("toybox") {
512    sources = [
513      "lib/args.c",
514      "lib/commas.c",
515      "lib/deflate.c",
516      "lib/dirtree.c",
517      "lib/env.c",
518      "lib/help.c",
519      "lib/lib.c",
520      "lib/linestack.c",
521      "lib/llist.c",
522      "lib/net.c",
523      "lib/password.c",
524      "lib/portability.c",
525      "lib/tty.c",
526      "lib/xwrap.c",
527      "main.c",
528      "toys/android/sendevent.c",
529      "toys/lsb/dmesg.c",
530      "toys/lsb/gzip.c",
531      "toys/lsb/hostname.c",
532      "toys/lsb/killall.c",
533      "toys/lsb/md5sum.c",
534      "toys/lsb/mknod.c",
535      "toys/lsb/mktemp.c",
536      "toys/lsb/mount.c",
537      "toys/lsb/passwd.c",
538      "toys/lsb/pidof.c",
539      "toys/lsb/seq.c",
540      "toys/lsb/sync.c",
541      "toys/lsb/umount.c",
542      "toys/net/ftpget.c",
543      "toys/net/ifconfig.c",
544      "toys/net/microcom.c",
545      "toys/net/netcat.c",
546      "toys/net/netstat.c",
547      "toys/net/ping.c",
548      "toys/net/rfkill.c",
549      "toys/net/sntp.c",
550      "toys/net/tunctl.c",
551      "toys/other/acpi.c",
552      "toys/other/ascii.c",
553      "toys/other/base64.c",
554      "toys/other/blkid.c",
555      "toys/other/blockdev.c",
556      "toys/other/bzcat.c",
557      "toys/other/chroot.c",
558      "toys/other/chrt.c",
559      "toys/other/chvt.c",
560      "toys/other/clear.c",
561      "toys/other/count.c",
562      "toys/other/devmem.c",
563      "toys/other/dos2unix.c",
564      "toys/other/eject.c",
565      "toys/other/factor.c",
566      "toys/other/fallocate.c",
567      "toys/other/flock.c",
568      "toys/other/fmt.c",
569      "toys/other/free.c",
570      "toys/other/freeramdisk.c",
571      "toys/other/fsfreeze.c",
572      "toys/other/fsync.c",
573      "toys/other/help.c",
574      "toys/other/hexedit.c",
575      "toys/other/hwclock.c",
576      "toys/other/i2ctools.c",
577      "toys/other/inotifyd.c",
578      "toys/other/insmod.c",
579      "toys/other/ionice.c",
580      "toys/other/login.c",
581      "toys/other/losetup.c",
582      "toys/other/lsattr.c",
583      "toys/other/lsmod.c",
584      "toys/other/lspci.c",
585      "toys/other/lsusb.c",
586      "toys/other/makedevs.c",
587      "toys/other/mcookie.c",
588      "toys/other/mix.c",
589      "toys/other/mkpasswd.c",
590      "toys/other/mkswap.c",
591      "toys/other/modinfo.c",
592      "toys/other/mountpoint.c",
593      "toys/other/nbd_client.c",
594      "toys/other/nsenter.c",
595      "toys/other/oneit.c",
596      "toys/other/partprobe.c",
597      "toys/other/pivot_root.c",
598      "toys/other/pmap.c",
599      "toys/other/printenv.c",
600      "toys/other/pwdx.c",
601      "toys/other/readahead.c",
602      "toys/other/readlink.c",
603      "toys/other/realpath.c",
604      "toys/other/reboot.c",
605      "toys/other/reset.c",
606      "toys/other/rev.c",
607      "toys/other/rmmod.c",
608      "toys/other/setfattr.c",
609      "toys/other/setsid.c",
610      "toys/other/shred.c",
611      "toys/other/stat.c",
612      "toys/other/swapoff.c",
613      "toys/other/swapon.c",
614      "toys/other/switch_root.c",
615      "toys/other/sysctl.c",
616      "toys/other/tac.c",
617      "toys/other/taskset.c",
618      "toys/other/timeout.c",
619      "toys/other/truncate.c",
620      "toys/other/uptime.c",
621      "toys/other/usleep.c",
622      "toys/other/uuidgen.c",
623      "toys/other/vconfig.c",
624      "toys/other/vmstat.c",
625      "toys/other/w.c",
626      "toys/other/watch.c",
627      "toys/other/which.c",
628      "toys/other/xxd.c",
629      "toys/other/yes.c",
630      "toys/pending/bootchartd.c",
631      "toys/pending/dd.c",
632      "toys/pending/getty.c",
633      "toys/pending/lsof.c",
634      "toys/pending/mdev.c",
635      "toys/pending/more.c",
636      "toys/pending/route.c",
637      "toys/pending/telnetd.c",
638      "toys/posix/basename.c",
639      "toys/posix/cal.c",
640      "toys/posix/cat.c",
641      "toys/posix/chgrp.c",
642      "toys/posix/chmod.c",
643      "toys/posix/cksum.c",
644      "toys/posix/cmp.c",
645      "toys/posix/comm.c",
646      "toys/posix/cp.c",
647      "toys/posix/cpio.c",
648      "toys/posix/cut.c",
649      "toys/posix/date.c",
650      "toys/posix/df.c",
651      "toys/posix/dirname.c",
652      "toys/posix/du.c",
653      "toys/posix/echo.c",
654      "toys/posix/env.c",
655      "toys/posix/expand.c",
656      "toys/posix/false.c",
657      "toys/posix/file.c",
658      "toys/posix/find.c",
659      "toys/posix/getconf.c",
660      "toys/posix/grep.c",
661      "toys/posix/head.c",
662      "toys/posix/iconv.c",
663      "toys/posix/id.c",
664      "toys/posix/kill.c",
665      "toys/posix/link.c",
666      "toys/posix/ln.c",
667      "toys/posix/logger.c",
668      "toys/posix/ls.c",
669      "toys/posix/mkdir.c",
670      "toys/posix/mkfifo.c",
671      "toys/posix/nice.c",
672      "toys/posix/nl.c",
673      "toys/posix/nohup.c",
674      "toys/posix/od.c",
675      "toys/posix/paste.c",
676      "toys/posix/patch.c",
677      "toys/posix/printf.c",
678      "toys/posix/ps.c",
679      "toys/posix/pwd.c",
680      "toys/posix/renice.c",
681      "toys/posix/rm.c",
682      "toys/posix/rmdir.c",
683      "toys/posix/sed.c",
684      "toys/posix/sleep.c",
685      "toys/posix/sort.c",
686      "toys/posix/split.c",
687      "toys/posix/strings.c",
688      "toys/posix/tail.c",
689      "toys/posix/tar.c",
690      "toys/posix/tee.c",
691      "toys/posix/test.c",
692      "toys/posix/time.c",
693      "toys/posix/touch.c",
694      "toys/posix/true.c",
695      "toys/posix/tty.c",
696      "toys/posix/ulimit.c",
697      "toys/posix/uname.c",
698      "toys/posix/uniq.c",
699      "toys/posix/unlink.c",
700      "toys/posix/uudecode.c",
701      "toys/posix/uuencode.c",
702      "toys/posix/wc.c",
703      "toys/posix/who.c",
704      "toys/posix/xargs.c",
705    ]
706
707    include_dirs = [ "./" ]
708
709    cflags_c = [
710      "-std=gnu11",
711      "-Wall",
712      "-Wundef",
713      "-Wno-char-subscripts",
714      "-Wno-implicit-function-declaration",
715      "-Wno-unused-variable",
716      "-Wno-unused-value",
717      "-Wno-incompatible-pointer-types",
718      "-Wno-int-conversion",
719      "-Wno-sign-compare",
720      "-Wno-format",
721      "-Wno-unused-result",
722      "-Os",
723      "-ffunction-sections",
724      "-fdata-sections",
725      "-fno-asynchronous-unwind-tables",
726      "-fPIE",
727      "-funsigned-char",
728      "-Wno-string-plus-int",
729      "-Wno-tautological-constant-compare",
730      "-Wno-string-conversion",
731      "-Wno-unused-but-set-variable",
732    ]
733
734    ldflags = [
735      "-pie",
736      "-Wl,-z,relro",
737      "-Wl,-z,now",
738      "-Wl,-z,noexecstack",
739      "-lm",
740      "-lcrypt",
741    ]
742
743    if (build_selinux) {
744      cflags_c += [
745        "-D_GUN_SOURCE",
746        "-DUSE_PCRE2",
747        "-w",
748        "-DWITH_SELINUX",
749        "-DCUSTOM_GET_CONTEXT",
750      ]
751    }
752
753    symlink_target_name = [
754      "acpi",
755      "arch",
756      "ascii",
757      "base64",
758      "basename",
759      "blockdev",
760      "bunzip2",
761      "bzcat",
762      "cal",
763      "cat",
764      "chattr",
765      "chcon",
766      "chgrp",
767      "chmod",
768      "chown",
769      "chroot",
770      "chrt",
771      "chvt",
772      "cksum",
773      "clear",
774      "cmp",
775      "comm",
776      "count",
777      "cp",
778      "cpio",
779      "crc32",
780      "cut",
781      "date",
782      "dd",
783      "devmem",
784      "df",
785      "dirname",
786      "dmesg",
787      "dnsdomainname",
788      "dos2unix",
789      "du",
790      "echo",
791      "egrep",
792      "eject",
793      "env",
794      "expand",
795      "factor",
796      "fallocate",
797      "false",
798      "fgrep",
799      "file",
800      "find",
801      "flock",
802      "fmt",
803      "free",
804      "freeramdisk",
805      "fsfreeze",
806      "fstype",
807      "fsync",
808      "ftpget",
809      "ftpput",
810      "getconf",
811      "grep",
812      "groups",
813      "gunzip",
814      "gzip",
815      "halt",
816      "head",
817      "help",
818      "hexedit",
819      "hostname",
820      "hwclock",
821      "i2cdetect",
822      "i2cdump",
823      "i2cget",
824      "i2cset",
825      "iconv",
826      "id",
827      "ifconfig",
828      "inotifyd",
829      "insmod",
830      "install",
831      "ionice",
832      "iorenice",
833      "iotop",
834      "kill",
835      "killall",
836      "killall5",
837      "link",
838      "ln",
839      "logger",
840      "login",
841      "logname",
842      "losetup",
843      "ls",
844      "lsattr",
845      "lsmod",
846      "lsof",
847      "lspci",
848      "lsusb",
849      "makedevs",
850      "mcookie",
851      "md5sum",
852      "microcom",
853      "mix",
854      "mkdir",
855      "mkfifo",
856      "mknod",
857      "mkpasswd",
858      "mkswap",
859      "mktemp",
860      "modinfo",
861      "more",
862      "mount",
863      "mountpoint",
864      "mv",
865      "nbd-client",
866      "netstat",
867      "nice",
868      "nl",
869      "nohup",
870      "nproc",
871      "nsenter",
872      "od",
873      "oneit",
874      "partprobe",
875      "passwd",
876      "paste",
877      "patch",
878      "pgrep",
879      "pidof",
880      "ping",
881      "ping6",
882      "pivot_root",
883      "pkill",
884      "pmap",
885      "poweroff",
886      "printenv",
887      "printf",
888      "prlimit",
889      "ps",
890      "pwd",
891      "pwdx",
892      "readahead",
893      "readlink",
894      "realpath",
895      "renice",
896      "reset",
897      "restorecon",
898      "rev",
899      "rfkill",
900      "rm",
901      "rmdir",
902      "rmmod",
903      "sed",
904      "sendevent",
905      "seq",
906      "setfattr",
907      "setsid",
908      "sha1sum",
909      "sha256sum",
910      "shred",
911      "sleep",
912      "sntp",
913      "sort",
914      "split",
915      "stat",
916      "strings",
917      "swapoff",
918      "swapon",
919      "switch_root",
920      "sync",
921      "sysctl",
922      "tac",
923      "tail",
924      "tar",
925      "taskset",
926      "tee",
927      "test",
928      "time",
929      "timeout",
930      "top",
931      "touch",
932      "true",
933      "truncate",
934      "tty",
935      "tunctl",
936      "ulimit",
937      "umount",
938      "uname",
939      "uniq",
940      "unix2dos",
941      "unlink",
942      "unshare",
943      "uptime",
944      "usleep",
945      "uudecode",
946      "uuencode",
947      "uuidgen",
948      "vconfig",
949      "vmstat",
950      "w",
951      "watch",
952      "wc",
953      "which",
954      "who",
955      "whoami",
956      "xargs",
957      "xxd",
958      "yes",
959      "zcat",
960    ]
961
962    deps = []
963    defines = [ "_DEFAULT_SOURCE" ]
964
965    if (build_selinux) {
966      sources += [ "toys/other/chcon.c" ]
967      external_deps = [
968        "openssl:libcrypto_shared",
969        "openssl:libssl_shared",
970        "selinux:libselinux",
971      ]
972      symlink_target_name += [ "chcon" ]
973      symlink_target_name -= [ "restorecon" ]
974
975      if (toybox_extended_cmd) {
976        defines += [ "TOYBOX_EXTENDED_CMD" ]
977        sources += [
978          "toys/pending/awk.c",
979          "toys/pending/diff.c",
980          "toys/pending/telnet.c",
981          "toys/pending/traceroute.c",
982          "toys/pending/wget.c",
983        ]
984        symlink_target_name += [
985          "traceroute",
986          "traceroute6",
987          "telnet",
988          "wget",
989          "awk",
990          "diff",
991        ]
992      }
993
994      if (build_variant == "user") {
995        defines += [ "TOYBOX_BUILD_USER" ]
996      }
997    }
998
999    part_name = "toybox"
1000    subsystem_name = "thirdparty"
1001    install_images = [
1002      "system",
1003      "ramdisk",
1004      "updater",
1005    ]
1006    install_enable = true
1007  }
1008}
1009