Posts tagged global

gnu global

posted on 2017-04-26 20:56

Get the current version from here. Alternatively, use the use the anonymous access to CVS, but no Idea wether the patches would work there.

The steps to version 6.5.6 running on a current gentoo install were, including the patches follow. I hope I don't forget something, this write was done a week later.

needed packages

emerge -atv these:

  • dev-python/pygments
  • dev-util/ctags
  • sys-devel/automake
  • sys-devel/m4

getting and compiling

mkdir asdf
cd asdf
curl -O http://tamacom.com/global/global-6.5.6.tar.gz
tar xzvf global-6.5.6.tar.gz
cd global-6.5.6

applying these two patches:

diff --git a/configure.ac b/configure.ac
index cda52e4..d7d1a73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,7 @@ dnl
 AC_INIT([GNU GLOBAL],[6.5.6])
 AC_DEFINE(COPYRIGHT_YEAR,["1996-2016"],[Copyright Year])
 AC_CONFIG_SRCDIR(global/global.c)
+AC_CONFIG_MACRO_DIRS([m4])
 AC_CONFIG_HEADERS([config.h:config-h.in])
 AC_PREREQ(2.59)
 AM_INIT_AUTOMAKE([1.9.3 gnu subdir-objects])


diff --git a/Makefile.am b/Makefile.am
index 43585a6..f6ab5c5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,6 +29,8 @@ gtags_DATA = AUTHORS COPYING COPYING.LIB ChangeLog FAQ INSTALL LICENSE NEWS READ

 EXTRA_DIST = ${gtags_DATA} reconf.sh convert.pl mainpage.dox head.in

+ACLOCAL_AMFLAGS = -I m4
+
 doxygen:
    GTAGSCONF=':htags_options=--insert-header=head.in --suggest:' doxygen

Then back to the shell:

autoreconf -fvi
./configure --with-universal-ctags=`which ctags`
make
make check
sudo make install

setup and test

sudo updatedb
sudo locate gtags.conf
cp -va /usr/local/share/gtags/gtags.conf ~/.globalrc
gtags --version
global --version
cd ../..
rm -rf asdf

usage

Now onto actual usage:

CLI:

gtags -v        # generate tag database (initially, rerun with -i everytime code is changed!)

global FUNC     # finds file where FUNC is defined, regexp's work, too
global -r FUNC      # find files where FUNC is used in
global -x FUNC      # == ctags -x, name+line+path+line_content

Of course you only want to look at source, not generated code. If git is used, doing this from the project root will do the trick:

git ls-files > gtags.files

There's more to it, but it should be sufficiant for now. Usually global should be integrated into your dev environment of choice.

Out of the box, less should work. vim and emacs need plugins to work, they won't be covered at this time here.

less:

export LESSGLOBALTAGS=global  ## this is needed so less knows it can work with global
less -t FUNC        # opens file where FUNC is defined

This blog covers .csv, .htaccess, .pfx, .vmx, /etc/crypttab, /etc/network/interfaces, /etc/sudoers, /proc, 10.04, 14.04, 16.04, AS, ASA, ControlPanel, DS1054Z, GPT, HWR, Hyper-V, IPSEC, KVM, LSI, LVM, LXC, MBR, MTU, MegaCli, PHP, PKI, PS1, R, RAID, S.M.A.R.T., SNMP, SSD, SSL, TLS, TRIM, VEEAM, VMware, VServer, VirtualBox, Virtuozzo, XenServer, acpi, adaptec, algorithm, ansible, apache, apache2.4, apachebench, apple, applet, arcconf, arch, architecture, areca, arping, asa, asdm, autoconf, awk, backup, bandit, bar, bash, benchmarking, binding, bitrate, blackarmor, blockdev, blowfish, bochs, bond, bonding, booknotes, bootable, bsd, btrfs, buffer, c-states, cache, caching, ccl, centos, certificate, certtool, cgdisk, cheatsheet, chrome, chroot, cisco, clamav, cli, clp, clush, cluster, cmd, coleslaw, colorscheme, common lisp, configuration management, console, container, containers, controller, cron, cryptsetup, csync2, cu, cups, cygwin, d-states, database, date, db2, dcfldd, dcim, dd, debian, debug, debugger, debugging, decimal, desktop, df, dhclient, dhcp, diff, dig, display manager, dm-crypt, dmesg, dmidecode, dns, docker, dos, drivers, dtrace, dtrace4linux, du, dynamictracing, e2fsck, eBPF, ebook, efi, egrep, emacs, encoding, env, error, ess, esx, esxcli, esxi, ethtool, evil, expect, exportfs, factory reset, factory_reset, factoryreset, fail2ban, fakeroot, fbsd, fdisk, fedora, file, files, filesystem, find, fio, firewall, firmware, fish, flashrom, forensics, free, freebsd, freedos, fritzbox, fsck, fstrim, ftp, ftps, g-states, gentoo, ghostscript, git, git-filter-branch, gitbucket, github, gitolite, global, gnutls, gradle, grep, grml, grub, grub2, guacamole, hardware, haskell, hdd, hdparm, hellowor, hex, hexdump, history, howto, htop, htpasswd, http, httpd, https, i3, icmp, ifenslave, iftop, iis, imagemagick, imap, imaps, init, innoDB, innodb, inodes, intel, ioncube, ios, iostat, ip, iperf, iphone, ipmi, ipmitool, iproute2, ipsec, iptables, ipv6, irc, irssi, iw, iwconfig, iwlist, iwlwifi, jailbreak, jails, java, javascript, javaws, js, juniper, junit, kali, kde, kemp, kernel, keyremap, kill, kpartx, krypton, lacp, lamp, languages, ldap, ldapsearch, less, leviathan, liero, lightning, links, linux, linuxin3months, lisp, list, livedisk, lmctfy, loadbalancing, locale, log, logrotate, looback, loopback, losetup, lsblk, lsi, lsof, lsusb, lsyncd, luks, lvextend, lvm, lvm2, lvreduce, lxc, lxde, macbook, macro, magento, mailclient, mailing, mailq, make-jpkg, manpages, markdown, mbr, mdadm, megacli, micro sd, microsoft, minicom, mkfs, mktemp, mod_pagespeed, mod_proxy, modbus, modprobe, mount, mouse, movement, mpstat, multitasking, myISAM, mysql, mysql 5.7, mysql workbench, mysqlcheck, mysqldump, nagios, nas, nat, nc, netfilter, networking, nfs, nginx, nmap, nocaps, nodejs, numberingsystem, numbers, od, onyx, opcode-cache, openVZ, openlierox, openssl, openvpn, openvswitch, openwrt, oracle linux, org-mode, os, oscilloscope, overview, parallel, parameter expansion, parted, partitioning, passwd, patch, pct, pdf, performance, pfsense, php, php7, phpmyadmin, pi, pidgin, pidstat, pins, pkill, plasma, plesk, plugin, posix, postfix, postfixadmin, postgres, postgresql, poudriere, powershell, preview, profiling, prompt, proxmox, ps, puppet, pv, pveam, pvecm, pvesm, pvresize, python, python3, qemu, qemu-img, qm, qmrestore, quicklisp, quickshare, r, racktables, raid, raspberry pi, raspberrypi, raspbian, rbpi, rdp, redhat, redirect, registry, requirements, resize2fs, rewrite, rewrites, rhel, rigol, roccat, routing, rs0485, rs232, rsync, s-states, s_client, samba, sar, sata, sbcl, scite, scp, screen, scripting, seafile, seagate, security, sed, serial, serial port, setup, sftp, sg300, shell, shopware, shortcuts, showmount, signals, slattach, slip, slow-query-log, smbclient, snmpget, snmpwalk, software RAID, software raid, softwareraid, sophos, spacemacs, spam, specification, speedport, spi, sqlite, squid, ssd, ssh, ssh-add, sshd, ssl, stats, storage, strace, stronswan, su, submodules, subzone, sudo, sudoers, sup, swaks, swap, switch, switching, synaptics, synergy, sysfs, systemd, systemtap, tar, tcpdump, tcsh, tee, telnet, terminal, terminator, testdisk, testing, throughput, tmux, todo, tomcat, top, tput, trafficshaping, ttl, tuning, tunnel, tunneling, typo3, uboot, ubuntu, ubuntu 16.04, ubuntu16.04, udev, uefi, ulimit, uname, unetbootin, unit testing, upstart, uptime, usb, usbstick, utf8, utm, utm 220, ux305, vcs, vgchange, vim, vimdiff, virtualbox, virtualization, visual studio code, vlan, vmstat, vmware, vnc, vncviewer, voltage, vpn, vsphere, vzdump, w, w701, wakeonlan, wargames, web, webdav, weechat, wget, whois, wicd, wifi, windowmanager, windows, wine, wireshark, wpa, wpa_passphrase, wpa_supplicant, x11vnc, x2x, xfce, xfreerdp, xmodem, xterm, xxd, yum, zones, zsh


Unless otherwise credited all material Creative Commons License by sjas