1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22$(eval $(call gb_Package_Package,packimages_packimages,$(WORKDIR)/CustomTarget/packimages,packimages))
23
24# Custom sets, at 24x24 & 16x16 fall-back to industrial preferentially
25CUSTOM_IMAGE_SETS := hicontrast industrial classic
26CUSTOM_PREFERRED_FALLBACK_1 := -c $(SRCDIR)/ooo_custom_images/industrial
27CLASSIC_TARBALL=$(SRCDIR)/ooo_custom_images/classic/classic_images.tar.gz
28
29$(eval $(call gb_Package_add_file,packimages_packimages,bin/images.zip,bin/images.zip))
30$(foreach imageset,$(CUSTOM_IMAGE_SETS),$(eval $(call gb_Package_add_file,packimages_packimages,bin/images_$(imageset).zip,bin/images_$(imageset).zip)))
31$(eval $(call gb_Package_add_file,packimages_packimages,bin/images_brand.zip,bin/images_brand.zip))
32
33ifeq ($(VERBOSE_PACKIMG),TRUE)
34VERBOSESWITCH := -vv
35else ifeq ($(VERBOSE),TRUE)
36VERBOSESWITCH := -v
37else
38VERBOSESWITCH :=
39endif
40
41RSCDEFIMG := default_images
42SORTED_LIST := $(WORKDIR)/CustomTarget/packimages/res/img/sorted.lst
43COMMAND_IMAGE_LIST := $(WORKDIR)/CustomTarget/packimages/res/img/commandimagelist.ilst
44
45$(WORKDIR)/CustomTarget/packimages/bin/images.zip : $(COMMAND_IMAGE_LIST)
46	mkdir -p $(dir $@) && \
47	$(PERL) $(SOLARENV)/bin/packimages.pl \
48		$(VERBOSESWITCH) \
49		-g $(SOLARSRC)/$(RSCDEFIMG) \
50		-m $(SOLARSRC)/$(RSCDEFIMG) \
51		-c $(SRCDIR)/packimages \
52		-l $(OUTDIR)/res/img \
53		-s $(SORTED_LIST) \
54		-l $(WORKDIR)/CustomTarget/packimages/res/img \
55		-o $@
56
57$(WORKDIR)/CustomTarget/packimages/bin/images_%.zip : $(COMMAND_IMAGE_LIST)
58	mkdir -p $(dir $@) && \
59	$(PERL) $(SOLARENV)/bin/packimages.pl \
60		$(VERBOSESWITCH) \
61		-g $(SRCDIR)/$(RSCDEFIMG) \
62		-m $(SRCDIR)/$(RSCDEFIMG) \
63		-c $(SRCDIR)/packimages \
64		-c $(SRCDIR)/ooo_custom_images/$* \
65		-c $(WORKDIR)/CustomTarget/packimages/$* \
66		$(CUSTOM_PREFERRED_FALLBACK_1) \
67		$(CUSTOM_PREFERRED_FALLBACK_2) \
68		-l $(OUTDIR)/res/img \
69		-l $(WORKDIR)/CustomTarget/packimages/res/img \
70		-s $(SORTED_LIST) \
71		-o $@
72
73# make sure to have one to keep packing happy
74$(WORKDIR)/CustomTarget/packimages/bin/images_brand.zip :
75	mkdir -p $(dir $@) && \
76	touch $@
77
78$(COMMAND_IMAGE_LIST) : $(SORTED_LIST)
79	mkdir -p $(dir $@) && \
80	find $(SRCDIR)/$(RSCDEFIMG)/res/commandimagelist -name "*.png" | sed "s#$(SRCDIR)/$(RSCDEFIMG)/res#%GLOBALRES%#" | $(PERL) $(SOLARENV)/bin/sort.pl > $@.$(INPATH) && \
81	$(PERL) $(SOLARENV)/bin/diffmv.pl $@.$(INPATH) $@
82
83$(SORTED_LIST) : $(SRCDIR)/packimages/pack/image-sort.lst
84	mkdir -p $(dir $@) && \
85	$(PERL) $(SOLARENV)/bin/image-sort.pl $^ $(OUTDIR)/xml $@
86
87
88
89# generate the HiContrast icon set
90
91$(WORKDIR)/CustomTarget/packimages/bin/images_hicontrast.zip : $(WORKDIR)/CustomTarget/packimages/hicontrast.flag
92
93$(WORKDIR)/CustomTarget/packimages/hicontrast.flag :
94	$(PERL) $(SOLARENV)/bin/hicontrast-to-theme.pl \
95		$(SRCDIR)/default_images \
96		$(WORKDIR)/CustomTarget/packimages/hicontrast && \
97	touch $@
98
99
100
101# unpack the classic icon set
102
103$(WORKDIR)/CustomTarget/packimages/bin/images_classic.zip : $(WORKDIR)/CustomTarget/packimages/classic.flag
104
105ifeq ($(GUI),OS2)
106$(WORKDIR)/CustomTarget/packimages/classic.flag :
107	mkdir -p $(dir $@) && \
108	cd $(dir $@) && \
109	tar zxf $(CLASSIC_TARBALL) && \
110	touch $@
111	cat $@ || echo "ERROR: unpacking $(CLASSIC_TARBALL) failed"
112else
113$(WORKDIR)/CustomTarget/packimages/classic.flag :
114	mkdir -p $(dir $@) && \
115	cd $(dir $@) && \
116	gunzip -c $(CLASSIC_TARBALL) | ( tar -xf - ) && \
117	touch $@
118	$(if $(filter UNX,$(GUI)),chmod -R g+w $(WORKDIR)/CustomTarget/packimages/classic)
119	cat $@ || echo "ERROR: unpacking $(CLASSIC_TARBALL) failed"
120endif
121
122# vim: set noet sw=4 ts=4:
123