TEIC / Stylesheets

TEI XSL Stylesheets
231 stars 124 forks source link

otiose comment in makefile #551

Closed lb42 closed 2 years ago

lb42 commented 2 years ago

I just had occasion to do a "make install" having updated my local copy of the Stylesheets, when I noticed the following wird comment:

# Shouldn't the "/usr" in the following line be /usr ? —Syd & Martin, 2020-07-03
perl -p -i -e 's+^APPHOME=.*+APPHOME=/usr/share/xml/tei/stylesheet+' /usr/bin/transformtei
chmod 755 /usr/bin/transformtei

triviial, i know, but what on earth is this supposed to be telling me?

sydb commented 2 years ago

Ha! That one is fun. Thanks, @lb42. My first reaction was “Idunno, mate, and I wrote that comment!”.

But if you look at the Makefile (instead of the output thereof), you’ll see

    # Shouldn't the "/usr" in the following line be ${PREFIX} ? —Syd & Martin, 2020-07-03
    perl -p -i -e 's+^APPHOME=.*+APPHOME=/usr/share/xml/tei/stylesheet+' ${PREFIX}/bin/transformtei
    chmod 755 ${PREFIX}/bin/transformtei

So, importantly, @martindholmes and I were not being nuts asking if A should be A. We were asking if A should be B, which is still a valid question. More on that later.

The next question is why is this comment in the output? I think this is because of the (somewhat crazy, IMHO) syntax of Makefiles that say that when a TAB is the first character of a line, said line is handed to the shell for processing. Indeed, these comment lines (the ‘#’ starts a comment in both most all shells and in a Makefile) are preceded by a TAB. Why the shell decides the comment needs to be reflected in the output, idunno. In any case, I have fixed this by changing the initial TAB character to 8 spaces.

Now on the change @martindholmes & I were musing about. I tested my above change (TAB to SPACE×8) with make PREFIX=/tmp install, because I did not want to create an actual installation. The resulting /tmp/bin/transformtei file has on line 11 APPHOME=/usr/share/xml/tei/stylesheet. That is obviously wrong, as there is no such directory on this system. There is, however, a /tmp/share/xml/tei/stylesheet/ hierarchy, so I am pretty convinced this should be changed. Will make a different ticket, though.