build_setup.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/bin/bash
  2. # Build various setups..
  3. # inputs:
  4. # directory with the common media
  5. Q3SETUPMEDIA=/home/timo/Id/Q3SetupMedia/quake3
  6. # directory with binaries tree
  7. Q3BINARIES=../install
  8. # version: $1
  9. VERSION=$1
  10. # temporary directory used to prepare the files
  11. # NOTE: this dir is erased before a new setup is built
  12. TMPDIR=setup.tmp
  13. # location of the setup dir (for graphical installer and makeself)
  14. SETUPDIR=setup
  15. # cp setup phase
  16. # we need to copy the symlinked files, and not the symlinks themselves
  17. # on antares this is forced with a cp -L
  18. # on spoutnik, -L is not recognized, and dereference is the default behaviour
  19. # we need a robust way of checking
  20. TESTFILE=/tmp/foo$$
  21. touch $TESTFILE
  22. # see if option is supported
  23. cp -L $TESTFILE $TESTFILE.cp 2>/dev/null
  24. if [ $? -eq 1 ]
  25. then
  26. # option not supported, should be on by default
  27. echo "cp doesn't have -L option"
  28. unset CPOPT
  29. else
  30. # option supported, use it
  31. echo "cp supports -L option"
  32. CPOPT="-L"
  33. fi
  34. rm $TESTFILE
  35. # graphical installer (based on Loki Software's Setup tool)
  36. build_installer ()
  37. {
  38. TMPDIR=setup.tmp
  39. rm -rf $TMPDIR
  40. mkdir $TMPDIR
  41. # copy base setup files
  42. cp $CPOPT -R $SETUPDIR/setup.sh $SETUPDIR/setup.data $TMPDIR
  43. # copy media files
  44. cp $CPOPT -R $Q3SETUPMEDIA/* $TMPDIR
  45. # remove CVS entries
  46. find $TMPDIR -name CVS | xargs rm -rf
  47. # copy binaries
  48. mkdir -p $TMPDIR/bin/x86
  49. # smp
  50. cp $CPOPT $Q3BINARIES/linuxquake3-smp $TMPDIR/bin/x86/quake3-smp.x86
  51. strip $TMPDIR/bin/x86/quake3-smp.x86
  52. brandelf -t Linux $TMPDIR/bin/x86/quake3-smp.x86
  53. # old school
  54. cp $CPOPT $Q3BINARIES/linuxquake3 $TMPDIR/bin/x86/quake3.x86
  55. strip $TMPDIR/bin/x86/quake3.x86
  56. brandelf -t Linux $TMPDIR/bin/x86/quake3.x86
  57. # ded
  58. cp $CPOPT $Q3BINARIES/linuxq3ded $TMPDIR/bin/x86/q3ded
  59. strip $TMPDIR/bin/x86/q3ded
  60. brandelf -t Linux $TMPDIR/bin/x86/q3ded
  61. # PB files
  62. mkdir -p $TMPDIR/pb/htm
  63. cp $CPOPT ../pb/linux/*.so $TMPDIR/pb
  64. cp $CPOPT ../pb/htm/*.htm $TMPDIR/pb/htm
  65. # Linux FAQ
  66. mkdir -p $TMPDIR/Docs/LinuxFAQ
  67. cp $CPOPT LinuxSupport/* $TMPDIR/Docs/LinuxFAQ
  68. # generated .qvm pk3 files
  69. mkdir -p $TMPDIR/baseq3
  70. mkdir -p $TMPDIR/missionpack
  71. # not needed now
  72. #cp $CPOPT $Q3BINARIES/baseq3/pak8.pk3 $TMPDIR/baseq3/
  73. #cp $CPOPT $Q3BINARIES/missionpack/pak3.pk3 $TMPDIR/missionpack/
  74. # menu shortcut to the game
  75. # FIXME current setup doesn't have a way to set symlinks on arbitrary things
  76. # so we use a dummy quake3 script (which will be overwritten by postinstall.sh)
  77. echo -e "#!/bin/sh\necho \"If you read this, then the setup script failed miserably.\nPlease report to ttimo@idsoftware.com\n\"" > $TMPDIR/bin/x86/quake3
  78. echo -e "#!/bin/sh\necho \"If you read this, then the setup script failed miserably.\nPlease report to ttimo@idsoftware.com\n\"" > $TMPDIR/bin/x86/quake3-smp
  79. # create the auto-extractible archive
  80. # first step: on FreeBSD we would default to Linux binaries .. use a symlink
  81. (
  82. cd $TMPDIR/setup.data/bin
  83. ln -s Linux FreeBSD
  84. ln -s Linux NetBSD
  85. ln -s Linux OpenBSD
  86. )
  87. # NOTE: we used to pass the $VERSION, but it doesn't seem very usefull
  88. ./$SETUPDIR/makeself/makeself.sh $TMPDIR linuxq3apoint-$VERSION.x86.run "Quake III Arena Point Release $VERSION " ./setup.sh
  89. chmod a+rx linuxq3apoint-$VERSION.x86.run
  90. #rm -rf $TMPDIR
  91. }
  92. check_brandelf()
  93. {
  94. # make sure brandelf is installed to avoid any problem when building the setups
  95. BRAND=`which brandelf`;
  96. if [ -n "$BRAND" ] && [ -x "$BRAND" ]
  97. then
  98. echo "brandelf is present: $BRAND"
  99. else
  100. echo "brandelf not found"
  101. exit
  102. fi
  103. }
  104. # safe checks
  105. check_brandelf
  106. build_installer