Install MicroTeX into /opt/MicroTeX with PKGBUILD

This commit is contained in:
clsty
2024-06-18 08:08:25 +08:00
parent 7ed147154e
commit f37de4c050
5 changed files with 45 additions and 27 deletions
@@ -102,7 +102,7 @@ const Latex = (content = '') => {
// You can add this line in the middle for debugging: echo "$text" > ${filePath}.tmp
const renderScript = `#!/usr/bin/env bash
text=$(cat ${filePath} | sed 's/$/ \\\\\\\\/g' | sed 's/&=/=/g')
cd "$(dirname $(command -v LaTeX))"
cd /opt/MicroTeX
./LaTeX -headless -input="$text" -output=${outFilePath} -textsize=${fontSize * 1.1} -padding=0 -maxwidth=${latexViewArea.get_allocated_width() * 0.85} > /dev/null 2>&1
sed -i 's/fill="rgb(0%, 0%, 0%)"/style="fill:#000000"/g' ${outFilePath}
sed -i 's/stroke="rgb(0%, 0%, 0%)"/stroke="${darkMode.value ? '#ffffff' : '#000000'}"/g' ${outFilePath}
@@ -0,0 +1,36 @@
pkgname=illogical-impulse-microtex-git
_pkgname=MicroTeX
pkgver=r492.d87ebec
pkgrel=1
pkgdesc='MicroTeX for illogical-impulse dotfiles.'
#pkgdesc="A dynamic, cross-platform, and embeddable LaTeX rendering library"
arch=("x86_64")
url="https://github.com/NanoMichael/${_pkgname}"
license=('MIT')
depends=(
tinyxml2
gtkmm3
gtksourceviewmm
cairomm
)
makedepends=("git" "cmake")
source=("git+${url}.git")
sha256sums=("SKIP")
pkgver() {
cd $_pkgname
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
build() {
cd $_pkgname
cmake -B build -S . -DCMAKE_BUILD_TYPE=None
cmake --build build
}
package() {
cd $_pkgname
install -Dm0755 -t "$pkgdir/opt/$_pkgname/" build/LaTeX
cp -r build/res "$pkgdir/opt/$_pkgname/"
install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
}
@@ -1,13 +0,0 @@
pkgname=illogical-impulse-microtex
pkgver=1.0
pkgrel=1
pkgdesc='Illogical Impulse MicroTeX Dependencies'
arch=(any)
license=(None)
depends=(
tinyxml2
gtkmm3
gtksourceviewmm
cairomm
)
+5 -10
View File
@@ -104,11 +104,13 @@ install-local-pkgbuild() {
}
# Install core dependencies from the meta-packages
metapkgs=(./arch-packages/illogical-impulse-{audio,backlight,basic,fonts-themes,gnome,gtk,microtex,portal,python,screencapture,widgets})
metapkgs=(./arch-packages/illogical-impulse-{audio,backlight,basic,fonts-themes,gnome,gtk,portal,python,screencapture,widgets})
metapkgs+=(./arch-packages/illogical-impulse-ags)
metapkgs+=(./arch-packages/illogical-impulse-microtex-git)
metapkgs+=(./arch-packages/illogical-impulse-oneui4-icons-git)
[[ -f /usr/share/icons/Bibata-Modern-Classic/index.theme ]] || \
metapkgs+=(./arch-packages/illogical-impulse-bibata-modern-classic-bin)
try sudo pacman -R illogical-impulse-microtex
for i in "${metapkgs[@]}"; do
metainstallflags="--needed"
@@ -171,14 +173,6 @@ v gsettings set org.gnome.desktop.interface font-name 'Rubik 11'
printf "\e[36m[$0]: 2. Installing parts from source repo\e[0m\n"
sleep 1
if command -v LaTeX >/dev/null 2>&1;then
echo -e "\e[33m[$0]: Program \"MicroTeX\" already exists, no need to install.\e[0m"
echo -e "\e[34mYou can reinstall it in order to update to the latest version anyway.\e[0m"
ask_MicroTeX=$ask
else ask_MicroTeX=true
fi
if $ask_MicroTeX;then showfun install-MicroTeX;v install-MicroTeX;fi
#####################################################################################
printf "\e[36m[$0]: 3. Copying + Configuring\e[0m\n"
@@ -276,6 +270,7 @@ warn_files_tests+=(/usr/local/share/fonts/TTF/Rubik{,-Italic}'[wght]'.ttf)
warn_files_tests+=(/usr/local/share/fonts/TTF/Gabarito-{Black,Bold,ExtraBold,Medium,Regular,SemiBold}.ttf)
warn_files_tests+=(/usr/local/share/icons/OneUI{,-dark,-light})
warn_files_tests+=(/usr/local/share/icons/Bibata-Modern-Classic)
warn_files_tests+=(/usr/local/bin/{LaTeX,res})
for i in ${warn_files_tests[@]}; do
echo $i
test -f $i && warn_files+=($i)
@@ -305,5 +300,5 @@ case $existed_hypr_conf in
;;esac
if [[ ! -z "${warn_files[@]}" ]]; then
printf "\n\e[31m[$0]: \!! Important \!! : Please delete \e[0m ${warn_files[*]} \e[31m manually as soon as possible, since we\'re now using AUR package or local PKGBUILD to install them for Arch(based) Linux distros, and they'll take precedence over our installation.\e[0m\n"
printf "\n\e[31m[$0]: \!! Important \!! : Please delete \e[0m ${warn_files[*]} \e[31m manually as soon as possible, since we\'re now using AUR package or local PKGBUILD to install them for Arch(based) Linux distros, and they'll take precedence over our installation, or at least take up more space.\e[0m\n"
fi
+3 -3
View File
@@ -105,8 +105,8 @@ install-MicroTeX (){
x cd build
x cmake ..
x make -j32
x sudo mkdir -p /usr/local/bin
x sudo cp ./LaTeX /usr/local/bin/
x sudo cp -r ./res /usr/local/bin/
x sudo mkdir -p /opt/MicroTeX
x sudo cp ./LaTeX /opt/MicroTeX/
x sudo cp -r ./res /opt/MicroTeX/
x cd $base
}