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