Skip to content

Commit

Permalink
Fix more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Jun 12, 2019
1 parent 4617908 commit 11c97b6
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 30 deletions.
40 changes: 26 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ all: all_pdf_assets latex/ugent2016-nl.pdf latex/ugent2016-en.pdf
# -interaction=nonstopmode keeps the pdflatex backend from stopping at a
# missing file reference and interactively asking you for an alternative.

pdf_assets := $(patsubst assets/%,latex/logos/%,$(patsubst %.eps,%.pdf,$(wildcard assets/*.eps)))
pdf_assets := $(patsubst assets/%,latex/%,$(patsubst %.eps,%.pdf,$(wildcard assets/*.eps)))

latex/ugent2016-nl.pdf: latex/ugent2016-nl.tex \
latex/ugent2016-title-report.pdf \
Expand All @@ -55,36 +55,48 @@ example.pdf: example.tex
latexmk -cd lualatex -interaction=nontopmode -use-make $<

# Create all assets
all_pdf_assets: $(pdf_assets) latex/logos/ugent2016-logo-global-nl.pdf latex/logos/ugent2016-logo-kortrijk-en.pdf
all_pdf_assets: $(pdf_assets) latex/ugent2016-logo-global-nl.pdf latex/ugent2016-logo-kortrijk-en.pdf

# These two are created using symlinks rather than links.
latex/logos/ugent2016-logo-global-nl.pdf: latex/logos/ugent2016-logo-global-en.pdf
latex/ugent2016-logo-global-nl.pdf: latex/ugent2016-logo-global-en.pdf
powershell New-Item -Force -ItemType SymbolicLink -Name $@ -Value $<

latex/logos/ugent2016-logo-kortrijk-en.pdf: latex/logos/ugent2016-logo-kortrijk-nl.pdf
latex/ugent2016-logo-kortrijk-en.pdf: latex/ugent2016-logo-kortrijk-nl.pdf
powershell New-Item -Force -ItemType SymbolicLink -Name $@ -Value $<

# Create the directory
latex/logos:
powershell mkdir -f latex/logos

# Convert a single asset
latex/logos/%.pdf: assets/%.eps latex/logos
latex/%.pdf: assets/%.eps
epstopdf --outfile=$@ $<

# Clean up some stuff
clean:
clean-win:
cd latex && latexmk -cd -use-make -C
-powershell Remove-Item latex/logos -Recurse -Force -ErrorAction Ignore
-powershell Remove-Item latex/*.pdf -Recurse -Force -ErrorAction Ignore
-powershell Remove-Item latex/_minted-ugent2016-en -Recurse -Force -ErrorAction Ignore
-powershell Remove-Item latex/_minted-ugent2016-nl -Recurse -Force -ErrorAction Ignore
-powershell Remove-Item ugent2016.zip -Force -ErrorAction Ignore
-powershell Remove-Item ugent2016.tds.zip -Force -ErrorAction Ignore
-powershell Remove-Item ugent2016 -Recurse -Force -ErrorAction Ignore
-powershell Remove-Item ctanout -Recurse -Force -ErrorAction Ignore
-powershell Remove-Item tdsout -Recurse -Force -ErrorAction Ignore

ugent2016.zip: all ugent2016.tds.zip
clean:
cd latex && latexmk -cd -use-make -C
rm -f latex/*.pdf
rm -rf latex/_minted-ugent2016-en
rm -rf latex/_minted-ugent2016-nl
rm -rf ugent2016.zip
rm -rf ugent2016.tds.zip
rm -rf ctanout
rm -rf tdsout

ugent2016.zip-win: all ugent2016.tds.zip-win
powershell ./generate-ctan.ps1

ugent2016.tds.zip: all
ugent2016.tds.zip-win: all
powershell ./generate-tds.ps1

ugent2016.zip: all ugent2016.tds.zip
powershell ./generate-ctan.sh

ugent2016.tds.zip: all
powershell ./generate-tds.sh
11 changes: 4 additions & 7 deletions generate-ctan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ param(
)

$in = "tdsout"
$out = "ugent2016"
$out = "ctanout"

# We need the following files in the zip for ctan:
# - The class files
Expand All @@ -20,23 +20,20 @@ $out = "ugent2016"
# - The readme

# First, create the output directory
New-Item -ItemType Directory -Force -Path $out
New-Item -ItemType Directory -Force -Path $out/ugent2016

Get-ChildItem $in -Recurse -File -Depth 3 | ForEach-Object {
$filename = "$($_.BaseName)$($_.Extension)"
Write-Host $_.FullName
Copy-Item $_.FullName -Destination $out/$filename
Copy-Item $_.FullName -Destination $out/ugent2016/$filename
}

# Copy logos
Copy-Item "$in/tex/latex/ugent2016/logos" -Destination "$out/logos" -Recurse

# Add tds-compliant zip file if necessary
if (!$ExcludeTds) {
Copy-Item ugent2016.tds.zip -Destination $out
}

Compress-Archive -Path $out -DestinationPath ugent2016.zip -Force
Compress-Archive -Path $out/* -DestinationPath ugent2016.zip -Force

if ($RemoveOut) {
Remove-Item $out -Recurse -Force
Expand Down
45 changes: 45 additions & 0 deletions generate-ctan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

#
# Generate a zip file suitable for uploading to CTAN.
#
# This script relies on the TDS directory having been made.
#

REMOVE_OUT=false
EXCLUDE_TDS=false

while getopts 'abf:v' flag; do
case "${flag}" in
RemoveOut) REMOVE_OUT=true ;;
ExcludeTds) EXCLUDE_TDS=true ;;
*) break ;;
esac
done

in="tdsout"
out="ctanout"

# We need the following files in the zip for ctan:
# - The class files
# - The style files
# - The docs (including the pdf versions)
# - The logos
# - The readme

# First, create the output directory
mkdir -p "$out/ugent2016"

find ${in} -type f -exec cp "{}" "$out/ugent2016" ";"

# Add tds-compliant zip file if necessary
if [[ ${EXCLUDE_TDS} = false ]]; then
cp ugent2016.tds.zip ${out}
fi

cd ${out}
zip --filesync -r ../ugent2016.zip *

if [[ "$REMOVE_OUT" = true ]]; then
rm -rf ${out}
fi
12 changes: 3 additions & 9 deletions generate-tds.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#
# Generate a zip file suitable for uploading to CTAN.
# Generate a TDS compliant zip.
# Note: this is experimental on Windows.
#

param(
Expand All @@ -9,13 +10,6 @@ param(
$out = "tdsout"
$in = "latex"

# We need the following files in the zip for ctan:
# - The class files
# - The style files
# - The docs (including the pdf versions)
# - The logos
# - The readme

$latex = "$out/tex/latex/ugent2016"
$doc = "$out/doc/latex/ugent2016"
$source = "$out/source/latex/ugent2016"
Expand Down Expand Up @@ -44,7 +38,7 @@ Get-ChildItem -Path "$in/*" -File -Include *.tex | ForEach-Object {
}

# Copy the logos to the output folder
Copy-Item "$in/logos" -Destination "$latex/logos" -Recurse
Copy-Item "$in/ugent2016-logo-*.pdf" -Destination "$latex" -Recurse

# Copy the documentation pdfs to the folder
Copy-Item "$in/ugent2016-nl.pdf" -Destination "$doc"
Expand Down
57 changes: 57 additions & 0 deletions generate-tds.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

#
# Generate a TDS compliant zip
#

REMOVE_OUT=false

while getopts 'abf:v' flag; do
case "${flag}" in
RemoveOut) REMOVE_OUT=true ;;
*) break ;;
esac
done

out="tdsout"
in="latex"


latex="$out/tex/latex/ugent2016"
doc="$out/doc/latex/ugent2016"
source="$out/source/latex/ugent2016"

mkdir -p ${latex}
mkdir -p ${doc}
mkdir -p ${source}

# Copy all latex files
find ${in} -name '*.cls' -o -name '*.sty' -exec cp "{}" ${latex} ";"

# Copy all doc files
find ${in} -name '*.md' -exec cp "{}" ${doc} ";"

# Copy all source files
find ${in} -name '*.tex' -exec cp "{}" ${source} ";"

# Convert all line endings
find ${out} -type f -print0 | xargs -0 dos2unix

# Copy logos
find ${in} -name 'ugent2016-logo-*.pdf' -exec cp "{}" ${latex} ";"

# Copy the documentation pdfs to the folder
cp "$in/ugent2016-nl.pdf" ${doc}
cp "$in/ugent2016-en.pdf" ${doc}

# Fix all permissions
find ${out} -type f -exec chmod 644 "{}" ";"

cd ${out}
zip --filesync -r ../ugent2016.tds.zip *

chmod 644 ../ugent2016.tds.zip

if [[ "$REMOVE_OUT" = true ]]; then
rm -rf ${out}
fi
File renamed without changes.

0 comments on commit 11c97b6

Please sign in to comment.