| 1 | #! /bin/sh -e |
| 2 | ### |
| 3 | ### Wrapper around `sbuild' builds |
| 4 | ### |
| 5 | ### (c) 2018 Mark Wooding |
| 6 | ### |
| 7 | |
| 8 | ###----- Licensing notice --------------------------------------------------- |
| 9 | ### |
| 10 | ### This file is part of the distorted.org.uk chroot maintenance tools. |
| 11 | ### |
| 12 | ### distorted-chroot is free software: you can redistribute it and/or |
| 13 | ### modify it under the terms of the GNU General Public License as |
| 14 | ### published by the Free Software Foundation; either version 2 of the |
| 15 | ### License, or (at your option) any later version. |
| 16 | ### |
| 17 | ### distorted-chroot is distributed in the hope that it will be useful, |
| 18 | ### but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 20 | ### General Public License for more details. |
| 21 | ### |
| 22 | ### You should have received a copy of the GNU General Public License |
| 23 | ### along with distorted-chroot. If not, write to the Free Software |
| 24 | ### Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 25 | ### USA. |
| 26 | |
| 27 | ## Set up compiler caching. This makes a big difference to build times. |
| 28 | PATH=/usr/lib/ccache:$PATH; export PATH |
| 29 | CCACHE_DIR=/build/.ccache/$SCHROOT_CHROOT_NAME; export CCACHE_DIR |
| 30 | unset CCACHE_HARDLINK |
| 31 | CCACHE_COMPRESS=t; export CCACHE_COMPRESS |
| 32 | CCACHE_UMASK=002; export CCACHE_UMASK |
| 33 | |
| 34 | ## Hack the build options. `sbuild' tries to turn off testing for |
| 35 | ## cross-builds, which is exactly wrong. Turn them back on unless I really |
| 36 | ## want them off. |
| 37 | old=$DEB_BUILD_OPTIONS new= force_nocheck=nil |
| 38 | for o in $old; do |
| 39 | case $o in x-mdw-nocheck) force_nocheck=t ;; esac |
| 40 | done |
| 41 | for o in $old; do |
| 42 | include=t |
| 43 | case $o in |
| 44 | x-mdw-nocheck) include=nil ;; |
| 45 | nocheck) include=$force_nocheck ;; |
| 46 | esac |
| 47 | case $include in |
| 48 | t) new=${new:+$new }$o ;; |
| 49 | esac |
| 50 | done |
| 51 | DEB_BUILD_OPTIONS=$new; export DEB_BUILD_OPTIONS |
| 52 | |
| 53 | ## Preset the library search path to find the tools version of `fakeroot'. |
| 54 | for i in /usr/lib/*/libfakeroot; do |
| 55 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH+$LD_LIBRARY_PATH:}$i |
| 56 | done |
| 57 | export LD_LIBRARY_PATH |
| 58 | |
| 59 | ## We're ready to go. |
| 60 | exec "$@" |