SHARE
TWEET

Untitled

a guest Aug 14th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # Build zeromq and czmq
  3.  
  4. ZMQ="zeromq3-x"
  5. CZMQ="czmq-1.3.2"
  6. CPUN=`grep -c processor /proc/cpuinfo`
  7.  
  8. TOPDIR="$PWD"
  9. ARCH=$1
  10. OUTDIR="$TOPDIR/output/${ARCH}"
  11. LOGFILE="$OUTDIR/build.log"
  12.  
  13. func_display_help()
  14. {
  15.     echo "************** Usage **************"
  16.     echo "./build_android.sh [ARCH] [OPTION]"
  17.     echo "[ARCH]   : arm, x86, arm64, x86_64"
  18.     echo "[OPTION] : clean or not."
  19.     exit 1
  20. }
  21.  
  22. if [ $1 = "--help" ] ; then
  23.     func_display_help
  24. fi
  25.  
  26. if [ $# == 1 -o $# == 2 ] ; then
  27.     if [ $ARCH = "arm" ] ; then
  28.         TOOLCHAIN="arm-linux-androideabi"
  29.     elif [ "$ARCH" == "x86" ] ; then
  30.         TOOLCHAIN="i686-linux-android"
  31.     elif [ "$ARCH" == "arm64" ] ; then
  32.         TOOLCHAIN="aarch64-linux-android"
  33.     elif [ $ARCH = "x86_64" ] ; then
  34.         TOOLCHAIN="x86_64-linux-android"
  35.     else
  36.         echo "Invalid [ARCH] argument!!!"
  37.         func_display_help
  38.     fi
  39.  
  40.     if [ $# == 2 ] ; then
  41.         if [ $2 = "clean" ] ; then
  42.             echo "Remove $OUTDIR . $ZMQ . $CZMQ directory..."
  43.             rm -Rf $OUTDIR
  44.             cd $TOPDIR/$ZMQ
  45.             make clean; make distclean;
  46.             cd $TOPDIR/$CZMQ
  47.             make clean; make distclean;
  48.             exit 1
  49.         fi
  50.         echo "Invalid [OPTION] argument!!!"
  51.         func_display_help
  52.     fi
  53.  
  54. else
  55.     echo "Invalid arguments!!!"
  56.     func_display_help
  57. fi
  58.  
  59.  
  60. if [ -d $OUTDIR  ]; then
  61. echo "Remove $OUTDIR . $ZMQ . $CZMQ directory..."
  62. rm -Rf $OUTDIR
  63. fi
  64.  
  65. cd $TOPDIR/$ZMQ
  66. make clean; make distclean;
  67. cd $TOPDIR/$CZMQ
  68. make clean; make distclean;
  69.  
  70. mkdir $OUTDIR
  71.  
  72. cd $TOPDIR/$ZMQ
  73. find ./ -name \*.sh -o -name configure | xargs chmod +x
  74.  
  75. ./autogen.sh 2>&1 | tee $LOGFILE
  76. ./configure --host=$TOOLCHAIN --enable-static --disable-shared --prefix=$OUTDIR CXXFLAGS="-Wno-error -O3 -fPIC -I$OUTDIR/include" 2>&1 | tee -a $LOGFILE
  77.  
  78. make -j$CPUN 2>&1 | tee -a $LOGFILE
  79. make install 2>&1 | tee -a $LOGFILE
  80.  
  81.  
  82. cd $TOPDIR/$CZMQ
  83. find ./ -name \*.sh -o -name configure -o -name mkman | xargs chmod +x
  84.  
  85. ./configure --host=arm-linux-androideabi --enable-static --disable-shared --prefix=$OUTDIR LDFLAGS="-L$OUTDIR/lib" CFLAGS="-O3 -I$OUTDIR/include" LIBS="-lc -lm -lstdc++"
  86.  
  87. make -j$CPUN 2>&1 | tee -a $LOGFILE
  88. make install 2>&1 | tee -a $LOGFILE
  89.  
  90. cd $TOPDIR
  91.  
  92. ls -alh $OUTDIR/lib/ 2>&1 | tee -a $LOGFILE
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top