<p></p>
<blockquote>
<p dir="auto">The sed script won't work with either 5.1.10 [...]</p>
</blockquote>
<p dir="auto">It works better without a third capture group:</p>
<div class="highlight highlight-text-shell-session"><pre>$ <span class="pl-s1"><span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">'</span>5110<span class="pl-pds">'</span></span> <span class="pl-k">|</span> sed -e <span class="pl-s"><span class="pl-pds">'</span>s/\(.\)\(.\)/\1.\2./<span class="pl-pds">'</span></span></span>
<span class="pl-c1">5.1.10</span>

$ <span class="pl-s1"><span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">'</span>515678901234<span class="pl-pds">'</span></span> <span class="pl-k">|</span> sed -e <span class="pl-s"><span class="pl-pds">'</span>s/\(.\)\(.\)/\1.\2./<span class="pl-pds">'</span></span></span>
<span class="pl-c1">5.1.5678901234</span></pre></div>
<blockquote>
<p dir="auto">[...] or 3.21.1.</p>
</blockquote>
<p dir="auto">For major/minor increments, just add more dots where needed:</p>
<div class="highlight highlight-text-shell-session"><pre>$ <span class="pl-s1"><span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">'</span>3211<span class="pl-pds">'</span></span> <span class="pl-k">|</span> sed -e <span class="pl-s"><span class="pl-pds">'</span>s/\(.\)\(..\)/\1.\2./<span class="pl-pds">'</span></span></span>
<span class="pl-c1">3.21.1</span>

$ <span class="pl-s1"><span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">'</span>515678901234<span class="pl-pds">'</span></span> <span class="pl-k">|</span> sed -e <span class="pl-s"><span class="pl-pds">'</span>s/\(..\)\(..\)/\1.\2./<span class="pl-pds">'</span></span></span>
<span class="pl-c1">51.56.78901234</span></pre></div>
<blockquote>
<p dir="auto">When importing Scintilla and Lexilla <code>version.txt</code> convert to a string literal with the dots and import it as <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/users/kugel-/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/kugel-">@kugel-</a> showed above.</p>
</blockquote>
<p dir="auto">I looked at that, but was more interested in the afterthought suggestion:</p>
<blockquote>
<p dir="auto">or define some preprocessor symbol via Makefile (-DSCI_VER=$(file < scintilla/version.txt) but in a portable fashion)</p>
</blockquote>
<p dir="auto">I hear consensus that a build time intervention ain't gonna happen. As for directly including the version files, I think something less ugly can be worked out, such as:</p>
<blockquote>
<p dir="auto">write to a <code>version.h</code> file if you don't want to change <code>version.txt</code></p>
</blockquote>
<p dir="auto">Good idea; even better if <code>version.h</code> contained actual preprocessor definitions. Here's a way that <code>update-scintilla.sh</code> could generate them:</p>
<div class="highlight highlight-source-diff"><pre><span class="pl-c1">diff --git a/scripts/update-scintilla.sh b/scripts/update-scintilla.sh</span>
index 75d3834c..4a183344 100755
<span class="pl-md">--- a/scripts/update-scintilla.sh</span>
<span class="pl-mi1">+++ b/scripts/update-scintilla.sh</span>
<span class="pl-mdr">@@ -53,6 +53,28 @@</span> copy_to()
        done || exit 1
 }

<span class="pl-mi1"><span class="pl-mi1">+</span>parse_version()</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>{</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>    # TODO: change to /\(.\)\(..\)/\1.\2./ when 5.10.x is released</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>    printf '"%s"' $(sed -e 's/\(.\)\(.\)/\1.\2./' "$1")</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>}</span>
<span class="pl-mi1"><span class="pl-mi1">+</span></span>
<span class="pl-mi1"><span class="pl-mi1">+</span>(cat <<EOL</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>#ifndef SCI_VERSION_H</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>#define SCI_VERSION_H 1</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>#define SCI_VERSION $(parse_version 'scintilla/version.txt')</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>#endif</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>EOL</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>) > "$SCI_SRC"/version.h</span>
<span class="pl-mi1"><span class="pl-mi1">+</span></span>
<span class="pl-mi1"><span class="pl-mi1">+</span>(cat <<EOL</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>#ifndef LEX_VERSION_H</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>#define LEX_VERSION_H 1</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>#define LEX_VERSION $(parse_version 'scintilla/lexilla/version.txt')</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>#endif</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>EOL</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>) > "$LEX_SRC"/version.h</span>
<span class="pl-mi1"><span class="pl-mi1">+</span></span>
 # purge executbale bits
 umask 111
 # copy everything from scintilla but lexers
<span class="pl-mdr">@@ -66,12 +88,14 @@</span> copy_to scintilla/gtk             "$SCI_SRC"/gtk/*.h
 copy_to scintilla/gtk             "$SCI_SRC"/gtk/*.list
 copy_to scintilla                 "$SCI_SRC"/License.txt
 copy_to scintilla                 "$SCI_SRC"/version.txt
<span class="pl-mi1"><span class="pl-mi1">+</span>copy_to scintilla                 "$SCI_SRC"/version.h</span>
 copy_to scintilla/lexilla/src     "$LEX_SRC"/src/*.cxx
 copy_to scintilla/lexilla/include "$LEX_SRC"/include/*.h
 copy_to scintilla/lexilla/lexlib  "$LEX_SRC"/lexlib/*.cxx
 copy_to scintilla/lexilla/lexlib  "$LEX_SRC"/lexlib/*.h
 copy_to scintilla/lexilla/        "$LEX_SRC"/License.txt
 copy_to scintilla/lexilla/        "$LEX_SRC"/version.txt
<span class="pl-mi1"><span class="pl-mi1">+</span>copy_to scintilla/lexilla/        "$LEX_SRC"/version.h</span>
 # now copy the lexers we use
 git -C scintilla/lexilla/lexers/ ls-files *.cxx | while read f; do
   copy_to "scintilla/lexilla/lexers" "$LEX_SRC/lexers/$f"</pre></div>
<p dir="auto"><sup><a href="#user-content-fn-1-77a646ff0d44b0e81621fad740c9dc31" id="user-content-fnref-1-77a646ff0d44b0e81621fad740c9dc31" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></p>
<p dir="auto">I'm not overly fond of the version parsing kludge, but I think the goal should be approximating the convenience of proper version strings, the way Geany's <code>VERSION</code> macro already expands to sensible text.</p>
<p dir="auto">There's ultimately no painless way around this until Scintilla starts declaring its version in a header like other development libraries. I haven't researched it, but chances are it's been requested and denied before. Asking again can't be any worse than waiting for Debian's <a href="https://pkgs.org/search/?q=libscintilla-dev" rel="nofollow">"libscintilla-dev" package</a>.</p>
<section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2>
<ol dir="auto">
<li id="user-content-fn-1-77a646ff0d44b0e81621fad740c9dc31">
<p dir="auto">Alternatively, copy version.h instead of version.txt <a href="#user-content-fnref-1-77a646ff0d44b0e81621fad740c9dc31" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content"><g-emoji class="g-emoji" alias="leftwards_arrow_with_hook" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/21a9.png">↩</g-emoji></a></p>
</li>
</ol>
</section>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/geany/geany/discussions/3108#discussioncomment-2022492">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJZIIEZXDFV2SIGUBEDUXKQKDANCNFSM5MPS4YVA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAIOWJ2TT6AFGECLG4264A3UXKQKDA5CNFSM5MPS4YVKYY3PNVWWK3TUL52HS4DFWFCGS43DOVZXG2LPNZBW63LNMVXHJKTDN5WW2ZLOORPWSZGOAAPNYXA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><geany/geany/repo-discussions/3108/comments/2022492</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/discussions/3108#discussioncomment-2022492",
"url": "https://github.com/geany/geany/discussions/3108#discussioncomment-2022492",
"name": "View Discussion"
},
"description": "View this Discussion on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>