1 | .PHONY: config-stamp |
---|
2 | |
---|
3 | SHELL=/bin/sh |
---|
4 | DIST=_dist |
---|
5 | DC=$(DIST)/dotclear |
---|
6 | |
---|
7 | default: |
---|
8 | @echo "make config or make dist" |
---|
9 | |
---|
10 | config: clean config-stamp |
---|
11 | mkdir -p ./$(DC) |
---|
12 | |
---|
13 | ## Copy needed folders and files |
---|
14 | cp -pRf ./admin ./inc ./index.php ./CHANGELOG ./CREDITS ./LICENSE ./README.md ./CONTRIBUTING.md ./$(DC)/ |
---|
15 | |
---|
16 | ## Locales directory |
---|
17 | mkdir -p ./$(DC)/locales |
---|
18 | cp -pRf ./locales/README ./locales/en ./locales/fr ./$(DC)/locales/ |
---|
19 | |
---|
20 | ## Remove tests directories and test stuff |
---|
21 | rm -fr ./$(DC)/inc/libs/clearbricks/tests ./$(DC)/inc/libs/clearbricks/composer.* \ |
---|
22 | ./$(DC)/inc/libs/clearbricks/.atoum.* ./$(DC)/inc/libs/clearbricks/vendor \ |
---|
23 | ./$(DC)/inc/libs/clearbricks/bin ./$(DC)/inc/libs/clearbricks/_dist \ |
---|
24 | ./$(DC)/.atoum.* ./$(DC)/test ./$(DC)/travis \ |
---|
25 | ./$(DC)/features ./$(DC)/travis ./$(DC)/behat.yml.dist ./$(DC)/composer.* |
---|
26 | |
---|
27 | ## Create cache, var, db, plugins, themes and public folders |
---|
28 | mkdir ./$(DC)/cache ./$(DC)/var ./$(DC)/db ./$(DC)/plugins ./$(DC)/themes ./$(DC)/public |
---|
29 | cp -p inc/.htaccess ./$(DC)/cache/ |
---|
30 | cp -p inc/.htaccess ./$(DC)/var/ |
---|
31 | cp -p inc/.htaccess ./$(DC)/db/ |
---|
32 | cp -p inc/.htaccess ./$(DC)/plugins/ |
---|
33 | |
---|
34 | ## Remove config file if any |
---|
35 | rm -f ./$(DC)/inc/config.php |
---|
36 | |
---|
37 | ## Copy built-in themes |
---|
38 | cp -pRf \ |
---|
39 | ./themes/default \ |
---|
40 | ./themes/blueSilence \ |
---|
41 | ./themes/customCSS \ |
---|
42 | ./themes/ductile \ |
---|
43 | ./themes/berlin \ |
---|
44 | ./$(DC)/themes/ |
---|
45 | |
---|
46 | ## Copy built-in plugins based on DC_DISTRIB_PLUGINS constant |
---|
47 | cp -pRf $$(grep DC_DISTRIB_PLUGINS inc/prepend.php | \ |
---|
48 | sed -e "s/.*,'//" -e "s/'.*//" | \ |
---|
49 | sed -e 's/\(^\|,\)/ .\/plugins\//g') \ |
---|
50 | ./$(DC)/plugins/ |
---|
51 | |
---|
52 | ## "Compile" .po files |
---|
53 | ./build-tools/make-l10n.php ./$(DC)/ |
---|
54 | |
---|
55 | ## Pack javascript files |
---|
56 | find $(DC)/admin/js/*.js -exec ./build-tools/min-js.php \{\} \; |
---|
57 | find $(DC)/admin/js/codemirror -name '*.js' -exec ./build-tools/min-js.php \{\} \; |
---|
58 | find $(DC)/admin/js/ie7/*.js -exec ./build-tools/min-js.php \{\} \; |
---|
59 | find $(DC)/admin/js/jquery/*.js -exec ./build-tools/min-js.php \{\} \; |
---|
60 | find $(DC)/admin/js/jsUpload/*.js -exec ./build-tools/min-js.php \{\} \; |
---|
61 | find $(DC)/plugins -name '*.js' -exec ./build-tools/min-js.php \{\} \; |
---|
62 | find $(DC)/themes/default/js/*.js -exec ./build-tools/min-js.php \{\} \; |
---|
63 | find $(DC)/inc/js -name '*.js' -exec ./build-tools/min-js.php \{\} \; |
---|
64 | |
---|
65 | ## Debug off |
---|
66 | perl -pi -e "s|^//\*== DC_DEBUG|/*== DC_DEBUG|sgi;" $(DC)/inc/prepend.php $(DC)/inc/prepend.php |
---|
67 | |
---|
68 | ## Remove scm files and folders from DC and CB |
---|
69 | find ./$(DIST)/ -type d -name '.svn' | xargs -r rm -rf |
---|
70 | find ./$(DIST)/ -type d -name '.hg' | xargs -r rm -rf |
---|
71 | find ./$(DIST)/ -type d -name '.git' | xargs -r rm -rf |
---|
72 | find ./$(DIST)/ -type f -name '.*ignore' | xargs -r rm -rf |
---|
73 | find ./$(DIST)/ -type f -name '.flow' | xargs -r rm -rf |
---|
74 | |
---|
75 | ## Create digest |
---|
76 | cd $(DC) && ( \ |
---|
77 | md5sum `find . -type f -not -path "./inc/digest" -not -path "./cache/*" -not -path "./var/*" -not -path "./db/*" -not -path ./CHANGELOG` \ |
---|
78 | > inc/digests \ |
---|
79 | ) |
---|
80 | |
---|
81 | touch config-stamp |
---|
82 | |
---|
83 | dist: config dist-tgz dist-zip dist-l10n |
---|
84 | |
---|
85 | deb: |
---|
86 | cp ./README.md debian/README |
---|
87 | dpkg-buildpackage -rfakeroot |
---|
88 | |
---|
89 | dist-tgz: |
---|
90 | [ -f config-stamp ] |
---|
91 | cd $(DIST) && tar cfz dotclear-$$(grep DC_VERSION dotclear/inc/prepend.php | cut -d"'" -f4).tar.gz ./dotclear |
---|
92 | |
---|
93 | dist-zip: |
---|
94 | [ -f config-stamp ] |
---|
95 | cd $(DIST) && zip -r9 dotclear-$$(grep DC_VERSION dotclear/inc/prepend.php | cut -d"'" -f4).zip ./dotclear |
---|
96 | |
---|
97 | dist-l10n: |
---|
98 | [ -f config-stamp ] |
---|
99 | |
---|
100 | rm -rf ./$(DIST)/l10n |
---|
101 | mkdir -p ./$(DIST)/l10n |
---|
102 | |
---|
103 | find ./locales/ -maxdepth 1 -mindepth 1 -type d -not -name '.svn' -not -name '_pot' -not -name 'en' \ |
---|
104 | -exec cp -pRf \{\} ./$(DIST)/l10n/ \; |
---|
105 | |
---|
106 | find ./$(DIST)/l10n -type d -name '.svn' | xargs rm -rf |
---|
107 | ./build-tools/make-l10n.php ./$(DIST)/l10n/ |
---|
108 | |
---|
109 | cd ./$(DIST)/l10n && for i in *; do \ |
---|
110 | zip -r9 "$$i-$$(grep DC_VERSION ../dotclear/inc/prepend.php | cut -d"'" -f4).zip" "$$i"; \ |
---|
111 | rm -rf "$$i"; \ |
---|
112 | done |
---|
113 | |
---|
114 | |
---|
115 | clean: |
---|
116 | rm -rf $(DIST) config-stamp |
---|
117 | |
---|
118 | |
---|
119 | ## Modules (Themes and Plugins) ############################################### |
---|
120 | pack-tool: |
---|
121 | [ "$(ipath)" != '' ] |
---|
122 | [ "$(iname)" != '' ] |
---|
123 | [ "$(iname)" != '' ] |
---|
124 | [ -d $(ipath)/$(iname) ] |
---|
125 | |
---|
126 | |
---|
127 | copy-plugins: clean |
---|