Introduction to Gedit
        
        
          The Gedit package contains a
          lightweight UTF-8 text editor for the GNOME Desktop. It needs a group of packages to
          be installed before Gedit itself.
          This page will install all of them.
        
        
          ![[Note]](../images/note.png) 
          
            Note
          
          
            Development versions of BLFS may not build or run some packages
            properly if LFS or dependencies have been updated since the most
            recent stable versions of the books.
          
         
        
          Package Information
        
        
        
          Additional Downloads
        
        
          Gedit requires several libraries:
        
        
        
          Gedit Dependencies
        
        
          Required
        
        
          gsettings-desktop-schemas-49.1,
          GTK-3.24.51, itstool-2.0.7,
          libhandy-1.8.3, libpeas-1.36.0,
          and libxml2-2.15.1
        
        
          Recommended
        
        
          gspell-1.14.0, Gvfs-1.56.1 (runtime),
          ISO Codes-4.18.0, and PyGObject-3.52.3 (Python3 module)
        
        
          Optional
        
        
          GTK-Doc-1.35.1 (for documentation), Vala-0.56.18, Valgrind-3.26.0, and zeitgeist
        
       
      
        
          Installation of Gedit
        
        
          The first task is to install the needed libraries. Since all the
          packages have the same build instructions, they can be built in one
          go using a loop.
        
        
          ![[Note]](../images/note.png) 
          
            Note
          
          
            When installing multiple packages in a script, the installation
            needs to be done as the root user. There are three general
            options that can be used to do this:
          
          
            
              - 
                
                  Run the entire script as the root user (not recommended).
                 
- 
                
                  Use the sudo
                  command from the Sudo-1.9.17p2 package.
                 
- 
                
                  Use su -c "command
                  arguments" (quotes required) which will ask
                  for the root password for every iteration of the loop.
                 
 
          
            One way to handle this situation is to create a short
            bash function that
            automatically selects the appropriate method. Once the command is
            set in the environment, it does not need to be set again.
          
          as_root()
{
  if   [ $EUID = 0 ];        then $*
  elif [ -x /usr/bin/sudo ]; then sudo $*
  else                            su -c \\"$*\\"
  fi
}
export -f as_root
         
        
          All of the packages come with a test suite. If you wish to execute
          them, either comment out the rm -rf
          ... below, so that, after all the packages are
          installed, you can come back to the corresponding directory and run
          ninja test, or do
          individual builds, running the tests for each of the packages.
          Alternatively, you can uncomment the line #ninja test ..., and at the end,
          check the test results with:
        
        grep -A5 Ok: *test.log
        
          Libgedit-amtk's test-action-map
          test is known to fail.
        
        
          First, start a subshell that will exit on error:
        
        bash -e
        
          The order of builds is important. Install Gedit dependencies by running the following
          commands:
        
        for package in \
   libgedit-amtk-5.9.1.tar.bz2            \
   libgedit-gtksourceview-299.5.0.tar.bz2 \
   libgedit-gfls-0.3.0.tar.bz2            \
   libgedit-tepl-6.13.0.tar.bz2
do
  packagedir=${package%.tar*}
  echo "Building $packagedir"
  tar -xf ../$package
  pushd $packagedir
    cd build
    meson setup ..            \
          --prefix=/usr       \
          --buildtype=release \
          -D gtk_doc=false
    ninja
    #ninja test 2>&1 | tee ../../$packagedir-test.log
    as_root ninja install
  popd
  rm -rf $packagedir
done
        
          Finally, exit the shell that was started earlier:
        
        exit
        
          Now install gedit itself by
          running the following commands:
        
        cd build &&
meson setup ..            \
      --prefix=/usr       \
      --buildtype=release \
      -D gtk_doc=false    &&
ninja
        
          To test the results, run ninja
          test.
        
        
          Now as the root user:
        
        ninja install
        
          ![[Note]](../images/note.png) 
          
            Note
          
          
            If you installed the package to your system using a “DESTDIR” method,
            /usr/share/glib-2.0/schemas/gschemas.compiled
            was not updated/created. Create (or update) the file using the
            following command as the root
            user:
          
          glib-compile-schemas /usr/share/glib-2.0/schemas
         
       
      
        
          Command Explanations
        
        
          --buildtype=release:
          Specify a buildtype suitable for stable releases of the package, as
          the default may produce unoptimized binaries.
        
        
          -D gtk_doc=false: This
          switch disables generating the API documentation. Omit this switch
          if you have GTK-Doc-1.35.1 installed and wish to generate
          the API documentation.