Loading

gjs-jhbuild.sh

  1. #!/bin/sh
  2.  
  3. # jhbuild-gjs.sh - A simple heler script for setting up JHBuild for GJS
  4.  
  5.  
  6. # Install JHBuild
  7. if [ ! `command -v jhbuild` ]; then
  8.     echo "Installing JHBuild..."
  9.    
  10.     # Get JHBuild
  11.     mkdir ~/jhbuild
  12.     cd ~/jhbuild
  13.     git clone --depth=1 https://gitlab.gnome.org/GNOME/jhbuild.git
  14.  
  15.     # Build & Install JHBuild
  16.     cd ~/jhbuild/jhbuild
  17.     ./autogen.sh --simple-install
  18.     make
  19.     make install
  20.    
  21.     # Check `jhbuild` is now in the $PATH
  22.     if [ ! `command -v jhbuild` ]; then
  23.         echo -n "jhbuild not found in \$PATH; continue anyways (y/n)? "
  24.         read path_error
  25.        
  26.         if [ "$path_error" == "${path_error#[Yy]}" ]; then
  27.             exit 1;
  28.         fi
  29.     fi
  30. fi
  31.  
  32.  
  33. # Configure JHBuild
  34. if [ ! -f ~/.config/jhbuildrc ]; then
  35.     echo "Configuring JHBuild..."
  36.  
  37.     # Ask if mozjs should be built with debug enabled
  38.     echo -n "Build mozjs with \`--enable-debug\` (y/n)? "
  39.     read mozjs_debug
  40.    
  41.     if [ "$mozjs_debug" == "${mozjs_debug#[Yy]}" ]; then
  42.         echo "module_autogenargs['mozjs60'] = '--enable-debug'" >> ~/.config/jhbuildrc
  43.     fi
  44.    
  45.     # Defacto options
  46.     echo "modules = ['gjs']" >> ~/.config/jhbuildrc
  47.     echo "skip = []" >> ~/.config/jhbuildrc
  48. fi
  49.  
  50.  
  51. # Check dependencies
  52. echo -n "Check dependencies before attempting to build (y/n)? "
  53. read check_deps
  54.        
  55. if [ "$check_deps" != "${check_deps#[Yy]}" ]; then
  56.  
  57.     echo
  58.     echo "\`jhbuild sysdeps gjs\`"
  59.     echo "---------------------"
  60.     echo "This command will list dependencies required to build GJS. Installing"
  61.     echo "requirements as system packages will greatly reduce the build time."
  62.     echo
  63.  
  64.     jhbuild sysdeps gjs
  65.     echo "---------------------------------------------------------------------"
  66.  
  67.     echo
  68.     echo "\`jhbuild list\`"
  69.     echo "---------------"
  70.     echo "This command will list the modules that will be built by JHBuild."
  71.     echo "Re-run this after installing packages and modifying the \`skip\` key"
  72.     echo "in '~/.config/jhbuildrc'. First run should list mozjs and gjs."
  73.     echo
  74.    
  75.     jhbuild list
  76.     echo "---------------------------------------------------------------------"
  77.    
  78.    
  79.     echo -n "Would you like to exit to install dependencies (y/n)? "
  80.     read quit_deps
  81.            
  82.     if [ "$quit_deps" != "${quit_deps#[Yy]}" ]; then
  83.         exit 0;
  84.     fi
  85. fi
  86.  
  87.  
  88. # Build GJS
  89. echo -n "Build GJS (y/n)? "
  90. read build_gjs
  91.        
  92. if [ "$build_gjs" != "${build_gjs#[Yy]}" ]; then
  93.  
  94.     echo "Building GJS..."
  95.     jhbuild build gjs
  96. fi