ports_rebrand.sh 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #!/bin/ksh
  2. #########################
  3. # Name: ports_rebrand.sh
  4. # Main: jadedctrl
  5. # Lisc: ISC # Desc: Editing OBSD ports
  6. # tree for use with
  7. # LBSD.
  8. #########################
  9. # Usage: ports_deblob.sh
  10. . ./libdeblob.sh
  11. PATCH_DIR=/tmp/ports_rebrand/
  12. if [ -e $PATCH_DIR ]
  13. then
  14. self_destruct_sequence $PATCH_DIR
  15. mkdir $PATCH_DIR
  16. else
  17. mkdir $PATCH_DIR
  18. fi
  19. if test -z $1
  20. then
  21. SRC_DIR=/usr/ports/
  22. else
  23. SRC_DIR=$1
  24. fi
  25. portdirs="archivers astro audio biology books cad chinese comms converters databases devel"
  26. portdirs="$portdirs editors education emulators fonts games geo graphics inputmethods"
  27. portdirs="$portdirs japanese java korean lang mail math meta misc multimedia net news plan9"
  28. portdirs="$portdirs print productivity security shells sysutils telephony textproc www x11"
  29. # for GNU autoconf
  30. # -----------------
  31. for portdir in $portdirs
  32. do
  33. for portpath in $SRC_DIR/$portdir/*
  34. do
  35. port=$(echo $portpath | sed 's^'"$SRC_DIR"'/^^')
  36. if grep "=.*gnu" $portpath/Makefile > /dev/null
  37. then
  38. lineadd ".include <bsd.port.mk>" "CONFIGURE_ENV += build_alias=\"\${ARCH}-unknown-openbsd6.3\"" $port/Makefile
  39. fi
  40. done
  41. done
  42. for portdir in $portdirs
  43. do
  44. for portpath in $SRC_DIR/$portdir/*
  45. do
  46. port=$(echo $portpath | sed 's^'"$SRC_DIR"'/^^')
  47. if grep "CONFIGURE_STYLE=gnu" $portpath/Makefile > /dev/null
  48. then
  49. lineadd ".include <bsd.port.mk>" "CONFIGURE_ENV += build_alias=\"\${ARCH}-unknown-openbsd6.3\"" $port/Makefile
  50. fi
  51. done
  52. done
  53. # for cmake
  54. # -----------------
  55. for portdir in $portdirs
  56. do
  57. for portpath in $SRC_DIR/$portdir/*
  58. do
  59. port=$(echo $portpath | sed 's^'"$SRC_DIR"'/^^')
  60. if grep "cmake" $portpath/Makefile > /dev/null
  61. then
  62. lineadd ".include <bsd.port.mk>" "CONFIGURE_ARGS += -DCMAKE_SYSTEM_NAME=OpenBSD" $port/Makefile
  63. fi
  64. done
  65. done
  66. # Port-specific changes for build
  67. rep ".include <bsd.port.mk>" "CONFIGURE_ENV += build_alias=\"\${ARCH}-unknown-openbsd\"" lang/ghc/Makefile
  68. lineadd "CONFIGURE_ENV += build_alias=\"\${ARCH}-unknown-openbsd\"" ".include <bsd.port.mk>" lang/ghc/Makefile
  69. lineadd "pre-configure:" " @cp \${FILESDIR}/Platform/LibertyBSD.cmake \${WRKSRC}/Modules/Platform/LibertyBSD.cmake" devel/cmake/Makefile
  70. lineadd "\${WRKSRC}/config" " @cp \${FILESDIR}/Makefile.openbsd ${WRKSRC}/config/Makefile.libertybsd" graphics/glew/Makefile
  71. dircp files/ports/files/cmake/Platform devel/cmake/files/Platform
  72. lineadd "pre-configure:" " @cp \${FILESDIR}/platforms/LibertyBSD.cmake \${WRKSRC}/cmake/platforms/LibertyBSD.cmake" devel/llvm/Makefile
  73. dircp files/ports/files/llvm/ devel/llvm/files/
  74. rep "-no-ssse3 -no-sse3" "-no-ssse3 -no-sse3 -platform openbsd-g++" x11/qt5/qtbase/Makefile
  75. rep "--enable-shared" "--enable-shared --target-os=openbsd" graphics/ffmpeg/Makefile
  76. # *.mk edits
  77. rep "\${MACHINE-ARCH}-openbsd" "\${MACHINE-ARCH}-libertybsd" infrastructure/mk/perl.port.mk
  78. # Misc. infrastructure edits
  79. lineadd "*:OpenBSD:*:*)" "*:LibertyBSD:*:*)" infrastructure/db/config.guess
  80. lineadd "*:OpenBSD:*:*)" " exit ;;" infrastructure/db/config.guess
  81. lineadd "*:OpenBSD:*:*)" " echo \${UNAME_MACHINE_ARCH}-unknown-openbsd\${UNAME_RELEASE}" infrastructure/db/config.guess
  82. lineadd "*:OpenBSD:*:*)" " UNAME_MACHINE_ARCH=\`arch | sed 's/^.*BSD\.//'\`" infrastructure/db/config.guess
  83. # Go through ports with additional patches for LBSD
  84. for category in files/ports/files/patches/*
  85. do
  86. category_name="$(echo $category | sed 's^.*/^^')"
  87. for port in $category
  88. do
  89. port_name="$(echo $port | sed 's^.*/^^')"
  90. for patch in $port
  91. do
  92. patch_name="$(echo $patch | sed 's^.*/^^')"
  93. filecp "files/ports/file/patches/$category_name/$port_name/$patch_name" "$category_name/$port_name/patches/$patch_name"
  94. done
  95. done
  96. done
  97. # Port-specific changes for rebranding
  98. rep "ftp.openbsd.org/pub/OpenBSD/snapshots/i386/cd52.iso" "ftp.libertybsd.net/pub/LibertyBSD/snapshots/i386/cd63.iso" emulators/qemu/pkg/README
  99. rep "ftp.openbsd.org/pub/OpenBSD/snapshots/amd64/cd52.iso" "ftp.libertybsd.net/pub/LibertyBSD/snapshots/amd64/cd63.iso" emulators/qemu/pkg/README
  100. linedel "\$ ftp ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/sparc/cd52.iso" emulators/qemu/pkg/README
  101. rep "install52.fs" "install63.fs" emulators/qemu/pkg/README
  102. rep "install52.iso" "install63.iso" emulators/qemu/pkg/README
  103. rep "OpenBSD" "LibertyBSD" emulators/qemu/pkg/README
  104. rep "ftp.openbsd.org" "ftp.libertybsd.net" sysutils/ruby-puppet/4/patches/patch-lib_puppet_provider_package-openbsd_rb
  105. rep "on OpenBSD" "on LibertyBSD" sysutils/sysmon/pkg/README ; rep "openbsd.org" "libertybsd.net" sysutils/sysmon/pkg/README
  106. rep "=\"OpenBSD " "=\"LibertyBSD " multimedia/gstreamer-0.10/Makefile.inc
  107. rep "openbsd.org" "libertybsd.net" multimedia/gstreamer-0.10/Makefile.inc
  108. # @jimmybot for this :) ^^
  109. rep "www.openbsd.org" "libertybsd.net" www/lynx/patches/patch-lynx_cfg
  110. apply