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