17-qi 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Build script for qi.
  2. #
  3. # Copyright (c) 2015-2022 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. echo "Making Qi from ${CWD}/qi ..."
  17. cd -- "${CWD}/qi"
  18. make -j1 clean
  19. ./configure \
  20. --prefix=/tools \
  21. --packagedir=/usr/pkg \
  22. --targetdir=/ \
  23. --arch=$package_arch
  24. make -j1 install
  25. # Clean up the source repository
  26. rm -f config.mak
  27. make -j1 clean
  28. # Make "usr/pkg" directory and output
  29. # directory for packages available
  30. mkdir -p -- "${rootdir}/usr/pkg" "${rootdir}/var/cache/qi/packages"
  31. # Adjust prefixes in config for final system installation
  32. sed -i \
  33. -e 's|/tools|/usr|g' \
  34. -e 's|/usr/etc|/etc|' \
  35. -e 's|/usr/var|/var|' \
  36. /tools/etc/qirc
  37. # Set default compiler options for Dragora
  38. case $arch in
  39. i586)
  40. sed -i \
  41. -e 's|#QICFLAGS=.*|QICFLAGS=\"-O2 -march=pentium-mmx -mtune=pentiumpro -fstack-clash-protection -fcf-protection=full -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  42. -e 's|#QICXXFLAGS=.*|QICXXFLAGS=\"-O2 -march=pentium-mmx -mtune=pentiumpro -fstack-clash-protection -fcf-protection=full -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  43. -e 's|#QILDFLAGS=.*|QILDFLAGS=\"-s\"|' \
  44. -e 's|#QICPPFLAGS=.*|QICPPFLAGS=\"-D_FORTIFY_SOURCE=2\"|' \
  45. /tools/etc/qirc
  46. ;;
  47. x86_64)
  48. sed -i \
  49. -e 's|#QICFLAGS=.*|QICFLAGS=\"-O2 -march=x86-64 -fstack-clash-protection -fcf-protection=full -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  50. -e 's|#QICXXFLAGS=.*|QICXXFLAGS=\"-O2 -march=x86-64 -fstack-clash-protection -fcf-protection=full -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  51. -e 's|#QILDFLAGS=.*|QILDFLAGS=\"-s\"|' \
  52. -e 's|#QICPPFLAGS=.*|QICPPFLAGS=\"-D_FORTIFY_SOURCE=2\"|' \
  53. /tools/etc/qirc
  54. ;;
  55. *)
  56. sed -i \
  57. -e 's|#QICFLAGS=.*|QICFLAGS=\"-O2 -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  58. -e 's|#QICXXFLAGS=.*|QICXXFLAGS=\"-O2 -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  59. -e 's|#QILDFLAGS=.*|QILDFLAGS=\"-s\"|' \
  60. -e 's|#QICPPFLAGS=.*|QICPPFLAGS=\"-D_FORTIFY_SOURCE=2\"|' \
  61. /tools/etc/qirc
  62. ;;
  63. esac
  64. # Include additional settings from targets/
  65. # We prefix '--enable-multilib' for targets supporting it,
  66. # the native GCC wants this option explicitly
  67. if test -n "$multilib_options"
  68. then
  69. case $multilib_options in
  70. *--disable-multilib* | *--enable-multilib* | *--with-multilib-list=)
  71. true
  72. ;;
  73. *)
  74. multilib_options="--enable-multilib $multilib_options"
  75. ;;
  76. esac
  77. fi
  78. cat << EOF >> /tools/etc/qirc
  79. # Multilib options
  80. multilib_options="$multilib_options"
  81. # lib<equal> suffix (multilib, if any)
  82. libSuffix="$libSuffix"
  83. # GCC (arch-specific) options
  84. gcc_options="$gcc_options"
  85. EOF
  86. chmod 644 /tools/etc/qirc