title: How do you make _topdir relative to the location of the .spec file when building an RPM?
body: <p>I have a <code>.spec</code> file that relies on a variable called <code>_topdir</code>.</p>
  
  <p>Right now when you checkout the SRPM source from git, you have to go and change where <code>_topdir</code> is pointing to to get the <code>rpmbuild</code> to function correctly.</p>
  
  <pre><code># We need the following line so that RPM can find the BUILD and SOURCES and RPMS dirs.
  %define _topdir /root/projects/my-project/my-project-srpm/
  </code></pre>
  
  <p><strong>How do you specify that <code>_topdir</code> should be relative to the location of the <code>.spec</code> file so that <code>_topdir</code> isn't hard coded?</strong></p>