Blog: LDraw Parts Library - Packaged for Linux: ldraw_parts.spec

File ldraw_parts.spec, 2.6 KB (added by retracile, 10 years ago)
Line 
1Name: ldraw_parts
2Version: 201302
3Release: ec4
4# Downloaded from http://www.ldraw.org/library/updates/complete.zip
5Source0: ldraw-parts-library-complete-2013-02.zip
6Source1: mklist.py
7Group: Engineering/CAD
8Summary: LDRAW parts library
9License: CCAL 2.0
10BuildArch: noarch
11Buildroot: /tmp/%{name}-%{version}-root
12
13%package creativecommons
14Summary: LDRAW parts library, Creative Commons parts
15License: CCAL 2.0
16Group: Engineering/CAD
17Requires: ldraw_parts
18
19%package models
20Summary: LDRAW parts library, example models
21License: CCAL 2.0
22Group: Engineering/CAD
23Requires: ldraw_parts
24
25
26%description
27LDRAW parts library
28%description models
29LDRAW parts library example models
30%description creativecommons
31LDRAW parts library (creativecommons)
32#%description nonredist
33#LDRAW parts library (non-redistributable)
34
35%prep
36rm -rf $RPM_BUILD_DIR/ldraw
37unzip %{SOURCE0}
38
39%build
40cd ldraw
41find -name \*.dat | xargs grep -l "LICENSE Redistributable under CCAL" | sed 's;^.;/usr/share/ldraw/;' > ../ldraw-cc-parts
42find -name \*.dat | xargs grep -l "LICENSE Not redistributable" | sed 's;^.;/usr/share/ldraw/;' > ../ldraw-nr-parts
43if [ $(wc -l < ../ldraw-nr-parts) -ne 0 ]; then
44    # If there are any non-redistributable parts, the source rpm won't be
45    # redistributable either.  But as of 2013, all the non-redistributable
46    # parts had been replaced.
47    echo "Non-redistributable parts found; aborting build." >&2
48    exit 1
49fi
50
51%install
52rm -rf $RPM_BUILD_ROOT
53mkdir -p $RPM_BUILD_ROOT/usr/share
54cp -r ldraw $RPM_BUILD_ROOT/usr/share/
55
56mkdir -p $RPM_BUILD_ROOT/usr/bin
57cp %{SOURCE1} $RPM_BUILD_ROOT/usr/bin/
58
59rm $RPM_BUILD_ROOT/usr/share/ldraw/NonCAreadme.txt
60rm $RPM_BUILD_ROOT/usr/share/ldraw/models/Note*NonCA.txt
61# Allow for applications using different capitalization
62ln -s LDConfig.ldr $RPM_BUILD_ROOT/usr/share/ldraw/ldconfig.ldr
63# no need for the exe or the C implementation
64rm $RPM_BUILD_ROOT/usr/share/ldraw/mklist*.{zip,exe}
65
66%postun creativecommons
67/usr/bin/mklist.py /usr/share/ldraw > /usr/share/ldraw/parts.lst
68
69%post creativecommons
70/usr/bin/mklist.py /usr/share/ldraw > /usr/share/ldraw/parts.lst
71
72%files -f ldraw-cc-parts creativecommons
73/usr/share/ldraw/CA*.txt
74/usr/share/ldraw/models/Note*[0-9]CA*.txt
75
76%files models
77/usr/share/ldraw/models/car.dat
78/usr/share/ldraw/models/pyramid.dat
79/usr/share/ldraw/models/note*.txt
80%files
81%attr(755, root, root) /usr/bin/mklist.py
82#%attr(755, root, root) /usr/bin/mklist.pyc
83#%attr(755, root, root) /usr/bin/mklist.pyo
84/usr/share/ldraw/LDConfig.ldr
85/usr/share/ldraw/ldconfig.ldr
86/usr/share/ldraw/LDCfgalt.ldr
87/usr/share/ldraw/LDConfig_TLG.ldr
88/usr/share/ldraw/Readme.txt