rbm.conf 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. # vim: filetype=yaml sw=2
  2. debug: '[% GET ! ENV.RBM_NO_DEBUG %]'
  3. compress_tar: gz
  4. output_dir: "out/[% project %]"
  5. tmp_dir: '[% c("basedir") %]/tmp'
  6. build_log: '[% GET ENV.RBM_LOGS_DIR ? ENV.RBM_LOGS_DIR : "logs" %]/[% project %][% IF c("var/osname") %]-[% c("var/osname") %][% END %].log'
  7. pkg_type: build
  8. steps:
  9. src-tarballs:
  10. compress_tar: xz
  11. src-tarballs: |
  12. #!/bin/bash
  13. set -e
  14. mkdir -p '[% dest_dir %]'
  15. mv -vf '[% project %]-[% c("version") %].tar.xz' '[% dest_dir %]/[% c("filename") %]'
  16. # buildconf contains build options that the user can change in rbm.local.conf
  17. # When adding a new option to buildconf, a default value should be defined
  18. # in var/build_id, so that changing this option does not affect the build_id.
  19. buildconf:
  20. num_procs: '[% GET ENV.RBM_NUM_PROCS ? ENV.RBM_NUM_PROCS : "4" %]'
  21. git_signtag_opt: '-s'
  22. deb_native_arch: arm64
  23. var:
  24. torbrowser_version: '8.5'
  25. torbrowser_build: 'build3'
  26. torbrowser_incremental_from:
  27. - 8.0.9
  28. project_name: tor-browser
  29. multi_lingual: 0
  30. build_mar: 1
  31. # By default, we sort the list of installed packages. This allows sharing
  32. # containers with identical list of packages, even if they are not listed
  33. # in the same order. In the cases where the installation order is
  34. # important, sort_deps should be set to 0.
  35. sort_deps: 1
  36. build_id: '[% sha256(c("var/build_id_txt", { buildconf => { num_procs => 4 } })).substr(0, 6) %]'
  37. build_id_txt: |
  38. [% c("version") %]
  39. [% IF c("git_hash") || c("hg_hash"); GET c("abbrev"); END; %]
  40. [% IF c("var/container/use_container") && ! c("var/container/global_disable") -%]
  41. [% c("var/container/suite") %]
  42. [% c("var/container/arch") %]
  43. [% END -%]
  44. input_files: [% c("input_files_id") %]
  45. build:
  46. [% c("build", { filename => 'f', output_dir => '/out' }) %]
  47. container:
  48. dir: '[% c("rbm_tmp_dir") %]/rbm-containers/[% sha256(c("build_id")) %]'
  49. user: rbm
  50. disable_network:
  51. # disable network in the build scripts
  52. build: 1
  53. input_files_list: |
  54. [% FOREACH file IN c("input_files_by_name").keys.sort -%]
  55. [% c("input_files_by_name/" _ file) %]
  56. [% END -%]
  57. faketime: "faketime -f \"[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]\""
  58. touch: "[% USE date %]touch -m -t [% date.format(c('timestamp'), format = '%Y%m%d%H%M') %]"
  59. locale_ja: ja
  60. locales:
  61. - ar
  62. - ca
  63. - cs
  64. - da
  65. - de
  66. - el
  67. - es-AR
  68. - es-ES
  69. - fa
  70. - fr
  71. - ga-IE
  72. - he
  73. - hu
  74. - id
  75. - is
  76. - it
  77. - '[% c("var/locale_ja") %]'
  78. - ka
  79. - ko
  80. - nb-NO
  81. - nl
  82. - pl
  83. - pt-BR
  84. - ru
  85. - sv-SE
  86. - tr
  87. - vi
  88. - zh-CN
  89. - zh-TW
  90. sign_build: '[% ENV.RBM_SIGN_BUILD %]'
  91. sign_build_gpg_opts: '[% ENV.RBM_GPG_OPTS %]'
  92. rezip: |
  93. rezip_tmpdir=$(mktemp -d)
  94. mkdir -p "$rezip_tmpdir/z"
  95. unzip -d "$rezip_tmpdir/z" -- [% c("rezip_file") %] || [ $? -lt 3 ]
  96. pushd "$rezip_tmpdir/z"
  97. [% c("zip", {
  98. zip_src => [ '.' ],
  99. zip_args => '$rezip_tmpdir/new.zip',
  100. }) %]
  101. popd
  102. mv -f -- "$rezip_tmpdir/new.zip" [% c("rezip_file") %]
  103. rm -Rf "$rezip_tmpdir"
  104. set_default_env: |
  105. set -e
  106. [% FOREACH env = c('ENV') -%]
  107. export [% env.key %]="[% env.value %]"
  108. [% END -%]
  109. rootdir=$(pwd)
  110. export SHELL=/bin/bash
  111. export HOME=$rootdir
  112. umask 0022
  113. [% IF c("var/container/global_disable") -%]
  114. rm -Rf /var/tmp/build /var/tmp/dist
  115. [% END -%]
  116. DOCSDIR_project: '[% project %]'
  117. set_PTDIR_DOCSDIR: |
  118. PTDIR="$distdir/TorBrowser/Tor/PluggableTransports"
  119. DOCSDIR="$distdir/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"
  120. targets:
  121. notarget: linux-x86_64
  122. noint:
  123. debug: 0
  124. release:
  125. var:
  126. release: 1
  127. channel: release
  128. alpha:
  129. var:
  130. alpha: 1
  131. channel: alpha
  132. nightly:
  133. fetch: 1
  134. var:
  135. nightly: 1
  136. channel: nightly
  137. torbrowser_version: tbb-nightly
  138. torbrowser-testbuild:
  139. - testbuild
  140. - alpha
  141. testbuild:
  142. var:
  143. testbuild: 1
  144. # Don't create mar files to save time
  145. build_mar: 0
  146. # The common-stretch target is used to build components that are common to all
  147. # platforms, using Debian stretch.
  148. common-stretch:
  149. var:
  150. common: 1
  151. container:
  152. suite: stretch
  153. arch: '[% c("buildconf/deb_native_arch") %]'
  154. pre_pkginst: ''
  155. deps:
  156. - build-essential
  157. - python
  158. - bison
  159. - automake
  160. - libtool
  161. - zip
  162. - unzip
  163. torbrowser-android-armv7:
  164. - android-armv7
  165. - android
  166. android-armv7:
  167. arch: armv7
  168. var:
  169. android-armv7: 1
  170. osname: android-armv7
  171. torbrowser-android-x86:
  172. - android-x86
  173. - android
  174. android-x86:
  175. arch: x86
  176. var:
  177. android-x86: 1
  178. osname: android-x86
  179. android:
  180. var:
  181. android: 1
  182. compiler: android-toolchain
  183. # API 16 is the minimum we currently support for Tor Browser on Android
  184. android_min_api: 16
  185. snowflake: 0
  186. fteproxy: 0
  187. container:
  188. suite: stretch
  189. arch: amd64
  190. deps:
  191. - build-essential
  192. - python
  193. - bison
  194. - automake
  195. - libtool
  196. - zip
  197. - unzip
  198. torbrowser-linux-x86_64:
  199. - linux-x86_64
  200. - linux
  201. torbrowser-linux-x86_64-debug:
  202. - linux-debug
  203. - linux-x86_64
  204. - linux
  205. torbrowser-linux-i686:
  206. - linux-i686
  207. - linux
  208. torbrowser-linux-armhf:
  209. - linux-armhf
  210. - linux
  211. torbrowser-linux-arm64:
  212. - linux-arm64
  213. - linux
  214. linux-x86_64:
  215. arch: x86_64
  216. var:
  217. linux-x86_64: 1
  218. osname: linux-x86_64
  219. gnu-build-triplet: x86_64-unknown-linux-gnu
  220. gnu-host-triplet: x86_64-unknown-linux-gnu
  221. linux-i686:
  222. arch: i686
  223. var:
  224. linux-i686: 1
  225. osname: linux-i686
  226. gnu-build-triplet: i686-unknown-linux-gnu
  227. gnu-host-triplet: i686-unknown-linux-gnu
  228. configure_opt_i686: '--host=i686-linux-gnu CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32'
  229. configure_opt: '[% c("var/configure_opt_i686") %]'
  230. linux-armhf:
  231. arch: arm
  232. var:
  233. linux-armhf: 1
  234. osname: linux-armhf
  235. gnu-build-triplet: armv7-unknown-linux-gnueabihf
  236. gnu-host-triplet: armv7-unknown-linux-gnueabihf
  237. container:
  238. arch: armhf
  239. # needs to be jessie for rust: rustc stage0 binary depends
  240. # on newer than wheezy glibc
  241. suite: jessie
  242. pre_pkginst: ''
  243. deps:
  244. - build-essential
  245. - python
  246. - bison
  247. - hardening-wrapper
  248. - automake
  249. - libtool
  250. - zip
  251. - unzip
  252. linux-arm64:
  253. arch: aarch64
  254. var:
  255. linux-arm64: 1
  256. osname: linux-arm64
  257. gnu-build-triplet: aarch64-unknown-linux-gnu
  258. gnu-host-triplet: aarch64-unknown-linux-gnu
  259. container:
  260. arch: arm64
  261. # jessie is the first 64-bit arm release...and has a bug
  262. # in glibc which fails firefox build (dlopen: cannot load any more object with static TLS)
  263. suite: stretch
  264. pre_pkginst: ''
  265. deps:
  266. - build-essential
  267. - python
  268. - bison
  269. - automake
  270. - libtool
  271. - zip
  272. - unzip
  273. linux:
  274. var:
  275. linux: 1
  276. compiler: gcc
  277. # We only build snowflake for linux and macOS on the alpha and nightly
  278. # channels for now.
  279. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  280. fteproxy: 1
  281. selfrando: '[% c("var/linux-x86_64") && ! c("var/release") %]'
  282. container:
  283. suite: wheezy
  284. arch: amd64
  285. pre_pkginst: dpkg --add-architecture i386
  286. deps:
  287. - libc6-dev-i386
  288. - lib32stdc++6
  289. - build-essential
  290. - python
  291. - bison
  292. - hardening-wrapper
  293. - automake
  294. - libtool
  295. - zip
  296. - unzip
  297. linux-debug:
  298. var:
  299. asan: 1
  300. torbrowser-windows-i686:
  301. - windows-i686
  302. - windows
  303. torbrowser-windows-x86_64:
  304. - windows-x86_64
  305. - windows
  306. windows-x86_64:
  307. arch: x86_64
  308. var:
  309. windows-x86_64: 1
  310. osname: windows-x86_64
  311. gnu-build-triplet: x86_64-unknown-linux-gnu
  312. gnu-host-triplet: x86_64-pc-windows-gnu
  313. container:
  314. arch: amd64
  315. faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
  316. # HEASLR is 64 bit only (see bug 12968)
  317. flag_HEASLR: '-Wl,--high-entropy-va'
  318. windows-i686:
  319. arch: i686
  320. var:
  321. windows-i686: 1
  322. osname: windows-i686
  323. gnu-build-triplet: i686-unknown-linux-gnu
  324. gnu-host-triplet: i686-pc-windows-gnu
  325. container:
  326. arch: i386
  327. faketime_path: /usr/lib/i386-linux-gnu/faketime/libfaketime.so.1
  328. setarch: |
  329. if test -z "$RBM_SETARCH"
  330. then
  331. export RBM_SETARCH=1
  332. exec setarch i686 ./build
  333. fi
  334. fteproxy: 1
  335. windows:
  336. var:
  337. windows: 1
  338. container:
  339. suite: jessie
  340. configure_opt: '--host=[% c("arch") %]-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]"'
  341. CFLAGS: '-fstack-protector-strong -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security [% c("var/flag_mwindows") %]'
  342. LDFLAGS: '-Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -lssp -L$gcclibs [% c("var/flag_HEASLR") %] [% c("var/flag_mwindows") %]'
  343. flag_mwindows: '-mwindows'
  344. compiler: mingw-w64
  345. deps:
  346. - build-essential
  347. - python
  348. - bison
  349. - automake
  350. - libtool
  351. - zip
  352. - unzip
  353. torbrowser-osx-x86_64:
  354. - osx-x86_64
  355. osx-x86_64:
  356. arch: x86_64
  357. var:
  358. osx: 1
  359. osname: osx-x86_64
  360. gnu-build-triplet: x86_64-unknown-linux-gnu
  361. gnu-host-triplet: x86_64-apple-darwin11
  362. container:
  363. suite: jessie
  364. arch: amd64
  365. compiler: 'macosx-toolchain'
  366. configure_opt: '--host=x86_64-apple-darwin11 CC="x86_64-apple-darwin11-clang [% c("var/FLAGS") %]" CXX="x86_64-apple-darwin11-clang++ [% c("var/FLAGS") %]"'
  367. FLAGS: "-target x86_64-apple-darwin11 -B $cctoolsdir -isysroot $sysrootdir"
  368. LDFLAGS: "-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie"
  369. locale_ja: ja-JP-mac
  370. # We only build snowflake for linux and macOS on the alpha and nightly
  371. # channels for now.
  372. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  373. deps:
  374. - build-essential
  375. - python
  376. - bison
  377. - automake
  378. - libtool
  379. - zip
  380. - unzip
  381. faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
  382. set_PTDIR_DOCSDIR: |
  383. PTDIR="$distdir/Contents/MacOS/Tor/PluggableTransports"
  384. DOCSDIR="$distdir/Contents/Resources/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"
  385. # The no_build_id target can be useful if you want to quickly display
  386. # a build template or other option but don't want to spend time to
  387. # compute the various build ids
  388. no_build_id:
  389. # The defaut timestamp value will use the commit time of the
  390. # selected commit for the project, which will require cloning the
  391. # git repository if it is not present. When we use the no_build_id
  392. # target to display a script, we usually don't care about such
  393. # details, so we set timestamp to 0 to avoid unnecessary cloning.
  394. timestamp: 0
  395. var:
  396. build_id: 1
  397. no_containers:
  398. var:
  399. container:
  400. global_disable: 1
  401. # change the default gpg_wrapper to allow git tag signed using an
  402. # expired key.
  403. # https://bugs.torproject.org/19737
  404. gpg_wrapper: |
  405. #!/bin/bash
  406. export LC_ALL=C
  407. [%
  408. IF c('gpg_keyring');
  409. SET gpg_kr = '--keyring ' _ path(c('gpg_keyring'), path(c('gpg_keyring_dir'))) _ ' --no-default-keyring';
  410. END;
  411. -%]
  412. gpg_verify=0
  413. for opt in "$@"
  414. do
  415. test "$opt" = '--verify' && gpg_verify=1
  416. done
  417. if [ $gpg_verify = 1 ]
  418. then
  419. [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@" | sed 's/^\[GNUPG:\] EXPKEYSIG /\[GNUPG:\] GOODSIG /'
  420. exit ${PIPESTATUS[0]}
  421. else
  422. exec [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@"
  423. fi
  424. remote_start: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("runc/remote_start") %][% END %]'
  425. remote_exec: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("runc/remote_exec") %][% END %]'
  426. remote_put: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("runc/remote_put") %][% END %]'
  427. remote_get: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("runc/remote_get") %][% END %]'
  428. remote_finish: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("runc/remote_finish") %][% END %]'
  429. runc:
  430. remote_start: |
  431. #!/bin/sh
  432. set -e
  433. if [ $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'* | wc -l) -ne 1 ]
  434. then
  435. echo "Can't find container image in input files" >&2
  436. ls -l '[% c("remote_srcdir") %]' >&2
  437. exit 1
  438. fi
  439. mkdir -p '[% c("var/container/dir") %]'/rootfs/rbm
  440. sudo tar -C '[% c("var/container/dir") %]'/rootfs -xf $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'*)
  441. [% SET user = c("var/container/user") -%]
  442. [% c("remote_exec", { exec_as_root => 1, exec_cmd => 'id ' _ user
  443. _ ' >/dev/null 2>&1 || adduser -m ' _ user _ ' || useradd -m ' _ user }) %]
  444. remote_exec: |
  445. #!/bin/sh
  446. set -e
  447. [% IF c("interactive") -%]
  448. echo Container directory: [% shell_quote(c("var/container/dir")) %]
  449. [% END -%]
  450. mkdir -p '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs/rbm
  451. echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rootfs/rbm/cmd
  452. echo [% shell_quote(c('exec_cmd')) %] >> '[% c("var/container/dir") %]'/rootfs/rbm/cmd
  453. echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rootfs/rbm/run
  454. [% IF c('exec_as_root'); SET user = 'root'; ELSE; SET user = c("var/container/user", { error_if_undef => 1 }); END; %]
  455. echo 'su - [% user %] -c /rbm/cmd' >> '[% c("var/container/dir") %]'/rootfs/rbm/run
  456. chmod +x '[% c("var/container/dir") %]'/rootfs/rbm/cmd
  457. chmod +x '[% c("var/container/dir") %]'/rootfs/rbm/run
  458. cat > '[% c("var/container/dir") %]'/config.json << EOF
  459. [% INCLUDE 'runc-config.json' %]
  460. EOF
  461. [% IF c("var/container/disable_network/" _ c("exec_name")) -%]
  462. sudo ip netns add 'rbm-[% sha256(c("build_id", { error_if_undef => 1 })) %]'
  463. [% END -%]
  464. sudo runc [% IF c("var_p/runc100") %]run[% ELSE %]start[% END %] -b '[% c("var/container/dir") %]' rbm-[% sha256(c("build_id", { error_if_undef => 1 })) %] [% IF c("runc_hide_stderr") %]2>/dev/null[% END %]
  465. [% IF c("var/container/disable_network/" _ c("exec_name")) -%]
  466. sudo ip netns delete 'rbm-[% sha256(c("build_id", { error_if_undef => 1 })) %]'
  467. [% END -%]
  468. remote_put: |
  469. #!/bin/sh
  470. set -e
  471. [%
  472. SET src = shell_quote(c('put_src', { error_if_undef => 1 }));
  473. SET dst = shell_quote(c('put_dst', { error_if_undef => 1 }));
  474. -%]
  475. sudo mkdir -p '[% c("var/container/dir") %]'/rootfs/[% dst %]
  476. sudo cp -aP [% src %] '[% c("var/container/dir") %]'/rootfs/[% dst %]
  477. # On Ubuntu, the /root/.profile file contains a `mesg n` line which is
  478. # producing some `stdin: is not a tty` messages. To hide them, we hide
  479. # stderr from this part by setting runc_hide_stderr.
  480. [% c("remote_exec", { exec_as_root => 1, exec_cmd => 'chown -R ' _ c("var/container/user") _ ' ' _ dst, runc_hide_stderr => 1 }) %]
  481. remote_get: |
  482. #!/bin/sh
  483. set -e
  484. [%
  485. SET src = shell_quote(c('get_src', { error_if_undef => 1 }));
  486. SET dst = shell_quote(c('get_dst', { error_if_undef => 1 }));
  487. -%]
  488. mkdir -p [% dst %]
  489. srcdir='[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs/[% src %]
  490. sudo chown -R $(whoami) "$srcdir"
  491. if [ $(ls -1 "$srcdir"/* 2> /dev/null | wc -l) -gt 0 ]
  492. then
  493. for file in "$srcdir"/*
  494. do
  495. bname="$(basename "$file")"
  496. test -e [% dst %]/"$bname" && rm -Rf [% dst %]/"$bname"
  497. mv -f "$file" [% dst %]/
  498. done
  499. fi
  500. remote_finish: |
  501. #!/bin/sh
  502. set -e
  503. sudo rm -Rf '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs '[% c("var/container/dir", { error_if_undef => 1 }) %]'/config.json
  504. rmdir '[% c("var/container/dir") %]'
  505. ENV:
  506. TZ: UTC
  507. LC_ALL: C
  508. --- |
  509. # This part of the file contains options written in perl
  510. use IO::CaptureOutput qw(capture_exec);
  511. (
  512. var_p => {
  513. # runc100 is true if we are using runc >= 1.0.0
  514. # we assume that any version that is not 0.1.1 is >= 1.0.0
  515. runc100 => sub {
  516. my ($out) = capture_exec('sudo', 'runc', '--version');
  517. return !($out =~ m/^runc version 0.1.1/);
  518. },
  519. # runc_spec100 is true if runc spec is at least 1.0.0
  520. # We will need to update this when there is a new spec version available
  521. runc_spec100 => sub {
  522. my ($out) = capture_exec('sudo', 'runc', '--version');
  523. return $out =~ m/^.*spec: 1\.[0-9]+\.[0-9]+(?:-dev)?$/m;
  524. },
  525. },
  526. )