summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7402339647a8fa87ecf50ab95c89cd7e5e25c3fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Maintainer: Kris McCleary <kris27mc@gmail.com>

pkgname=mcpelauncher-linux
pkgver=20170723.r92.25f7d37
pkgrel=1
pkgdesc="Minecraft PE launcher for Linux"
arch=('x86_64')
url="https://kris27mc.github.io"
license=('BSD')
groups=()
depends=('lib32-zlib' 'lib32-ncurses' 'gts' 'libglvnd' 'lib32-libglvnd' 'lib32-libxext' 'lib32-libx11' 'lib32-libpng' 'lib32-util-linux' 'lib32-glibc')
makedepends=('wget' 'cmake' 'gcc-multilib')
optdepends=()
source=("git+https://github.com/kris27mc/mcpelauncher-linux.git")

pkgver() {
cd mcpelauncher-linux

printf "%s.r%s.%s" \
 "$(git show -s --format=%ci master | sed 's/\ .*//g;s/-//g')" \
 "$(git rev-list --count HEAD)" \
 "$(git rev-parse --short HEAD)"
         }

build() {
  cd mcpelauncher-linux
  if grep -qi "amd" /proc/cpuinfo;  then
  /usr/bin/cp -r libs/AMD/* libs/
  printf "Using compatibility libs"
  sleep 3
fi

#Compiles mcpelauncher
cmake .
make

#Checks for complete build
if [ ! -e "mcpelauncher" ]; then
  echo "Error: mcpelauncher missing. Build failed"
  exit
fi
        }

package(){
  cd mcpelauncher-linux
  #Moves compiled files to new dir
  if [ ! -e "/usr/share/mcpelauncher" ]; then
  sudo mkdir /usr/share/mcpelauncher
fi
  sudo cp -t /usr/share/mcpelauncher mcpelauncher extract.sh LICENSE mcpelauncher.desktop MCPEicon.png
  sudo cp -r libs /usr/share/mcpelauncher/libs
  cd /usr/share/mcpelauncher

  #Acquires apk
  printf "\nWhich method would you like to use to acquire an APK?\n"
  printf "1) Google-Play-API (currently broken)\n"
  printf "2) Hosted download (ONLY USE IF YOU OWN MCPE!)\n"
  printf "3) Local file\n"
  printf "\nEnter your selection: "
  read answer
  echo "$answer"
  #Google-Play-API
  if [[ "$answer" == "1" ]]; then
    git clone https://github.com/MCMrARM/Google-Play-API.git
    cd Google-Play-API
    cmake .
    make
    ./gplaydl -tos -a com.mojang.minecraftpe
    sudo cp *.apk /usr/share/mcpelauncher
    cd /usr/share/mcpelauncher
    sudo rm -R Google-Play-API
  fi

  #Hosted apk
  if [[ "$answer" == "2" ]]; then
    wget https://kris27mc.github.io/files/mcpe.apk
  #  /usr/bin/cp mcpe.apk ~/mcpelauncher
  fi

  #Local file
  if [[ "$answer" == "3" ]]; then
    printf "Please enter the full path to your apk.\n"
    printf "Path to APK: "
    read -e pathtoapk
    if grep mcpe.apk <<< echo "$pathtoapk"; then
      sudo cp "$pathtoapk" /usr/share/mcpelauncher/mcpe-new.apk
    else
      sudo cp "$pathtoapk" /usr/share/mcpelauncher
    fi
  fi

  #Extracts apk into assets
  if [[ "$answer" == "1" || "$input" == "3" ]]; then
    if [ -f "mcpe.apk" ]; then
      sudo mkdir oldapks
      sudo mv mcpe.apk oldapks
      sudo mv *.apk mcpe.apk
    fi
  fi

  sudo ./extract.sh mcpe.apk
  sudo chmod -R 777 /usr/share/mcpelauncher

  #Creates desktop launcher
  sudo cp mcpelauncher.desktop /usr/share/applications

  #printf "\nWould you like to create a shortcut on your desktop? (y/n)\n"
  #read input
  #if [[ $input == "Y" || "$input" == "y" ]]; then
  #  printf "Creating a shortcut..."
  #  cp mcpelauncher.desktop ~/Desktop
  #else
  #  printf "No desktop shortcut created."
  #fi
}
md5sums=('SKIP')