17-qi 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # Build script for qi.
  2. #
  3. # Copyright (c) 2015-2023 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 ${worktree}/qi ..."
  17. cd -- "${worktree}/qi"
  18. make -j1 clean
  19. ./configure \
  20. --prefix=/tools \
  21. --localstatedir=/var \
  22. --packagedir=/usr/pkg \
  23. --targetdir=/ \
  24. --arch=$package_arch
  25. make -j1 install
  26. # Clean up the source repository
  27. rm -f config.mak
  28. make -j1 clean
  29. # Make available "usr/pkg" directory and output directory
  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. /tools/etc/qirc
  36. # Set default compiler options for Dragora
  37. case $arch in
  38. i586)
  39. sed -i \
  40. -e 's|#QICFLAGS=.*|QICFLAGS=\"-O2 -march=pentium-mmx -mtune=pentiumpro -fstack-clash-protection -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  41. -e 's|#QICXXFLAGS=.*|QICXXFLAGS=\"-O2 -march=pentium-mmx -mtune=pentiumpro -fstack-clash-protection -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  42. -e 's|#QILDFLAGS=.*|QILDFLAGS=\"-s\"|' \
  43. -e 's|#QICPPFLAGS=.*|QICPPFLAGS=\"-D_FORTIFY_SOURCE=2\"|' \
  44. /tools/etc/qirc
  45. ;;
  46. x86_64)
  47. sed -i \
  48. -e 's|#QICFLAGS=.*|QICFLAGS=\"-O2 -march=x86-64 -fstack-clash-protection -fcf-protection=full -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  49. -e 's|#QICXXFLAGS=.*|QICXXFLAGS=\"-O2 -march=x86-64 -fstack-clash-protection -fcf-protection=full -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  50. -e 's|#QILDFLAGS=.*|QILDFLAGS=\"-s\"|' \
  51. -e 's|#QICPPFLAGS=.*|QICPPFLAGS=\"-D_FORTIFY_SOURCE=2\"|' \
  52. /tools/etc/qirc
  53. ;;
  54. *)
  55. sed -i \
  56. -e 's|#QICFLAGS=.*|QICFLAGS=\"-O2 -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  57. -e 's|#QICXXFLAGS=.*|QICXXFLAGS=\"-O2 -fstack-protector-strong --param=ssp-buffer-size=4 -pipe\"|' \
  58. -e 's|#QILDFLAGS=.*|QILDFLAGS=\"-s\"|' \
  59. -e 's|#QICPPFLAGS=.*|QICPPFLAGS=\"-D_FORTIFY_SOURCE=2\"|' \
  60. /tools/etc/qirc
  61. ;;
  62. esac
  63. # Include additional settings from targets/
  64. # We prefix '--enable-multilib' for targets supporting it,
  65. # the native GCC wants this option explicitly
  66. if test -n "$multilib_options"
  67. then
  68. case $multilib_options in
  69. *--disable-multilib* | *--enable-multilib* | *--with-multilib-list=)
  70. true
  71. ;;
  72. *)
  73. multilib_options="--enable-multilib $multilib_options"
  74. ;;
  75. esac
  76. fi
  77. cat << EOF >> /tools/etc/qirc
  78. # Multilib options
  79. multilib_options="$multilib_options"
  80. # lib<equal> suffix (multilib, if any)
  81. libSuffix="$libSuffix"
  82. # GCC (arch-specific) options
  83. gcc_options="$gcc_options"
  84. EOF
  85. chmod 644 /tools/etc/qirc