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
23
24$(eval $(call gb_Package_Package,packimages_packimages,$(WORKDIR)/CustomTarget/packimages,packimages))
25
26# Custom sets, at 24x24 & 16x16 fall-back to industrial preferentially
27CUSTOM_IMAGE_SETS := hicontrast industrial classic
28CUSTOM_PREFERRED_FALLBACK_1 := -c $(SRCDIR)/ooo_custom_images/industrial
29CLASSIC_TARBALL=$(SRCDIR)/ooo_custom_images/classic/classic_images.tar.gz
30
31$(eval $(call gb_Package_add_file,packimages_packimages,bin/images.zip,bin/images.zip))
32$(foreach imageset,$(CUSTOM_IMAGE_SETS),$(eval $(call gb_Package_add_file,packimages_packimages,bin/images_$(imageset).zip,bin/images_$(imageset).zip)))
33$(eval $(call gb_Package_add_file,packimages_packimages,bin/images_brand.zip,bin/images_brand.zip))
34
35ifeq ($(VERBOSE_PACKIMG),TRUE)
36VERBOSESWITCH := -vv
37else ifeq ($(VERBOSE),TRUE)
38VERBOSESWITCH := -v
39else
40VERBOSESWITCH :=
41endif
42
43RSCDEFIMG := default_images
44SORTED_LIST := $(WORKDIR)/CustomTarget/packimages/res/img/sorted.lst
45COMMAND_IMAGE_LIST := $(WORKDIR)/CustomTarget/packimages/res/img/commandimagelist.ilst
46
47$(WORKDIR)/CustomTarget/packimages/bin/images.zip : $(COMMAND_IMAGE_LIST)
48	mkdir -p $(dir $@) && \
49	$(PERL) $(SOLARENV)/bin/packimages.pl \
50		$(VERBOSESWITCH) \
51		-g $(SOLARSRC)/$(RSCDEFIMG) \
52		-m $(SOLARSRC)/$(RSCDEFIMG) \
53		-c $(SRCDIR)/packimages \
54		-l $(OUTDIR)/res/img \
55		-s $(SORTED_LIST) \
56		-l $(OUTDIR)/res/img \
57		-o $@
58
59$(WORKDIR)/CustomTarget/packimages/bin/images_% : $(COMMAND_IMAGE_LIST)
60	mkdir -p $(dir $@) && \
61	$(PERL) $(SOLARENV)/bin/packimages.pl \
62		$(VERBOSESWITCH) \
63		-g $(SRCDIR)/$(RSCDEFIMG) \
64		-m $(SRCDIR)/$(RSCDEFIMG) \
65		-c $(SRCDIR)/packimages \
66		-c $(SRCDIR)/ooo_custom_images/$* \
67		-c $(WORKDIR)/CustomTarget/packimages/$* \
68		$(CUSTOM_PREFERRED_FALLBACK_1) \
69		$(CUSTOM_PREFERRED_FALLBACK_2) \
70		-l $(OUTDIR)/res/img \
71		-l $(WORKDIR)/CustomTarget/packimages/res/img \
72		-s $(SORTED_LIST) \
73		-o $@
74
75# make sure to have one to keep packing happy
76$(WORKDIR)/CustomTarget/packimages/bin/images_brand.zip :
77	mkdir -p $(dir $@) && \
78	touch $@
79
80$(COMMAND_IMAGE_LIST) : $(SORTED_LIST)
81	mkdir -p $(dir $@) && \
82	find $(SRCDIR)/$(RSCDEFIMG)/res/commandimagelist -name "*.png" | sed "s#$(SRCDIR)/$(RSCDEFIMG)/res#%GLOBALRES%#" | $(PERL) $(SOLARENV)/bin/sort.pl > $@.$(INPATH) && \
83	$(PERL) $(SOLARENV)/bin/diffmv.pl $@.$(INPATH) $@
84
85$(SORTED_LIST) : $(SRCDIR)/packimages/pack/image-sort.lst
86	mkdir -p $(dir $@) && \
87	$(PERL) $(SOLARENV)/bin/image-sort.pl $^ $(OUTDIR)/xml $@
88
89
90
91# generate the HiContrast icon set
92
93$(WORKDIR)/CustomTarget/packimages/bin/images_hicontrast.zip : $(WORKDIR)/CustomTarget/packimages/hicontrast.flag
94
95$(WORKDIR)/CustomTarget/packimages/hicontrast.flag :
96	$(PERL) $(SOLARENV)/bin/hicontrast-to-theme.pl \
97		$(SRCDIR)/default_images \
98		$(WORKDIR)/CustomTarget/packimages/hicontrast && \
99	touch $@
100
101
102
103# unpack the classic icon set
104
105$(WORKDIR)/CustomTarget/packimages/bin/images_classic.zip : $(WORKDIR)/CustomTarget/packimages/classic.flag
106
107ifeq ($(GUI),OS2)
108$(WORKDIR)/CustomTarget/packimages/classic.flag :
109	mkdir -p $(dir $@) && \
110	cd $(dir $@) && \
111	tar zxf $(CLASSIC_TARBALL) && \
112	touch $@
113	cat $@ || echo "ERROR: unpacking $(CLASSIC_TARBALL) failed"
114else
115$(WORKDIR)/CustomTarget/packimages/classic.flag :
116	mkdir -p $(dir $@) && \
117	cd $(dir $@) && \
118	gunzip -c $(CLASSIC_TARBALL) | ( tar -xf - ) && \
119	touch $@
120	$(if $(filter UNX,$(GUI)),chmod -R g+w $(WORKDIR)/CustomTarget/packimages/classic)
121	cat $@ || echo "ERROR: unpacking $(CLASSIC_TARBALL) failed"
122endif
123
124